diff options
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/build/smb_build/cflags.pm | 9 | ||||
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 10 | ||||
-rw-r--r-- | source4/build/smb_build/input.pm | 4 | ||||
-rw-r--r-- | source4/build/smb_build/output.pm | 35 |
4 files changed, 33 insertions, 25 deletions
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm index 6dfe4fe94e..71898a582b 100755 --- a/source4/build/smb_build/cflags.pm +++ b/source4/build/smb_build/cflags.pm @@ -14,15 +14,18 @@ sub create_cflags($$) foreach my $key (values %{$CTX}) { next unless defined ($key->{OBJ_LIST}); - next unless defined ($key->{CFLAGS}); - next if ($key->{CFLAGS} eq ""); + + next unless defined ($key->{FINAL_CFLAGS}); + next unless ($#{$key->{FINAL_CFLAGS}} >= 0); + + my $cflags = join(' ', @{$key->{FINAL_CFLAGS}}); foreach (@{$key->{OBJ_LIST}}) { my $ofile = $_; my $dfile = $_; $dfile =~ s/\.o$/.d/; $dfile =~ s/\.ho$/.d/; - print CFLAGS_TXT "$ofile $dfile: CFLAGS+=$key->{CFLAGS}\n"; + print CFLAGS_TXT "$ofile $dfile: CFLAGS+= $cflags\n"; } } close(CFLAGS_TXT); diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 65f873f500..4b2a3ff8c7 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -15,7 +15,7 @@ use strict; my $section_types = { "EXT_LIB" => { "LIBS" => "list", - "CFLAGS" => "string", + "CFLAGS" => "list", "CPPFLAGS" => "list", "LDFLAGS" => "list", }, @@ -34,7 +34,7 @@ my $section_types = { "PUBLIC_HEADERS" => "list", - "CFLAGS" => "string", + "CFLAGS" => "list", "LDFLAGS" => "list", "STANDARD_VISIBILITY" => "string" }, @@ -60,7 +60,7 @@ my $section_types = { "PUBLIC_HEADERS" => "list", - "CFLAGS" => "string" + "CFLAGS" => "list" }, "BINARY" => { "OBJ_FILES" => "list", @@ -75,7 +75,7 @@ my $section_types = { "PUBLIC_PROTO_HEADER" => "string", "PUBLIC_HEADERS" => "list", - "CFLAGS" => "string", + "CFLAGS" => "list", "STANDARD_VISIBILITY" => "string", "USE_HOSTCC" => "bool" @@ -103,7 +103,7 @@ my $section_types = { "PUBLIC_PROTO_HEADER" => "string", "PRIVATE_PROTO_HEADER" => "string", - "CFLAGS" => "string", + "CFLAGS" => "list", "LDFLAGS" => "list", "STANDARD_VISIBILITY" => "string" } diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 227b47c0c7..23f25a5854 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -198,10 +198,6 @@ sub check($$$$$) } } - unless (defined($part->{CFLAGS})) { - $part->{CFLAGS} = ""; - } - unless (defined($part->{PUBLIC_HEADERS})) { $part->{PUBLIC_HEADERS} = []; } diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 92531835fa..9196f20636 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -107,6 +107,21 @@ sub generate_binary($) $bin->{BINARY} = $bin->{NAME}; } +sub merge_array($$) +{ + # $dest is a reference to an array + # $src is an array + my ($dest, $src) = @_; + + return unless defined($src); + return unless ($#{$src} >= 0); + + foreach my $line (@{$src}) { + next if (grep /^$line$/, @{$$dest}); + push(@{$$dest}, $line); + } +} + sub create_output($$) { @@ -128,21 +143,18 @@ sub create_output($$) foreach $part (values %{$depend}) { next if not defined($part->{OUTPUT_TYPE}); + merge_array(\$part->{FINAL_CFLAGS}, $part->{CPPFLAGS}); + merge_array(\$part->{FINAL_CFLAGS}, $part->{CFLAGS}); + foreach (@{$part->{UNIQUE_DEPENDENCIES_ALL}}) { my $elem = $depend->{$_}; next if $elem == $part; - push(@{$part->{PUBLIC_CFLAGS}}, @{$elem->{CPPFLAGS}}) if (defined(@{$elem->{CPPFLAGS}})) - and ($#{$elem->{CPPFLAGS}} >= 0); - - next if not defined($elem->{CFLAGS}); - next if $elem->{CFLAGS} eq ""; - next if (grep /^$elem->{CFLAGS}$/, @{$part->{PUBLIC_CFLAGS}}); - push(@{$part->{PUBLIC_CFLAGS}}, $elem->{CFLAGS}); + merge_array(\$part->{FINAL_CFLAGS}, $elem->{CPPFLAGS}); + merge_array(\$part->{FINAL_CFLAGS}, $elem->{CFLAGS}); } - - # Always import the CFLAGS and CPPFLAGS of the unique dependencies + # Always import the link options of the unique dependencies foreach (@{$part->{UNIQUE_DEPENDENCIES}}) { my $elem = $depend->{$_}; next if $elem == $part; @@ -155,15 +167,12 @@ sub create_output($$) } foreach $part (values %{$depend}) { - $part->{CFLAGS} .= " " . join(' ', @{$part->{PUBLIC_CFLAGS}}) if defined($part->{PUBLIC_CFLAGS}); - $part->{CFLAGS} .= " " . join(' ', @{$part->{CPPFLAGS}}) if defined($part->{CPPFLAGS}); if (($part->{STANDARD_VISIBILITY} ne "default") and ($config->{visibility_attribute} eq "yes")) { - $part->{CFLAGS} .= " -fvisibility=$part->{STANDARD_VISIBILITY}"; + push(@{$part->{FINAL_CFLAGS}}, "-fvisibility=$part->{STANDARD_VISIBILITY}"); } } - return $depend; } |