diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/smb_build/main.pl | 3 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 18 | ||||
-rw-r--r-- | source4/build/smb_build/output.pm | 12 |
3 files changed, 32 insertions, 1 deletions
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index a85eab32de..4c09e32422 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -20,7 +20,7 @@ my $INPUT = {}; my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk"); my $subsys_output_type; -$subsys_output_type = ["STATIC_LIBRARY"]; +$subsys_output_type = ["MERGED_OBJ"]; my $library_output_type; if ($config::config{USESHARED} eq "true") { @@ -59,6 +59,7 @@ my $shared_libs_used = 0; foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; + $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}}); $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if (defined($key->{PC_FILE})) { push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}"); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 9c6d52cfef..6ea3b8d950 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -277,6 +277,24 @@ __EOD__ $self->output("\n"); } +sub MergedObj($$) +{ + my ($self, $ctx) = @_; + + $self->_prepare_list($ctx, "OBJ_LIST"); + $self->_prepare_list($ctx, "FULL_OBJ_LIST"); + push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)"); + $self->output(<< "__EOD__" +# +$ctx->{TARGET_MERGED_OBJ}: \$($ctx->{NAME}_FULL_OBJ_LIST) + \@echo Partially linking \$@ + \@mkdir -p bin/mergedobj + \@\$(LD) -r -o \$@ \$($ctx->{NAME}_FULL_OBJ_LIST) + +__EOD__ +); +} + sub StaticLibrary($$) { my ($self,$ctx) = @_; diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 4350370fbf..0ddb9e4efb 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -89,6 +89,17 @@ sub generate_shared_library($) $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY}; } +sub generate_merged_obj($) +{ + my $lib = shift; + + my $link_name = $lib->{NAME}; + $link_name =~ s/^LIB//; + + $lib->{MERGED_OBJNAME} = lc($link_name).".o"; + $lib->{TARGET_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}"; +} + sub generate_static_library($) { my $lib = shift; @@ -153,6 +164,7 @@ sub create_output($$) generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}}); generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}}); generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}}); + generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}}); $part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]}; $part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]}; } |