summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-02 19:38:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:59 -0500
commit23926e75c65ff4ca5226be0193c14073552a4344 (patch)
treeab32281848e8b42227a42e252c84565476bd49ef
parent4216c18f34ad29d015e853f4d1cb1900f754ad44 (diff)
downloadsamba-23926e75c65ff4ca5226be0193c14073552a4344.tar.gz
samba-23926e75c65ff4ca5226be0193c14073552a4344.tar.bz2
samba-23926e75c65ff4ca5226be0193c14073552a4344.zip
r8936: Use incremental linking. This appeared to be supported on
all systems on the buildfarm when I tested it using smb_build. It's just a one line change to go back. If this works correctly, we can simplify the build system quite a bit. (This used to be commit 6b671fb34a35def9a8d2fdaa8d9a04ff26c9e929)
-rw-r--r--source4/build/smb_build/input.pm2
-rw-r--r--source4/build/smb_build/makefile.pm27
-rw-r--r--source4/build/smb_build/output.pm23
3 files changed, 45 insertions, 7 deletions
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index fc14c1d2e9..a68d9946da 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -10,7 +10,7 @@
use strict;
package smb_build::input;
-my $subsystem_default_output_type = "OBJLIST";
+my $subsystem_default_output_type = "MERGEDOBJ";
my $srcdir = ".";
sub strtrim($)
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index a5c97a13da..d5dbfa1751 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -85,7 +85,7 @@ sub _prepare_compiler_linker($)
CC=@CC@
CFLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -Ilib @CFLAGS@ @CPPFLAGS@
-LD=@CC@
+LD=@LD@
LD_FLAGS=@LDFLAGS@ @CFLAGS@ -Lbin
STLD=ar
@@ -405,6 +405,27 @@ __EOD__
return $output;
}
+sub _prepare_mergedobj_rule($)
+{
+ my $ctx = shift;
+
+ return "" unless $ctx->{TARGET};
+
+ my $output = "";
+
+ my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
+
+ $output .= "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
+
+ $output .= "$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
+
+ $output .= "\t\@echo \"Linking subsystem $ctx->{NAME}\"\n";
+ $output .= "\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJS) -o $ctx->{TARGET}\n";
+ $output .= "\n";
+
+ return $output;
+}
+
sub _prepare_objlist_rule($)
{
my $ctx = shift;
@@ -506,7 +527,7 @@ BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
#
bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
\@echo Linking \$\@
- \@\$(LD) \$(LD_FLAGS) -o \$\@ \\
+ \@\$(CC) \$(LD_FLAGS) -o \$\@ \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
\$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
@@ -579,6 +600,7 @@ distclean: clean
-rm -f config.status
-rm -f config.log config.cache
-rm -f samba4-deps.dot
+ -rm -f config.pm config.mk
-rm -f lib/registry/winregistry.pc
__EOD__
@@ -795,6 +817,7 @@ sub _prepare_rule_lists($)
foreach my $key (values %{$depend}) {
next unless defined $key->{OUTPUT_TYPE};
+ ($output .= _prepare_mergedobj_rule($key)) if $key->{OUTPUT_TYPE} eq "MERGEDOBJ";
($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
($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";
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index b863d7e8dc..0b7be94dfc 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -10,6 +10,13 @@
package output;
use strict;
+sub generate_mergedobj($)
+{
+ my $subsys = shift;
+
+ $subsys->{OUTPUT} = $subsys->{TARGET} = "bin/$subsys->{TYPE}_$subsys->{NAME}.o";
+}
+
sub generate_objlist($)
{
my $subsys = shift;
@@ -85,15 +92,23 @@ sub create_output($)
next if $part->{NAME} eq "ALL_OBJS";
next if not defined($part->{OUTPUT_TYPE});
+ # 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});
+
+ if ((not defined($part->{OBJ_LIST}) or
+ scalar(@{$part->{OBJ_LIST}}) == 0) and
+ $part->{OUTPUT_TYPE} eq "MERGEDOBJ") {
+ $part->{OUTPUT_TYPE} = "OBJLIST";
+ }
+
generate_binary($part) if $part->{OUTPUT_TYPE} eq "BINARY";
+ generate_mergedobj($part) if $part->{OUTPUT_TYPE} eq "MERGEDOBJ";
generate_objlist($part) if $part->{OUTPUT_TYPE} eq "OBJLIST";
generate_shared_library($part) if $part->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
generate_static_library($part) if $part->{OUTPUT_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->{ALL_OBJS}->{OBJ_LIST}}, @{$part->{OBJ_LIST}}) if (defined(@{$part->{OBJ_LIST}}));