svn commit: samba r18222 - in branches/SAMBA_4_0/source/build/smb_build: .

metze at samba.org metze at samba.org
Thu Sep 7 14:00:40 GMT 2006


Author: metze
Date: 2006-09-07 14:00:40 +0000 (Thu, 07 Sep 2006)
New Revision: 18222

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18222

Log:
filter out double entries from CFLAGS

metze
Modified:
   branches/SAMBA_4_0/source/build/smb_build/cflags.pm
   branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
   branches/SAMBA_4_0/source/build/smb_build/input.pm
   branches/SAMBA_4_0/source/build/smb_build/output.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/cflags.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-09-07 13:11:47 UTC (rev 18221)
+++ branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-09-07 14:00:40 UTC (rev 18222)
@@ -14,15 +14,18 @@
 
 	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);

Modified: branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-09-07 13:11:47 UTC (rev 18221)
+++ branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-09-07 14:00:40 UTC (rev 18222)
@@ -15,7 +15,7 @@
 my $section_types = {
 	"EXT_LIB" => {
 		"LIBS"			=> "list",
-		"CFLAGS"		=> "string",
+		"CFLAGS"		=> "list",
 		"CPPFLAGS"		=> "list",
 		"LDFLAGS"		=> "list",
 		},
@@ -34,7 +34,7 @@
 
 		"PUBLIC_HEADERS"	=> "list",
 
-		"CFLAGS"		=> "string",
+		"CFLAGS"		=> "list",
 		"LDFLAGS"		=> "list",
 		"STANDARD_VISIBILITY"	=> "string"
 		},
@@ -60,7 +60,7 @@
 
 		"PUBLIC_HEADERS"	=> "list",
 
-		"CFLAGS"		=> "string"
+		"CFLAGS"		=> "list"
 		},
 	"BINARY" => {
 		"OBJ_FILES"		=> "list",
@@ -75,7 +75,7 @@
 		"PUBLIC_PROTO_HEADER"	=> "string",
 		"PUBLIC_HEADERS"	=> "list", 
 
-		"CFLAGS"		=> "string",
+		"CFLAGS"		=> "list",
 		"STANDARD_VISIBILITY"	=> "string",
 
 		"USE_HOSTCC"		=> "bool"
@@ -103,7 +103,7 @@
 		"PUBLIC_PROTO_HEADER"	=> "string",
 		"PRIVATE_PROTO_HEADER"	=> "string",
 
-		"CFLAGS"		=> "string",
+		"CFLAGS"		=> "list",
 		"LDFLAGS"		=> "list",
 		"STANDARD_VISIBILITY"	=> "string"
 		}

Modified: branches/SAMBA_4_0/source/build/smb_build/input.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-09-07 13:11:47 UTC (rev 18221)
+++ branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-09-07 14:00:40 UTC (rev 18222)
@@ -198,10 +198,6 @@
 			}
 		}
 
-		unless (defined($part->{CFLAGS})) {
-			$part->{CFLAGS} = "";
-		}
-
 		unless (defined($part->{PUBLIC_HEADERS})) {
 			$part->{PUBLIC_HEADERS} = [];
 		}

Modified: branches/SAMBA_4_0/source/build/smb_build/output.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-09-07 13:11:47 UTC (rev 18221)
+++ branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-09-07 14:00:40 UTC (rev 18222)
@@ -107,7 +107,22 @@
 	$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($$)
 {
 	my ($depend, $config) = @_;
@@ -128,21 +143,18 @@
 	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 @@
 	}
 
 	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;
 }
 



More information about the samba-cvs mailing list