summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/smb_build/README.txt4
-rw-r--r--source4/build/smb_build/depend.pm461
-rw-r--r--source4/build/smb_build/direct.pm29
-rw-r--r--source4/build/smb_build/dump.pm25
-rw-r--r--source4/build/smb_build/input.pm151
-rw-r--r--source4/build/smb_build/main.pm17
-rw-r--r--source4/build/smb_build/makefile.pm242
-rw-r--r--source4/build/smb_build/output.pm306
-rw-r--r--source4/build/smb_build/public.m428
-rw-r--r--source4/build/smb_build/smb_build_h.pm53
-rw-r--r--source4/gtk/config.mk3
-rw-r--r--source4/lib/cmdline/config.m47
-rw-r--r--source4/lib/ldb/config.mk4
-rw-r--r--source4/lib/popt/config.m45
-rw-r--r--source4/lib/registry/config.mk3
-rw-r--r--source4/lib/tdb/config.mk3
-rw-r--r--source4/libcli/auth/gensec.mk3
-rw-r--r--source4/smbd/process_model.mk3
18 files changed, 325 insertions, 1022 deletions
diff --git a/source4/build/smb_build/README.txt b/source4/build/smb_build/README.txt
index 1350f12336..85d61f6bc2 100644
--- a/source4/build/smb_build/README.txt
+++ b/source4/build/smb_build/README.txt
@@ -26,7 +26,6 @@ BINARY:
(e.g. 'smbtorture' or 'ldbedit')
a BINARY typicly has only commandline handling and basic
functionality code in it and depends on the functions of
- EXT_LIB's (required_libraries/REQUIRED_LIBRARIES) and/or
SUBSYSTEM's (required_subsystems/REQUIRED_SUBSYSTEMS).
LIBRARY:
@@ -35,8 +34,7 @@ LIBRARY:
(e.g. for libldb 'libldb.so', 'libldb.so.0' 'libldb.so.0.0.1'
and libldb.a are created on linux)
a LIBRARY typicly has only glue code in it and depends on
- the functions of EXT_LIB's (required_libraries/REQUIRED_LIBRARIES)
- and/or SUBSYSTEM's (required_subsystems/REQUIRED_SUBSYSTEMS).
+ SUBSYSTEM's (required_subsystems/REQUIRED_SUBSYSTEMS).
Macrodescriptions
diff --git a/source4/build/smb_build/depend.pm b/source4/build/smb_build/depend.pm
deleted file mode 100644
index 2be9c4bdf2..0000000000
--- a/source4/build/smb_build/depend.pm
+++ /dev/null
@@ -1,461 +0,0 @@
-###########################################################
-### SMB Build System ###
-### - the dependency calculation functions ###
-### ###
-### Copyright (C) Stefan (metze) Metzmacher 2004 ###
-### Released under the GNU GPL ###
-###########################################################
-
-package depend;
-use strict;
-
-###########################################################
-# This function resolves the dependencies
-# for the SUBSYSTEMS_LIST
-# @SUBSYSTEMS_LIST = _do_calc_subsystem_list($SMB_BUILD_CTX, \@SUBSYSTEMS_LIST);
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-#
-# \@SUBSYSTEMS_LIST - the reference to the SUBSYSTEMS_LIST
-#
-# @SUBSYSTEMS_LIST - the expanded resulting SUBSYSTEMS_LIST
-#
-sub _do_calc_subsystem_list($$)
-{
- my $CTX = shift;
- my $subsys_list = shift;
- my @SUBSYSTEMS_LIST = @$subsys_list;
-
- #
- # now try to resolve the dependencies for the library
- #
- my $i = 0;
- my $count = $#SUBSYSTEMS_LIST;
- for (;$i<=$count;$i++) {
- #
- # see if the current subsystem depends on other not listed subsystems
- #
- foreach my $elem (@{$CTX->{DEPEND}{SUBSYSTEMS}{$SUBSYSTEMS_LIST[$i]}{SUBSYSTEMS_LIST}}) {
- my $seen = 0;
- #
- # check if it's already in the list
- #
- foreach my $elem2 (@SUBSYSTEMS_LIST) {
- #
- # check of the names matche
- #
- if ($elem eq $elem2) {
- #
- # mark it as already in the list
- #
- $seen = 1;
- last;
- }
- }
-
- #
- # if it's already there skip it
- #
- if ($seen == 1) {
- next;
- }
-
- #
- # if it's not there add it
- # and $count++
- #
- push(@SUBSYSTEMS_LIST,$elem);
- $count++;
- }
- }
-
- return @SUBSYSTEMS_LIST;
-}
-
-###########################################################
-# This function resolves the dependencies
-# for the LIBRARIES_LIST based on the SUBSYSTEMS_LIST
-# @LIBRARIES_LIST = _do_calc_libraries_list($SMB_BUILD_CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST);
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-#
-# \@SUBSYSTEMS_LIST - the reference to the SUBSYSTEMS_LIST
-#
-# \@LIBRARIES_LIST - the reference to the LIBRARIES_LIST
-#
-# @LIBRARIES_LIST - the expanded resulting LIBRARIES_LIST
-#
-sub _do_calc_libraries_list($$$)
-{
- my $CTX = shift;
- my $subsys_list = shift;
- my @SUBSYSTEMS_LIST = @$subsys_list;
- my $libs_list = shift;
- my @LIBRARIES_LIST = @$libs_list;
-
- #
- # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST
- #
- foreach my $elem (@SUBSYSTEMS_LIST) {
- #
- # see if the subsystem depends on a not listed LIBRARY
- #
- foreach my $elem1 (@{$CTX->{DEPEND}{SUBSYSTEMS}{$elem}{LIBRARIES_LIST}}) {
- my $seen = 0;
- #
- # check if it's already in the list
- #
- foreach my $elem2 (@LIBRARIES_LIST) {
- #
- # check of the names matche
- #
- if ($elem1 eq $elem2) {
- #
- # mark it as already in the list
- #
- $seen = 1;
- last;
- }
- }
-
- #
- # if it's already there skip it
- #
- if ($seen == 1) {
- next;
- }
-
- #
- # if it's not there add it
- #
- push(@LIBRARIES_LIST,$elem1);
- }
- }
-
- return @LIBRARIES_LIST;
-}
-
-###########################################################
-# This function creates the dependencies for subsystems
-# _do_depend_subsystems($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub _do_depend_subsystems($)
-{
- my $CTX = shift;
-
- #
- # loop on all subsystems
- #
- foreach my $key (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) {
- my $name = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME};
- my @STATIC_MODULES_LIST = ();
- my @INIT_FUNCTIONS = ();
-
- #
- # skip when the subsystem was disabled
- #
- if ($CTX->{INPUT}{SUBSYSTEMS}{$key}{ENABLE} ne "YES" ) {
- next;
- }
-
- #
- # create the subsystems used OBJ_LIST
- #
- my @OBJ_LIST = ();
- push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}});
- push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}});
-
- #
- # create the subsystems used SUBSYSTEMS_LIST
- #
- my @SUBSYSTEMS_LIST = ();
- push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}}));
- #
- # create the subsystems used LIBRARIES_LIST
- #
- my @LIBRARIES_LIST = ();
- push (@LIBRARIES_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}});
-
- #
- # now collect the info from the subsystems static modules
- #
- foreach my $subkey (sort keys %{$CTX->{INPUT}{MODULES}}) {
- #
- # we only want STATIC modules
- #
- if ($CTX->{INPUT}{MODULES}{$subkey}{BUILD} ne "STATIC") {
- next;
- }
-
- #
- # we only want modules which belong to the current subsystem
- #
- if ($CTX->{INPUT}{MODULES}{$subkey}{SUBSYSTEM} ne $name) {
- next;
- }
-
- #
- # add it to the STATIC_MODULES_LIST
- #
- push(@STATIC_MODULES_LIST,$subkey);
- push (@INIT_FUNCTIONS, $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION}) if $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION} ne "";
-
- #
- # add OBJS of static modules to the subsystems used OBJ_LIST
- #
- push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}}));
- push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}}));
-
- #
- # add SUBSYSTEMS of static modules to the subsystems used SUBSYSTEMS_LIST
- #
- push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}}));
-
- #
- # add LIBRARIES of static modules to the subsystems used LIBRARIES_LIST
- #
- push (@LIBRARIES_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}}));
- }
-
- #
- # set the lists
- #
- @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS;
- @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST;
- @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}} = @STATIC_MODULES_LIST;
- @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST;
- @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST;
- }
-
- return;
-}
-
-###########################################################
-# This function creates the dependencies for ext libs
-# _do_depend_ext_libs($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub _do_depend_ext_libs($)
-{
- my $CTX = shift;
-
- #
- # loop over all ext libs
- #
- foreach my $key (sort keys %{$CTX->{INPUT}{EXT_LIBS}}) {
- my $name = $CTX->{INPUT}{EXT_LIBS}{$key}{NAME};
-
- #
- # if it's not a shared module skip it
- #
- if ($CTX->{INPUT}{EXT_LIBS}{$key}{ENABLE} ne "YES") {
- next;
- }
-
- #
- # set the lists
- #
- $CTX->{DEPEND}{EXT_LIBS}{$key}{NAME} = $name;
- @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LIBS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{LIBS}};
- @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{CFLAGS}};
- @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CPPFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{CPPFLAGS}};
- @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LDFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{LDFLAGS}};
- }
-
- return;
-}
-
-###########################################################
-# This function creates the dependencies for shared modules
-# _do_depend_shared_modules($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub _do_depend_shared_modules($)
-{
- my $CTX = shift;
-
- #
- # loop over all shared modules
- #
- foreach my $key (sort keys %{$CTX->{INPUT}{MODULES}}) {
- my $name = $CTX->{INPUT}{MODULES}{$key}{NAME};
-
- #
- # if it's not a shared module skip it
- #
- if ($CTX->{INPUT}{MODULES}{$key}{BUILD} ne "SHARED" ) {
- next;
- }
-
- #
- # create the shared modules used SUBSYSTEMS_LIST
- #
- my @SUBSYSTEMS_LIST = ();
- push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}}));
-
- #
- # now try to resolve the dependencies for the shared module
- #
- @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST);
-
- #
- # create the shared modules used LIBRARIES_LIST
- #
- my @LIBRARIES_LIST = ();
- push (@LIBRARIES_LIST, @{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}});
-
- #
- # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST
- #
- @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST);
-
- #
- # set the lists
- #
- @{$CTX->{DEPEND}{SHARED_MODULES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST;
- @{$CTX->{DEPEND}{SHARED_MODULES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST;
- }
-
- return;
-}
-
-###########################################################
-# This function creates the dependencies for libraries
-# _do_depend_libraries($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub _do_depend_libraries($)
-{
- my $CTX = shift;
-
- #
- # loop over all libraries
- #
- foreach my $key (sort keys %{$CTX->{INPUT}{LIBRARIES}}) {
- my $name = $CTX->{INPUT}{LIBRARIES}{$key}{NAME};
-
- #
- # if it's not a library skip it
- #
- if ($CTX->{INPUT}{LIBRARIES}{$key}{ENABLE} ne "YES" ) {
- next;
- }
-
- #
- # create the libraries used SUBSYSTEMS_LIST
- #
- my @SUBSYSTEMS_LIST = ();
- push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}});
-
- #
- # now try to resolve the dependencies for the library
- #
- @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST);
-
- #
- # create the libraries used LIBRARIES_LIST
- #
- my @LIBRARIES_LIST = ();
- push (@LIBRARIES_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}});
-
- #
- # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST
- #
- @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST);
-
- #
- # set the lists
- #
- @{$CTX->{DEPEND}{LIBRARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST;
- @{$CTX->{DEPEND}{LIBRARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST;
- }
-
- return;
-}
-
-###########################################################
-# This function creates the dependencies for binaries
-# _do_depend_binaries($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub _do_depend_binaries($)
-{
- my $CTX = shift;
-
- #
- # loop over all binaries
- #
- foreach my $key (sort keys %{$CTX->{INPUT}{BINARIES}}) {
- my $name = $CTX->{INPUT}{BINARIES}{$key}{NAME};
-
- #
- # skip when the binary was disabled
- #
- if ($CTX->{INPUT}{BINARIES}{$key}{ENABLE} ne "YES" ) {
- next;
- }
-
- #
- # create the binaries used SUBSYSTEMS_LIST
- #
- my @SUBSYSTEMS_LIST = ();
- push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}});
-
- #
- # now try to resolve the dependencies for the binary
- #
- @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST);
-
- my @INIT_FUNCTIONS = ();
-
- foreach my $subkey (@SUBSYSTEMS_LIST)
- {
- push (@INIT_FUNCTIONS, $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION}) if defined ($CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION}) and $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION} ne "";
- }
-
- #
- # create the binaries used LIBRARIES_LIST
- #
- my @LIBRARIES_LIST = ();
- push (@LIBRARIES_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}});
-
- #
- # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST
- #
- @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST);
-
- #
- # set the lists
- #
- @{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST;
- @{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST;
- @{$CTX->{DEPEND}{BINARIES}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS;
- }
-
- return;
-}
-
-###########################################################
-# This function creates the dependency tree from the SMB_BUILD
-# context
-# create_depend($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub create_depend($)
-{
- my $CTX = shift;
-
- _do_depend_ext_libs($CTX);
-
- _do_depend_subsystems($CTX);
-
- _do_depend_shared_modules($CTX);
-
- _do_depend_libraries($CTX);
-
- _do_depend_binaries($CTX);
-
- return;
-}
-1;
diff --git a/source4/build/smb_build/direct.pm b/source4/build/smb_build/direct.pm
index 6bedf4f04a..9baba695f4 100644
--- a/source4/build/smb_build/direct.pm
+++ b/source4/build/smb_build/direct.pm
@@ -10,7 +10,8 @@ sub Subsystem($$)
my $name = shift;
my $data = shift;
$data->{NAME} = $name;
- %{$SMB_BUILD_CTX->{INPUT}{SUBSYSTEM}{$name}} = %{$data};
+ $data->{TYPE} = "SUBSYSTEM";
+ %{$SMB_BUILD_CTX->{INPUT}{$name}} = %{$data};
}
sub Module($$)
@@ -18,7 +19,8 @@ sub Module($$)
my $name = shift;
my $data = shift;
$data->{NAME} = $name;
- %{$SMB_BUILD_CTX->{INPUT}{MODULES}{$name}} = %{$data};
+ $data->{TYPE} = "MODULE";
+ %{$SMB_BUILD_CTX->{INPUT}{$name}} = %{$data};
}
sub ExternalLibrary($$)
@@ -26,7 +28,8 @@ sub ExternalLibrary($$)
my $name = shift;
my $data = shift;
$data->{NAME} = $name;
- %{$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$name}} = %{$data};
+ $data->{TYPE} = "EXT_LIB";
+ %{$SMB_BUILD_CTX->{INPUT}{$name}} = %{$data};
}
sub Library($$)
@@ -34,7 +37,8 @@ sub Library($$)
my $name = shift;
my $data = shift;
$data->{NAME} = $name;
- %{$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$name}} = %{$data};
+ $data->{TYPE} = "LIBRARY";
+ %{$SMB_BUILD_CTX->{INPUT}{$name}} = %{$data};
}
sub Binary($$)
@@ -42,22 +46,13 @@ sub Binary($$)
my $name = shift;
my $data = shift;
$data->{NAME} = $name;
- %{$SMB_BUILD_CTX->{INPUT}{BINARIES}{$name}} = %{$data};
+ $data->{TYPE} = "BINARY";
+ %{$SMB_BUILD_CTX->{INPUT}{$name}} = %{$data};
}
-sub DisableModule($)
+sub Disable($)
{
- $SMB_BUILD_CTX->{INPUT}{MODULES}{shift}{ENABLE} = "NO";
-}
-
-sub DisableBinary($)
-{
- $SMB_BUILD_CTX->{INPUT}{BINARIES}{shift}{ENABLE} = "NO";
-}
-
-sub DisableLibrary($)
-{
- $SMB_BUILD_CTX->{INPUT}{LIBRARIES}{shift}{ENABLE} = "NO";
+ $SMB_BUILD_CTX->{INPUT}{shift}{ENABLE} = "NO";
}
1;
diff --git a/source4/build/smb_build/dump.pm b/source4/build/smb_build/dump.pm
deleted file mode 100644
index 9a751e3563..0000000000
--- a/source4/build/smb_build/dump.pm
+++ /dev/null
@@ -1,25 +0,0 @@
-###########################################################
-### SMB Build System ###
-### - the dump & debug functions ###
-### ###
-### Copyright (C) Stefan (metze) Metzmacher 2004 ###
-### Released under the GNU GPL ###
-###########################################################
-
-package dump;
-use strict;
-
-use Data::Dumper;
-
-sub dump_ctx($)
-{
- my $ctx = shift;
-
- open (DUMP,"> config.smb_build.dump");
-
- print DUMP Dumper($ctx);
-
- close(DUMP);
-}
-
-1;
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index a6d5b25f41..c4a4052d8f 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -3,12 +3,15 @@
### - the input checking functions ###
### ###
### Copyright (C) Stefan (metze) Metzmacher 2004 ###
+### Copyright (C) Jelmer Vernooij 2004 ###
### Released under the GNU GPL ###
###########################################################
use strict;
package input;
+our $srcdir = ".";
+
sub strtrim($)
{
my $str = shift;
@@ -41,85 +44,95 @@ sub str2array($)
return @ar;
}
-sub _check_subsystems($)
+sub check_subsystem($$)
{
my $CTX = shift;
-
- foreach my $subsys (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) {
- if ($CTX->{INPUT}{SUBSYSTEMS}{$subsys}{ENABLE} ne "YES") {
- printf("Subsystem: %s disabled!\n",$CTX->{INPUT}{SUBSYSTEMS}{$subsys}{NAME});
- next;
- }
+ my $subsys = shift;
+ if ($subsys->{ENABLE} ne "YES") {
+ printf("Subsystem: %s disabled!\n",$subsys->{NAME});
}
-
- return;
+
+ # FIXME: Make this configurable (so it can be STATIC_LIBRARY, for example)
+ $subsys->{OUTPUT_TYPE} = "OBJLIST";
}
-sub _check_modules($)
+sub check_module($$)
{
my $CTX = shift;
+ my $mod = shift;
- foreach my $mod (sort keys %{$CTX->{INPUT}{MODULES}}) {
- my $subsys = $CTX->{INPUT}{MODULES}{$mod}{SUBSYSTEM};
- my $default_build = $CTX->{INPUT}{MODULES}{$mod}{DEFAULT_BUILD};
- my $build = $CTX->{INPUT}{MODULES}{$mod}{CHOSEN_BUILD};
- my $use_default = 0;
-
- if (!(defined($CTX->{INPUT}{SUBSYSTEMS}{$subsys}))) {
- $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT";
- printf("Module: %s...PARENT SUBSYSTEM DISABLED\n",$mod);
- next;
- }
+ my $use_default = 0;
- if ($build eq "DEFAULT") {
- $build = $default_build;
- $use_default = 1;
- }
+ if (!(defined($CTX->{INPUT}{$mod->{SUBSYSTEM}}))) {
+ $mod->{BUILD} = "NOT";
+ $mod->{ENABLE} = "NO";
+ printf("Module: %s...PARENT SUBSYSTEM DISABLED\n",$mod->{NAME});
+ return;
+ }
- if ($build eq "SHARED") {
- $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "SHARED";
- printf("Module: %s...shared\n",$mod);
- } elsif ($build eq "STATIC") {
- $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "STATIC";
- printf("Module: %s...static\n",$mod);
- } else {
- $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT";
- printf("Module: %s...not\n",$mod);
- next;
- }
+ if ($mod->{CHOSEN_BUILD} eq "DEFAULT") {
+ $mod->{CHOSEN_BUILD} = $mod->{DEFAULT_BUILD};
}
- return;
+ if ($mod->{CHOSEN_BUILD} eq "SHARED") {
+ $mod->{ENABLE} = "YES";
+ $mod->{OUTPUT_TYPE} = "SHARED_LIBRARY";
+ push (@{$mod->{REQUIRED_SUBSYSTEMS}}, $mod->{SUBSYSTEM});
+ printf("Module: %s...shared\n",$mod->{NAME});
+ } elsif ($mod->{CHOSEN_BUILD} eq "STATIC") {
+ $mod->{ENABLE} = "YES";
+ push (@{$CTX->{INPUT}{$mod->{SUBSYSTEM}}{REQUIRED_SUBSYSTEMS}}, $mod->{NAME});
+ printf("Module: %s...static\n",$mod->{NAME});
+ $mod->{OUTPUT_TYPE} = "OBJLIST";
+ } else {
+ $mod->{ENABLE} = "NO";
+ printf("Module: %s...not\n",$mod->{NAME});
+ return;
+ }
}
-sub _check_libraries($)
+sub check_library($$)
{
my $CTX = shift;
+ my $lib = shift;
- foreach my $lib (sort keys %{$CTX->{INPUT}{LIBRARIES}}) {
- if ($CTX->{INPUT}{LIBRARIES}{$lib}{ENABLE} ne "YES") {
- printf("Library: %s...disabled\n",$CTX->{INPUT}{LIBRARIES}{$lib}{NAME});
- next;
- }
+ if ($lib->{ENABLE} ne "YES") {
+ printf("Library: %s...disabled\n",$lib->{NAME});
+ return;
}
- return;
+ $lib->{OUTPUT_TYPE} = "SHARED_LIBRARY";
}
-sub _check_binaries($)
+sub check_binary($$)
{
my $CTX = shift;
+ my $bin = shift;
- foreach my $bin (sort keys %{$CTX->{INPUT}{BINARIES}}) {
- if ($CTX->{INPUT}{BINARIES}{$bin}{ENABLE} ne "YES") {
- printf("Binary: %s...disabled\n",$CTX->{INPUT}{BINARIES}{$bin}{NAME});
- next;
- }
+ if ($bin->{ENABLE} ne "YES") {
+ printf("Binary: %s...disabled\n",$bin->{NAME});
+ return;
}
- return;
+ $bin->{OUTPUT_TYPE} = "BINARY";
+}
+
+sub calc_unique_deps
+{
+ my $deps = shift;
+ my $udeps = shift;
+
+ foreach my $dep (@{$deps}) {
+ if (not defined($udeps->{$$dep->{NAME}})) {
+ $udeps->{$$dep->{NAME}} = "BUSY";
+ calc_unique_deps($$dep->{DEPENDENCIES}, $udeps);
+ $udeps->{$$dep->{NAME}} = $$dep;
+ }
+ }
}
+
+
###########################################################
# This function checks the input from the configure script
#
@@ -130,14 +143,40 @@ sub check($)
{
my $CTX = shift;
- _check_subsystems($CTX);
+ foreach my $part (values %{$CTX->{INPUT}}) {
+ check_subsystem($CTX, $part) if ($part->{TYPE} eq "SUBSYSTEM");
+ check_module($CTX, $part) if ($part->{TYPE} eq "MODULE");
+ check_library($CTX, $part) if ($part->{TYPE} eq "LIBRARY");
+ check_binary($CTX, $part) if ($part->{TYPE} eq "BINARY");
+
+ #FIXME: REQUIRED_LIBRARIES needs to go
+ if (defined($part->{REQUIRED_LIBRARIES})) {
+ push(@{$part->{REQUIRED_SUBSYSTEMS}}, @{$part->{REQUIRED_LIBRARIES}});
+ delete ($part->{REQUIRED_LIBRARIES});
+ }
+ }
+
+ my %depend = %{$CTX->{INPUT}};
- _check_modules($CTX);
+ foreach my $part (values %depend) {
+
+ # Generate list of dependencies
+ $part->{DEPENDENCIES} = [];
- _check_libraries($CTX);
+ foreach my $key (@{$part->{REQUIRED_SUBSYSTEMS}}) {
+ die("$part->{NAME} has undefined dependency $key\n") if not defined($depend{$key});
+ push (@{$part->{DEPENDENCIES}}, \$depend{$key});
+ }
- _check_binaries($CTX);
+ delete ($part->{REQUIRED_SUBSYSTEMS});
+ }
- return;
+ foreach my $part (values %depend) {
+ $part->{UNIQUE_DEPENDENCIES} = {};
+ calc_unique_deps($part->{DEPENDENCIES}, $part->{UNIQUE_DEPENDENCIES});
+ }
+
+ return %depend;
}
+
1;
diff --git a/source4/build/smb_build/main.pm b/source4/build/smb_build/main.pm
index a9e755dd6f..50aae15fdc 100644
--- a/source4/build/smb_build/main.pm
+++ b/source4/build/smb_build/main.pm
@@ -7,13 +7,11 @@
###########################################################
use makefile;
-use depend;
use smb_build_h;
use input;
use config_mk;
use output;
use direct;
-use dump;
use strict;
sub smb_build_main($)
@@ -23,19 +21,12 @@ sub smb_build_main($)
INPUT => $INPUT
);
- input::check(\%SMB_BUILD_CTX);
+ %{$SMB_BUILD_CTX{DEPEND}} = input::check(\%SMB_BUILD_CTX);
- depend::create_depend(\%SMB_BUILD_CTX);
+ %{$SMB_BUILD_CTX{OUTPUT}} = output::create_output($SMB_BUILD_CTX{DEPEND});
- output::create_output(\%SMB_BUILD_CTX);
+ makefile::create_makefile_in($SMB_BUILD_CTX{OUTPUT});
- makefile::create_makefile_in(\%SMB_BUILD_CTX);
-
- smb_build_h::create_smb_build_h(\%SMB_BUILD_CTX);
-
- dump::dump_ctx(\%SMB_BUILD_CTX);
-
-
- return 0;
+ smb_build_h::create_smb_build_h($SMB_BUILD_CTX{OUTPUT});
}
1;
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 96225de0ba..21e2100fb2 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -254,7 +254,7 @@ sub array2oneline($)
# $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
#
# $output - the resulting output buffer
-sub _prepare_var_obj_list($$)
+sub _prepare_obj_list($$)
{
my $var = shift;
my $ctx = shift;
@@ -312,45 +312,66 @@ sub _prepare_module_obj_list($)
}
###########################################################
-# This function creates a make rule for linking a shared module
+# This function creates a make rule for linking a library
#
-# $output = _prepare_shared_module_rule($module_ctx)
+# $output = _prepare_shared_library_rule($library_ctx)
#
-# $module_ctx - the module context
+# $library_ctx - the library context
+#
+# $library_ctx->{NAME} - the library name
+#
+# $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
#
-# $module_ctx->{MODULE} - the module binary name
-# $module_ctx->{DEPEND_LIST} - the list of rules on which this module depends
-# $module_ctx->{LINK_LIST} - the list of objectfiles and external libraries
-# which sould be linked to this module
-# $module_ctx->{LINK_FLAGS} - linker flags used by this module
+# $library_ctx->{LIBRARY_NAME} - the shared library name
+# $library_ctx->{LIBRARY_REALNAME} - the shared library real name
+# $library_ctx->{LIBRARY_SONAME} - the shared library soname
+# $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
+# which sould be linked to this shared library
+# $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
#
# $output - the resulting output buffer
-sub _prepare_shared_module_rule($)
+sub _prepare_shared_library_rule($)
{
my $ctx = shift;
my $tmpdepend;
- my $tmplink;
- my $tmpflag;
+ my $tmpstlink;
+ my $tmpstflag;
+ my $tmpshlink;
+ my $tmpshflag;
+ my $tmprules;
my $output;
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
- $tmplink = array2oneperline($ctx->{LINK_LIST});
- $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
+
+ $tmpshlink = array2oneperline($ctx->{LINK_LIST});
+ $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
$output = "
###################################
-# Start Module $ctx->{MODULE}
-MODULE_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
-MODULE_$ctx->{NAME}_LINK_LIST =$tmplink
-MODULE_$ctx->{NAME}_LINK_FLAGS =$tmpflag
+# Start Library $ctx->{NAME}
+#
+LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
#
-bin/$ctx->{MODULE}: \$(MODULE_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
+LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
+#
+
+# Shared $ctx->{LIBRARY_REALNAME}
+bin/$ctx->{LIBRARY_REALNAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
- \$(MODULE_$ctx->{NAME}_LINK_FLAGS) \\
- \$(MODULE_$ctx->{NAME}_LINK_LIST)
-module_$ctx->{MODULE}: basics bin/$ctx->{MODULE}
-# Module $ctx->{MODULE}
+ \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
+ \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
+# Symlink $ctx->{LIBRARY_SONAME}
+bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
+ \@echo Symlink \$\@
+ \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
+# Symlink $ctx->{_LIBRARY_NAME}
+bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
+ \@echo Symlink \$\@
+ \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
+library_$ctx->{NAME}: basics $ctx->{LIBRARY_SONAME}
+# End Library $ctx->{NAME}
###################################
";
@@ -358,28 +379,9 @@ module_$ctx->{MODULE}: basics bin/$ctx->{MODULE}
}
###########################################################
-# This function creates a object file list for a library
-#
-# $output = _prepare_library_obj_and_lib_list($library_ctx)
-#
-# $library_ctx - the library context
-#
-# $library_ctx->{NAME} - the library binary name
-# $library_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this library
-#
-# $output - the resulting output buffer
-sub _prepare_library_obj_list($)
-{
- my $ctx = shift;
-
- return _prepare_var_obj_list("LIBRARY",$ctx);
-
-}
-
-###########################################################
# This function creates a make rule for linking a library
#
-# $output = _prepare_library_rule($library_ctx)
+# $output = _prepare_static_library_rule($library_ctx)
#
# $library_ctx - the library context
#
@@ -387,20 +389,13 @@ sub _prepare_library_obj_list($)
#
# $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
#
-# $library_ctx->{STATIC_LIBRARY_NAME} - the static library name
-# $library_ctx->{STATIC_LINK_LIST} - the list of objectfiles which sould be linked
+# $library_ctx->{LIBRARY_NAME} - the static library name
+# $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
# to this static library
-# $library_ctx->{STATIC_LINK_FLAGS} - linker flags used by this static library
-#
-# $library_ctx->{SHARED_LIBRARY_NAME} - the shared library name
-# $library_ctx->{SHARED_LIBRARY_REALNAME} - the shared library real name
-# $library_ctx->{SHARED_LIBRARY_SONAME} - the shared library soname
-# $library_ctx->{SHARED_LINK_LIST} - the list of objectfiles and external libraries
-# which sould be linked to this shared library
-# $library_ctx->{SHARED_LINK_FLAGS} - linker flags used by this shared library
+# $library_ctx->{LINK_FLAGS} - linker flags used by this static library
#
# $output - the resulting output buffer
-sub _prepare_library_rule($)
+sub _prepare_static_library_rule($)
{
my $ctx = shift;
my $tmpdepend;
@@ -413,13 +408,10 @@ sub _prepare_library_rule($)
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
- $tmpstlink = array2oneperline($ctx->{STATIC_LINK_LIST});
- $tmpstflag = array2oneperline($ctx->{STATIC_LINK_FLAGS});
+ $tmpstlink = array2oneperline($ctx->{LINK_LIST});
+ $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
- $tmpshlink = array2oneperline($ctx->{SHARED_LINK_LIST});
- $tmpshflag = array2oneperline($ctx->{SHARED_LINK_FLAGS});
-
- $tmprules = "bin/$ctx->{STATIC_LIBRARY_NAME}";
+ $tmprules = "bin/$ctx->{LIBRARY_NAME}";
$output = "
###################################
@@ -430,38 +422,13 @@ LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS =$tmpstflag
#
-LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
-LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
-#
-# Static $ctx->{STATIC_LIBRARY_NAME}
-bin/$ctx->{STATIC_LIBRARY_NAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+# Static $ctx->{LIBRARY_NAME}
+bin/$ctx->{LIBRARY_NAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
\@echo Linking \$\@
\@\$(STLD) \$(STLD_FLAGS) \$\@ \\
\$(LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS) \\
\$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
-";
-
- if (defined($ctx->{SHARED_LIBRARY_NAME})) {
- $output .= "
-# Shared $ctx->{SHARED_LIBRARY_REALNAME}
-bin/$ctx->{SHARED_LIBRARY_REALNAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
- \@echo Linking \$\@
- \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
- \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
- \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
-# Symlink $ctx->{SHARED_LIBRARY_SONAME}
-bin/$ctx->{SHARED_LIBRARY_SONAME}: bin/$ctx->{SHARED_LIBRARY_REALNAME} bin/.dummy
- \@echo Symlink \$\@
- \@ln -sf $ctx->{SHARED_LIBRARY_REALNAME} \$\@
-# Symlink $ctx->{SHARED_LIBRARY_NAME}
-bin/$ctx->{SHARED_LIBRARY_NAME}: bin/$ctx->{SHARED_LIBRARY_SONAME} bin/.dummy
- \@echo Symlink \$\@
- \@ln -sf $ctx->{SHARED_LIBRARY_SONAME} \$\@
-";
- $tmprules .= " bin/$ctx->{SHARED_LIBRARY_NAME}"
- }
- $output .= "
library_$ctx->{NAME}: basics $tmprules
# End Library $ctx->{NAME}
###################################
@@ -470,24 +437,7 @@ library_$ctx->{NAME}: basics $tmprules
return $output;
}
-###########################################################
-# This function creates a object file list for a binary
-#
-# $output = _prepare_binary_obj_and_lib_list($binary_ctx)
-#
-# $binary_ctx - the binary context
-#
-# $binary_ctx->{NAME} - the binary name
-# $binary_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this binary
-#
-# $output - the resulting output buffer
-sub _prepare_binary_obj_list($)
-{
- my $ctx = shift;
- return _prepare_var_obj_list("BINARY",$ctx);
-
-}
###########################################################
# This function creates a make rule for linking a binary
@@ -538,35 +488,6 @@ binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
return $output;
}
-###########################################################
-# This function creates a object file list for make proto
-#
-# $output = _prepare_proto_obj_list($proto_ctx)
-#
-# $proto_ctx - the proto context
-
-# $proto_ctx->{OBJ_LIST} - the list of objectfiles which sould be scanned by make proto
-#
-# $output - the resulting output buffer
-sub _prepare_proto_obj_list($)
-{
- my $ctx = shift;
- my $tmplist;
- my $output;
-
- $tmplist = array2oneperline($ctx->{OBJ_LIST});
-
- $output = "
-###################################
-# Start PROTO OBJ LIST
-PROTO_OBJS =$tmplist
-# End PROTO OBJ LIST
-###################################
-";
-
- return $output;
-}
-
sub _prepare_proto_rules()
{
my $output = "";
@@ -584,7 +505,7 @@ delheaders: pch_clean
include/proto.h:
\@cd \$(srcdir) && \$(SHELL) script/mkproto.sh \"\$(PERL)\" \\
-h _PROTO_H_ \$(builddir)/include/proto.h \\
- \$(PROTO_OBJS)
+ \$(PROTO_PROTO_OBJS)
include/build_env.h:
\@echo Building include/build_env.h
@@ -648,24 +569,11 @@ sub _prepare_obj_lists($)
my $CTX = shift;
my $output = "";
- foreach my $key (sort keys %{$CTX->{OUTPUT}{SUBSYSTEMS}}) {
- $output .= _prepare_subsystem_obj_list(\%{$CTX->{OUTPUT}{SUBSYSTEMS}{$key}});
- }
-
- foreach my $key (sort keys %{$CTX->{OUTPUT}{SHARED_MODULES}}) {
- $output .= _prepare_module_obj_list(\%{$CTX->{OUTPUT}{SHARED_MODULES}{$key}});
- }
-
- foreach my $key (sort keys %{$CTX->{OUTPUT}{LIBRARIES}}) {
- $output .= _prepare_library_obj_list(\%{$CTX->{OUTPUT}{LIBRARIES}{$key}});
+ foreach my $key (values %{$CTX}) {
+ next if not defined($key->{OBJ_LIST});
+ $output .= _prepare_obj_list($key->{TYPE}, $key);
}
- foreach my $key (sort keys %{$CTX->{OUTPUT}{BINARIES}}) {
- $output .= _prepare_binary_obj_list(\%{$CTX->{OUTPUT}{BINARIES}{$key}});
- }
-
- $output .= _prepare_proto_obj_list(\%{$CTX->{OUTPUT}{PROTO}});
-
return $output;
}
@@ -820,19 +728,14 @@ ctags:
sub _prepare_rule_lists($)
{
- my $CTX = shift;
+ my $depend = shift;
my $output = "";
- foreach my $key (sort keys %{$CTX->{OUTPUT}{SHARED_MODULES}}) {
- $output .= _prepare_shared_module_rule(\%{$CTX->{OUTPUT}{SHARED_MODULES}{$key}});
- }
-
- foreach my $key (sort keys %{$CTX->{OUTPUT}{LIBRARIES}}) {
- $output .= _prepare_library_rule(\%{$CTX->{OUTPUT}{LIBRARIES}{$key}});
- }
-
- foreach my $key (sort keys %{$CTX->{OUTPUT}{BINARIES}}) {
- $output .= _prepare_binary_rule(\%{$CTX->{OUTPUT}{BINARIES}{$key}});
+ foreach my $key (values %{$depend}) {
+ next if not defined $key->{OUTPUT_TYPE};
+ ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
+ ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
+ ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
}
my $idl_ctx;
@@ -840,7 +743,7 @@ sub _prepare_rule_lists($)
$output .= _prepare_proto_rules();
- $output .= _prepare_install_rules($CTX);
+ $output .= _prepare_install_rules($depend);
return $output;
}
@@ -886,7 +789,13 @@ sub _prepare_makefile_in($)
$output .= _prepare_rule_lists($CTX);
- $output .= _prepare_make_target(\%{$CTX->{OUTPUT}{TARGETS}{ALL}});
+ my @all = ();
+
+ foreach my $part (values %{$CTX}) {
+ push (@all, $part->{OUTPUT}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
+ }
+
+ $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
return $output;
}
@@ -903,14 +812,9 @@ sub _prepare_makefile_in($)
sub create_makefile_in($)
{
my $CTX = shift;
- my $output;
-
- $output = _prepare_makefile_in($CTX);
open(MAKEFILE_IN,"> Makefile.in") || die ("Can't open Makefile.in\n");
-
- print MAKEFILE_IN $output;
-
+ print MAKEFILE_IN _prepare_makefile_in($CTX);
close(MAKEFILE_IN);
print "config.smb_build.pl: creating Makefile.in\n";
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 85e060ddce..b40c566077 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -3,262 +3,116 @@
### - the output generating functions ###
### ###
### Copyright (C) Stefan (metze) Metzmacher 2004 ###
+### Copyright (C) Jelmer Vernooij 2004 ###
### Released under the GNU GPL ###
###########################################################
package output;
+use Data::Dumper;
use strict;
-sub _generate_ext_libs($)
+sub generate_objlist($)
{
- my $CTX = shift;
+ my $subsys = shift;
- #
- # loop over all binaries
- #
- foreach my $key (sort keys %{$CTX->{DEPEND}{EXT_LIBS}}) {
- my $NAME = $CTX->{INPUT}{EXT_LIBS}{$key}{NAME};
-
- #
- # set the lists
- #
- $CTX->{OUTPUT}{EXT_LIBS}{$key}{NAME} = $NAME;
- @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{LIBS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LIBS}};
- @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{CFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CFLAGS}};
- @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{CPPFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CPPFLAGS}};
- @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{LDFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LDFLAGS}};
- }
-
- return;
+ $subsys->{OUTPUT} = "\$($subsys->{TYPE}_$subsys->{NAME}_OBJS)";
}
-sub _generate_subsystems($)
+sub generate_shared_library($)
{
- my $CTX = shift;
-
- #
- # loop over all subsystems
- #
- foreach my $key (sort keys %{$CTX->{DEPEND}{SUBSYSTEMS}}) {
- my $NAME = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME};
- my @OBJ_LIST = @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}};
-
- if ($CTX->{INPUT}{SUBSYSTEMS}{$key}{NOPROTO} ne "YES") {
- push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(SUBSYSTEM_$key\_OBJS)");
- }
-
- #
- # set the lists
- #
- $CTX->{OUTPUT}{SUBSYSTEMS}{$key}{NAME} = $NAME;
- @{$CTX->{OUTPUT}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST;
- }
-
- return;
+ my $lib = shift;
+
+ @{$lib->{DEPEND_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
+ @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
+ $lib->{LIBRARY_NAME} = $lib->{NAME}.".so";
+ $lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
+ $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_SONAME}.".$lib->{MINOR_VERSION}.$lib->{RELEASE_VERSION}";
+
+ $lib->{OUTPUT} = "bin/$lib->{LIBRARY_SONAME}";
}
-sub _generate_shared_modules($)
+sub generate_static_library($)
{
- my $CTX = shift;
+ my $lib = shift;
- #
- # loop over all shared modules
- #
- foreach my $key (sort keys %{$CTX->{DEPEND}{SHARED_MODULES}}) {
- my $NAME = $CTX->{INPUT}{MODULES}{$key}{NAME};
- my @OBJ_LIST = ();
- #
- my $MODULE = $NAME.".so";
- my @DEPEND_LIST = ("\$(MODULE_$NAME\_OBJS)");
- my @LINK_LIST = ("\$(MODULE_$NAME\_OBJS)");
- my @LINK_FLAGS = ();
+ @{$lib->{DEPEND_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
- push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(MODULE_$key\_OBJS)");
- push(@{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}},"bin/$MODULE");
-
- push(@OBJ_LIST,@{$CTX->{INPUT}{MODULES}{$key}{INIT_OBJ_FILES}});
- push(@OBJ_LIST,@{$CTX->{INPUT}{MODULES}{$key}{ADD_OBJ_FILES}});
-
- foreach my $elem (@{$CTX->{DEPEND}{SHARED_MODULES}{$key}{SUBSYSTEMS_LIST}}) {
- if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) {
- die("Shared Module[$NAME] depends on unknown Subsystem[$elem]!\n");
- }
- push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- }
+ $lib->{LIBRARY_NAME} = $lib->{NAME}.".a";
+ @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
+ @{$lib->{LINK_FLAGS}} = ();
- foreach my $elem (@{$CTX->{DEPEND}{SHARED_MODULES}{$key}{LIBRARIES_LIST}}) {
- if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
- die("Share Module[$NAME] depends on unknown External Library[$elem]!\n");
- }
- push(@LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}});
- push(@LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}});
- }
-
- #
- # set the lists
- #
- $CTX->{OUTPUT}{SHARED_MODULES}{$key}{NAME} = $NAME;
- @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{OBJ_LIST}} = @OBJ_LIST;
- #
- $CTX->{OUTPUT}{SHARED_MODULES}{$key}{MODULE} = $MODULE;
- @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{DEPEND_LIST}} = @DEPEND_LIST;
- @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{LINK_LIST}} = @LINK_LIST;
- @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{LINK_FLAGS}} = @LINK_FLAGS;
- }
-
- return;
+ $lib->{OUTPUT} = $lib->{LIBRARY_NAME};
}
-sub _generate_libraries($)
+sub generate_binary($)
{
- my $CTX = shift;
-
- #
- # loop over all binaries
- #
- foreach my $key (sort keys %{$CTX->{DEPEND}{LIBRARIES}}) {
- my $NAME = $CTX->{INPUT}{LIBRARIES}{$key}{NAME};
- my @OBJ_LIST = @{$CTX->{INPUT}{LIBRARIES}{$key}{OBJ_FILES}};
- my $MAJOR_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{MAJOR_VERSION};
- my $MINOR_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{MINOR_VERSION};
- my $RELEASE_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{RELEASE_VERSION};
- #
- my @DEPEND_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
-
- my $STATIC_LIBRARY_NAME = $NAME.".a";
- my @STATIC_LINK_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
- my @STATIC_LINK_FLAGS = ();
-
- my $SHARED_LIBRARY_NAME = $NAME.".so";
- my $SHARED_LIBRARY_SONAME = $SHARED_LIBRARY_NAME.".$MAJOR_VERSION";
- my $SHARED_LIBRARY_REALNAME = $SHARED_LIBRARY_SONAME.".$MINOR_VERSION.$RELEASE_VERSION";
- my @SHARED_LINK_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
- my @SHARED_LINK_FLAGS = ("\@SONAMEFLAG\@$SHARED_LIBRARY_SONAME");
-
- push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(LIBRARY_$key\_OBJS)");
-
- #
- # not add to 'make all' for now
- #
-
- foreach my $elem (@{$CTX->{DEPEND}{LIBRARIES}{$key}{SUBSYSTEMS_LIST}}) {
- if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) {
- die("Library[$NAME] depends on unknown Subsystem[$elem]!\n");
- }
- push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- push(@STATIC_LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- push(@SHARED_LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- }
-
- foreach my $elem (@{$CTX->{DEPEND}{LIBRARIES}{$key}{LIBRARIES_LIST}}) {
- if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
- die("Library[$NAME] depends on unknown External Library[$elem]!\n");
- }
- push(@SHARED_LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}});
- push(@SHARED_LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}});
- }
-
- #
- # set the lists
- #
- $CTX->{OUTPUT}{LIBRARIES}{$key}{NAME} = $NAME;
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{OBJ_LIST}} = @OBJ_LIST;
- #
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{DEPEND_LIST}} = @DEPEND_LIST;
-
- $CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LIBRARY_NAME} = $STATIC_LIBRARY_NAME;
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LINK_LIST}} = @STATIC_LINK_LIST;
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LINK_FLAGS}} = @STATIC_LINK_FLAGS;
+ my $bin = shift;
- $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_NAME} = $SHARED_LIBRARY_NAME;
- $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_REALNAME} = $SHARED_LIBRARY_REALNAME;
- $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_SONAME} = $SHARED_LIBRARY_SONAME;
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LINK_LIST}} = @SHARED_LINK_LIST;
- @{$CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LINK_FLAGS}} = @SHARED_LINK_FLAGS;
- }
+ @{$bin->{DEPEND_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJS)");
+ @{$bin->{LINK_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJS)");
+ @{$bin->{LINK_FLAGS}} = ();
- return;
+ $bin->{OUTPUT} = "bin/$bin->{NAME}";
+ $bin->{BINARY} = $bin->{NAME};
}
-sub _generate_binaries($)
+sub create_output($)
{
- my $CTX = shift;
-
- #
- # loop over all binaries
- #
- foreach my $key (sort keys %{$CTX->{DEPEND}{BINARIES}}) {
- my $NAME = $CTX->{INPUT}{BINARIES}{$key}{NAME};
- my @OBJ_LIST = @{$CTX->{INPUT}{BINARIES}{$key}{OBJ_FILES}};
- #
- my $BINARY = $NAME;
- my @DEPEND_LIST = ("\$(BINARY_$NAME\_OBJS)");
- my @LINK_LIST = ("\$(BINARY_$NAME\_OBJS)");
- my @LINK_FLAGS = ();
-
- push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(BINARY_$key\_OBJS)");
- push(@{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}},"bin/$BINARY");
-
- foreach my $elem (@{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}}) {
- if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) {
- die("Binary[$NAME] depends on unknown Subsystem[$elem]!\n");
- }
- push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
- }
+ my $depend = shift;
+ my %output = ();
+ my $part;
+
+ $depend->{PROTO}{OUTPUT_TYPE} = "OBJLIST";
+ $depend->{PROTO}{TYPE} = "PROTO";
+ $depend->{PROTO}{NAME} = "PROTO";
+
+ foreach $part (values %{$depend}) {
+ next if not defined($part->{OUTPUT_TYPE});
+
+ generate_binary($part) if $part->{OUTPUT_TYPE} eq "BINARY";
+ generate_objlist($part) if $part->{OUTPUT_TYPE} eq "OBJLIST";
+ generate_shared_library($part) if $part->{TYPE} eq "SHARED_LIBRARY";
+ generate_static_library($part) if $part->{TYPE} eq "STATIC_LIBRARY";
+
+ # Combine object lists
+ push(@{$part->{OBJ_LIST}}, @{$part->{INIT_OBJ_FILES}}) if defined($part->{INIT_OBJ_FILES});
+ push(@{$part->{OBJ_LIST}}, @{$part->{ADD_OBJ_FILES}}) if defined($part->{ADD_OBJ_FILES});
+ push(@{$part->{OBJ_LIST}}, @{$part->{OBJ_FILES}}) if defined($part->{OBJ_FILES});
+
+ push(@{$depend->{PROTO}{OBJ_LIST}}, @{$part->{OBJ_LIST}}) if ((not defined ($part->{NOPROTO}) or $part->{NOPROTO} eq "NO") and defined(@{$part->{OBJ_LIST}}));
+ }
- foreach my $elem (@{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}}) {
- if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
- die("Binary[$NAME] depends on unknown External Library[$elem]!\n");
- }
- push(@LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}});
- push(@LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}});
+ foreach $part (values %{$depend}) {
+ next if not defined($part->{OUTPUT_TYPE});
+
+ # Always import the CFLAGS and CPPFLAGS of the unique dependencies
+ foreach my $elem (values %{$part->{UNIQUE_DEPENDENCIES}}) {
+ next if $elem == $part;
+
+ push(@{$part->{CPPFLAGS}}, @{$elem->{CPPFLAGS}}) if defined(@{$elem->{CPPFLAGS}});
+ push(@{$part->{CFLAGS}}, @{$elem->{CFLAGS}}) if defined(@{$elem->{CFLAGS}});
+ push(@{$part->{DEPEND_LIST}}, $elem->{OUTPUT}) if defined($elem->{OUTPUT});
+ push(@{$part->{LINK_LIST}}, $elem->{OUTPUT}) if defined($elem->{OUTPUT});
+ push(@{$part->{LINK_LIST}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
+ push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
+
+ push(@{$part->{MODULE_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
+ $elem->{TYPE} eq "MODULE" and
+ defined($elem->{INIT_FUNCTION}) and
+ $elem->{INIT_FUNCTION} ne "" and
+ $elem->{SUBSYSTEM} eq $part->{NAME};
+
+ push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
+ $part->{OUTPUT_TYPE} eq "BINARY" and
+ $elem->{TYPE} eq "SUBSYSTEM" and
+ defined($elem->{INIT_FUNCTION}) and
+ $elem->{INIT_FUNCTION} ne "";
}
-
- #
- # set the lists
- #
- $CTX->{OUTPUT}{BINARIES}{$key}{NAME} = $NAME;
- @{$CTX->{OUTPUT}{BINARIES}{$key}{OBJ_LIST}} = @OBJ_LIST;
- #
- $CTX->{OUTPUT}{BINARIES}{$key}{BINARY} = $BINARY;
- @{$CTX->{OUTPUT}{BINARIES}{$key}{DEPEND_LIST}} = @DEPEND_LIST;
- @{$CTX->{OUTPUT}{BINARIES}{$key}{LINK_LIST}} = @LINK_LIST;
- @{$CTX->{OUTPUT}{BINARIES}{$key}{LINK_FLAGS}} = @LINK_FLAGS;
}
- return;
-}
-
-###########################################################
-# This function generates the output
-#
-# create_output($SMB_BUILD_CTX)
-#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
-sub create_output($)
-{
- my $CTX = shift;
-
- $CTX->{OUTPUT}{PROTO} = ();
- @{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}} = ();
-
- $CTX->{OUTPUT}{TARGETS}{ALL} = ();
- $CTX->{OUTPUT}{TARGETS}{ALL}{TARGET} = "all";
- @{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}} = ();
-
- _generate_ext_libs($CTX);
-
- _generate_subsystems($CTX);
-
- _generate_shared_modules($CTX);
-
- _generate_libraries($CTX);
-
- _generate_binaries($CTX);
+ print Data::Dumper::Dumper($depend);
- return;
+ return %{$depend};
}
1;
diff --git a/source4/build/smb_build/public.m4 b/source4/build/smb_build/public.m4
index 5ac560f019..add6d18f36 100644
--- a/source4/build/smb_build/public.m4
+++ b/source4/build/smb_build/public.m4
@@ -216,7 +216,7 @@ SMB_INFO_MODULES="$SMB_INFO_MODULES
###################################
# Start MODULE $1
-\$INPUT{MODULES}{$1} = {
+\$INPUT{$1} = {
TYPE => "MODULE",
NAME => \"$1\",
SUBSYSTEM => \"$2\",
@@ -258,7 +258,8 @@ AC_DEFUN([SMB_MODULE_MK],
SMB_INFO_MODULES="$SMB_INFO_MODULES
###################################
# Start MODULE $1
-\$INPUT{MODULES}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"MODULE\",
NAME => \"$1\",
SUBSYSTEM => \"$2\",
DEFAULT_BUILD => \"$[SMB_MODULE_DEFAULT_][$1]\",
@@ -312,7 +313,8 @@ AC_DEFUN([SMB_SUBSYSTEM],
SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
###################################
# Start Subsystem $1
-\$INPUT{SUBSYSTEMS}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"SUBSYSTEM\",
NAME => \"$1\",
INIT_OBJ_FILES => ][STR2ARRAY([$2])][,
ADD_OBJ_FILES => ][STR2ARRAY([$3])][,
@@ -344,7 +346,8 @@ AC_DEFUN([SMB_SUBSYSTEM_MK],
SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
###################################
# Start Subsystem $1
-\$INPUT{SUBSYSTEMS}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"SUBSYSTEM\",
NAME => \"$1\",
INIT_OBJ_FILES => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"INIT_OBJ_FILES\") @:>@,
ADD_OBJ_FILES => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"ADD_OBJ_FILES\") @:>@,
@@ -433,8 +436,9 @@ AC_DEFUN([SMB_EXT_LIB],
SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
###################################
# Start Ext Lib $1
-\$INPUT{EXT_LIBS}{$1} = {
- NAME => \"$1\",
+\$INPUT{EXT_LIB_$1} = {
+ TYPE => \"EXT_LIB\",
+ NAME => \"EXT_LIB_$1\",
LIBS => ][STR2ARRAY([$2])][,
CFLAGS => ][STR2ARRAY([$3])][,
CPPFLAGS => ][STR2ARRAY([$4])][,
@@ -475,7 +479,8 @@ AC_DEFUN([SMB_LIBRARY],
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
-\$INPUT{LIBRARIES}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"LIBRARY\",
NAME => \"$1\",
MAJOR_VERSION => \"$2\",
MINOR_VERSION => \"$3\",
@@ -504,7 +509,8 @@ AC_DEFUN([SMB_LIBRARY_MK],
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
-\$INPUT{LIBRARIES}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"LIBRARY\",
NAME => \"$1\",
MAJOR_VERSION => config_mk::library_get_var(\"$2\", \"$1\", \"MAJOR_VERSION\"),
MINOR_VERSION => config_mk::library_get_var(\"$2\", \"$1\", \"MINOR_VERSION\"),
@@ -546,7 +552,8 @@ AC_DEFUN([SMB_BINARY],
SMB_INFO_BINARIES="$SMB_INFO_BINARIES
###################################
# Start Binary $1
-\$INPUT{BINARIES}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"BINARY\",
NAME => \"$1\",
BUILD_TARGETS => ][STR2ARRAY([$2])][,
INSTALL_PATH => ][STR2ARRAY([$3])][,
@@ -574,7 +581,8 @@ AC_DEFUN([SMB_BINARY_MK],
SMB_INFO_BINARIES="$SMB_INFO_BINARIES
###################################
# Start Binary $1
-\$INPUT{BINARIES}{$1} = {
+\$INPUT{$1} = {
+ TYPE => \"BINARY\",
NAME => \"$1\",
BUILD_TARGETS => @<:@ config_mk::binary_get_array(\"$2\", \"$1\", \"BUILD_TARGETS\") @:>@,
INSTALL_PATH => @<:@ config_mk::binary_get_array(\"$2\", \"$1\", \"INSTALL_PATH\") @:>@,
diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm
index 8dd0635b10..0f1411dde1 100644
--- a/source4/build/smb_build/smb_build_h.pm
+++ b/source4/build/smb_build/smb_build_h.pm
@@ -24,14 +24,16 @@ sub _add_define_section($)
sub _prepare_smb_build_h($)
{
- my $CTX = shift;
- my $output = "";
+ my $depend = shift;
+ my @defines = ();
#
# loop over all subsystems
#
- foreach my $key (sort keys %{$CTX->{DEPEND}{SUBSYSTEMS}}) {
- my $NAME = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME};
+ foreach my $key (values %{$depend}) {
+ next if $key->{TYPE} ne "SUBSYSTEM";
+
+ my $NAME = $key->{NAME};
my $DEFINE = ();
my $name = lc($NAME);
@@ -41,23 +43,25 @@ sub _prepare_smb_build_h($)
$DEFINE->{COMMENT} = "SUBSYSTEM $NAME INIT";
$DEFINE->{KEY} = $name . "_init_static_modules";
$DEFINE->{VAL} = "do { \\\n";
- foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}}) {
+ foreach my $subkey (@{$key->{MODULE_INIT_FUNCTIONS}}) {
$DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n";
}
- foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}}) {
+ foreach my $subkey (@{$key->{MODULE_INIT_FUNCTIONS}}) {
$DEFINE->{VAL} .= "\t\t$subkey(); \\\n";
}
$DEFINE->{VAL} .= "\t} while(0)";
- push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE);
+ push(@defines,$DEFINE);
}
#
# loop over all binaries
#
- foreach my $key (sort keys %{$CTX->{DEPEND}{BINARIES}}) {
- my $NAME = $CTX->{INPUT}{BINARIES}{$key}{NAME};
+ foreach my $key (values %{$depend}) {
+ next if ($key->{TYPE} ne "BINARY");
+
+ my $NAME = $key->{NAME};
my $DEFINE = ();
my $name = lc($NAME);
@@ -67,22 +71,28 @@ sub _prepare_smb_build_h($)
$DEFINE->{COMMENT} = "BINARY $NAME INIT";
$DEFINE->{KEY} = $name . "_init_subsystems";
$DEFINE->{VAL} = "do { \\\n";
- foreach my $subkey (@{$CTX->{DEPEND}{BINARIES}{$key}{INIT_FUNCTIONS}}) {
+ foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
+ $DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n";
+ }
+
+ foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
$DEFINE->{VAL} .= "\t\tif (NT_STATUS_IS_ERR($subkey())) exit(1); \\\n";
}
$DEFINE->{VAL} .= "\t} while(0)";
- push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE);
+ push(@defines,$DEFINE);
}
#
# Shared modules
#
- foreach my $key (sort keys %{$CTX->{INPUT}{MODULES}}) {
- next if ($CTX->{INPUT}{MODULES}{$key}{BUILD} ne "SHARED");
+ foreach my $key (values %{$depend}) {
+ next if $key->{TYPE} ne "MODULE";
+ next if $key->{ENABLE} ne "YES";
+ next if $key->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
- my $name = $CTX->{INPUT}{MODULES}{$key}{NAME};
- my $func = $CTX->{INPUT}{MODULES}{$key}{INIT_FUNCTION};
+ my $name = $key->{NAME};
+ my $func = $key->{INIT_FUNCTION};
next if $func eq "";
my $DEFINE = ();
@@ -91,13 +101,14 @@ sub _prepare_smb_build_h($)
$DEFINE->{KEY} = $func;
$DEFINE->{VAL} = "init_module";
- push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE);
+ push(@defines,$DEFINE);
}
#
# loop over all SMB_BUILD_H define sections
#
- foreach my $key (@{$CTX->{OUTPUT}{SMB_BUILD_H}}) {
+ my $output = "";
+ foreach my $key (@defines) {
$output .= _add_define_section($key);
}
@@ -120,17 +131,13 @@ sub create_smb_build_h($)
$output .= _prepare_smb_build_h($CTX);
- #
- # TODO: check if directory include/ exists
- #
-
- open(SMB_BUILD_H,"> include/smb_build.h") || die ("Can't open include/smb_build.h\n");
+ open(SMB_BUILD_H,"> $input::srcdir/include/smb_build.h") || die ("Can't open include/smb_build.h\n");
print SMB_BUILD_H $output;
close(SMB_BUILD_H);
- print "config.smb_build.pl: creating include/smb_build.h\n";
+ print "config.smb_build.pl: creating $input::srcdir/include/smb_build.h\n";
return;
}
1;
diff --git a/source4/gtk/config.mk b/source4/gtk/config.mk
index 6975b79182..22dd839716 100644
--- a/source4/gtk/config.mk
+++ b/source4/gtk/config.mk
@@ -5,8 +5,7 @@
[SUBSYSTEM::GTKSMB]
INIT_OBJ_FILES = gtk/common/gtk-smb.o
ADD_OBJ_FILES = gtk/common/select.o
-REQUIRED_LIBRARIES = gtk
-REQUIRED_SUBSYSTEMS = CHARSET LIBBASIC
+REQUIRED_SUBSYSTEMS = CHARSET LIBBASIC EXT_LIB_gtk
# End SUBSYSTEM GTKSMB
##############################
diff --git a/source4/lib/cmdline/config.m4 b/source4/lib/cmdline/config.m4
index 8316dff10f..a8b50c786f 100644
--- a/source4/lib/cmdline/config.m4
+++ b/source4/lib/cmdline/config.m4
@@ -72,10 +72,9 @@ AC_CHECK_LIB(readline, rl_completion_matches,
TMP_LIBCMDLINE_OBJS="lib/cmdline/readline.o lib/cmdline/popt_common.o"
TMP_LIBCMDLINE_LIBS="$TERMLIBS"
-#hack...
-LIBS="$LIBS $TERMLIBS"
+SMB_EXT_LIB(READLINE, [$TERMLIBS])
SMB_SUBSYSTEM(LIBCMDLINE,[],
[${TMP_LIBCMDLINE_OBJS}],
- [ALLLIBS],
- [LIBPOPT])
+ [],
+ [LIBPOPT EXT_LIB_READLINE])
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index 639652ea55..10b8c76f97 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -3,8 +3,8 @@
[MODULE::libldb_ldap]
INIT_OBJ_FILES = \
lib/ldb/ldb_ldap/ldb_ldap.o
-REQUIRED_LIBRARIES = \
- LDAP
+REQUIRED_SUBSYSTEMS = \
+ EXT_LIB_LDAP
# End MODULE libldb_tdb
################################################
diff --git a/source4/lib/popt/config.m4 b/source4/lib/popt/config.m4
index 5af1d08d20..ff4455efa2 100644
--- a/source4/lib/popt/config.m4
+++ b/source4/lib/popt/config.m4
@@ -33,9 +33,8 @@ else
AC_MSG_RESULT(no)
fi
-#hack
-LIBS="$LIBS ${TMP_LIBPOPT_LIBS}"
+SMB_EXT_LIB(POPT, [${TMP_LIBPOPT_LIBS}])
SMB_SUBSYSTEM(LIBPOPT,[],
[${TMP_LIBPOPT_OBJS}],
- [])
+ [EXT_LIB_POPT])
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index dacd6d5295..bebd8bf1d7 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -44,8 +44,7 @@ REQUIRED_SUBSYSTEMS = \
INIT_FUNCTION = registry_gconf_init
INIT_OBJ_FILES = \
lib/registry/reg_backend_gconf/reg_backend_gconf.o
-REQUIRED_LIBRARIES = \
- gconf
+REQUIRED_SUBSYSTEMS = EXT_LIB_gconf
# End MODULE registry_gconf
################################################
diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk
index 6339b91761..1801e30e0a 100644
--- a/source4/lib/tdb/config.mk
+++ b/source4/lib/tdb/config.mk
@@ -30,8 +30,7 @@ REQUIRED_SUBSYSTEMS = \
OBJ_FILES= \
lib/tdb/tools/tdbtest.o
REQUIRED_SUBSYSTEMS = \
- LIBTDB
-REQUIRED_LIBRARIES = GDBM
+ LIBTDB EXT_LIB_GDBM
# End BINARY tdbtest
################################################
diff --git a/source4/libcli/auth/gensec.mk b/source4/libcli/auth/gensec.mk
index 1372a91ea2..ac778ad5c8 100644
--- a/source4/libcli/auth/gensec.mk
+++ b/source4/libcli/auth/gensec.mk
@@ -18,8 +18,7 @@ ADD_OBJ_FILES = \
libcli/auth/kerberos.o \
libcli/auth/kerberos_verify.o \
libcli/auth/gssapi_parse.o
-REQUIRED_SUBSYSTEMS = GENSEC
-REQUIRED_LIBRARIES = KRB5
+REQUIRED_SUBSYSTEMS = GENSEC EXT_LIB_KRB5
# End MODULE gensec_krb5
################################################
diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk
index d4329e2014..d4a9b69f4a 100644
--- a/source4/smbd/process_model.mk
+++ b/source4/smbd/process_model.mk
@@ -24,8 +24,7 @@ INIT_OBJ_FILES = \
INIT_FUNCTION = process_model_thread_init
INIT_OBJ_FILES = \
smbd/process_thread.o
-REQUIRED_LIBRARIES = \
- PTHREAD
+REQUIRED_SUBSYSTEMS = EXT_LIB_PTHREAD
# End MODULE process_model_thread
################################################