summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/smb_build/header.pm86
-rw-r--r--source4/build/smb_build/main.pl3
-rw-r--r--source4/build/smb_build/makefile.pm7
3 files changed, 8 insertions, 88 deletions
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm
deleted file mode 100644
index 93240f1d17..0000000000
--- a/source4/build/smb_build/header.pm
+++ /dev/null
@@ -1,86 +0,0 @@
-# SMB Build System
-# - create output for build.h
-#
-# Copyright (C) Stefan (metze) Metzmacher 2004
-# Copyright (C) Jelmer Vernooij 2005
-# Released under the GNU GPL
-
-package header;
-use strict;
-
-sub _add_define_section($)
-{
- my $DEFINE = shift;
- my $output = "";
-
- $output .= "
-/* $DEFINE->{COMMENT} */
-#define $DEFINE->{KEY} $DEFINE->{VAL}
-";
-
- return $output;
-}
-
-sub _prepare_build_h($)
-{
- my $depend = shift;
- my @defines = ();
- my $output = "";
-
- foreach my $key (values %$depend) {
- my $DEFINE = ();
- next if ($key->{TYPE} ne "LIBRARY" and
- $key->{TYPE} ne "MODULE" and
- $key->{TYPE} ne "SUBSYSTEM" and
- $key->{TYPE} ne "BINARY");
- next unless defined($key->{INIT_FUNCTIONS});
-
- my $name = $key->{NAME};
- $name =~ s/-/_/g;
- $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
- $DEFINE->{KEY} = "STATIC_$name\_MODULES";
- $DEFINE->{VAL} = "\\\n";
- foreach (@{$key->{INIT_FUNCTIONS}}) {
- $DEFINE->{VAL} .= "\t$_, \\\n";
- unless (/{/) {
- my $fn = $key->{INIT_FUNCTION_TYPE};
- $fn =~ s/\(\*\)/$_/;
- $output .= "$fn;\n";
- }
- }
-
- $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n";
-
- push(@defines,$DEFINE);
- }
-
- #
- # loop over all BUILD_H define sections
- #
- foreach (@defines) { $output .= _add_define_section($_); }
-
- return $output;
-}
-
-###########################################################
-# This function creates include/build.h from the SMB_BUILD
-# context
-#
-# create_build_h($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-#
-# $output - the resulting output buffer
-sub create_smb_build_h($$)
-{
- my ($CTX, $file) = @_;
-
- open(BUILD_H,">$file") || die ("Can't open `$file'\n");
- print BUILD_H "/* autogenerated by build/smb_build/main.pl */\n";
- print BUILD_H _prepare_build_h($CTX);
- close(BUILD_H);
-
- print __FILE__.": creating $file\n";
-}
-
-1;
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index d00c864f50..c7a92b7ce1 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -6,7 +6,6 @@
# Released under the GNU GPL
use smb_build::makefile;
-use smb_build::header;
use smb_build::input;
use smb_build::config_mk;
use smb_build::output;
@@ -89,10 +88,10 @@ foreach my $key (values %$OUTPUT) {
$mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}) or
defined($key->{PUBLIC_PROTO_HEADER});
+ $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS});
}
$mkenv->write("data.mk");
-header::create_smb_build_h($OUTPUT, "include/build.h");
cflags::create_cflags($OUTPUT, $config::config{srcdir},
$config::config{builddir}, "extra_cflags.txt");
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 15e428a2b9..fdfdc79b10 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -116,6 +116,7 @@ sub Integrated($$)
$self->_prepare_list($ctx, "OBJ_LIST");
$self->output("$ctx->{SUBSYSTEM}_OBJ_LIST += \$($ctx->{NAME}_OBJ_LIST)\n");
+ $self->output("$ctx->{SUBSYSTEM}_INIT_FUNCTIONS += \"$ctx->{INIT_FUNCTION},\"\n") if defined($ctx->{INIT_FUNCTION});
}
sub SharedModulePrimitives($$)
@@ -244,6 +245,12 @@ sub StaticLibraryPrimitives($$)
$self->_prepare_list($ctx, "OBJ_LIST");
}
+sub InitFunctions($$)
+{
+ my ($self, $ctx) = @_;
+ $self->output("\$($ctx->{NAME}_OBJ_LIST): CFLAGS+=-DSTATIC_$ctx->{NAME}_MODULES=\"\$($ctx->{NAME}_INIT_FUNCTIONS)$ctx->{INIT_FUNCTION_SENTINEL}\"\n");
+}
+
sub StaticLibrary($$)
{
my ($self,$ctx) = @_;