summaryrefslogtreecommitdiff
path: root/source4/build/smb_build/output.pl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-05-13 10:20:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:36 -0500
commitf236700ef67d4f93ec56ec7808584552e94e0dfe (patch)
tree3572ba5a82860e9dc60661161997b77704867cdc /source4/build/smb_build/output.pl
parentb2d1f7890765fca5a119d43f4906e885c245005f (diff)
downloadsamba-f236700ef67d4f93ec56ec7808584552e94e0dfe.tar.gz
samba-f236700ef67d4f93ec56ec7808584552e94e0dfe.tar.bz2
samba-f236700ef67d4f93ec56ec7808584552e94e0dfe.zip
r665: merge over the new build system from my tmp branch
to the main SAMBA_4_0 tree. NOTE: that it's not completely ready, but it's functional:-) metze (This used to be commit c78a2ddb28ec50d6570a83b1f66f18a5c3621731)
Diffstat (limited to 'source4/build/smb_build/output.pl')
-rw-r--r--source4/build/smb_build/output.pl191
1 files changed, 191 insertions, 0 deletions
diff --git a/source4/build/smb_build/output.pl b/source4/build/smb_build/output.pl
new file mode 100644
index 0000000000..2705cd8e79
--- /dev/null
+++ b/source4/build/smb_build/output.pl
@@ -0,0 +1,191 @@
+###########################################################
+### SMB Build System ###
+### - the output generating functions ###
+### ###
+### Copyright (C) Stefan (metze) Metzmacher 2004 ###
+### Released under the GNU GPL ###
+###########################################################
+
+sub _generate_ext_libs($)
+{
+ my $CTX = 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;
+}
+
+sub _generate_subsystems($)
+{
+ 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}};
+
+ 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;
+}
+
+sub _generate_shared_modules($)
+{
+ my $CTX = 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 = ();
+
+ 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 unkown Subsystem[$elem]!\n");
+ }
+ push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ }
+
+ foreach my $elem (@{$CTX->{DEPEND}{SHARED_MODULES}{$key}{LIBRARIES_LIST}}) {
+ if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
+ die("Share Module[$NAME] depends on unkown 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;
+}
+
+sub _generate_libraries($)
+{
+ return;
+}
+
+sub _generate_binaries($)
+{
+ 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 unkown Subsystem[$elem]!\n");
+ }
+ push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ }
+
+ foreach my $elem (@{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}}) {
+ if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
+ die("Binary[$NAME] depends on unkown 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}{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);
+
+ return;
+}