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

jpeach at samba.org jpeach at samba.org
Mon Apr 2 17:11:37 GMT 2007


Author: jpeach
Date: 2007-04-02 17:11:36 +0000 (Mon, 02 Apr 2007)
New Revision: 22031

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

Log:
Make sure we rewrite the include directives in CFLAGS to contain
paths from builddir and srcdir. builddir has precedence.

Modified:
   branches/SAMBA_4_0/source/build/smb_build/cflags.pm
   branches/SAMBA_4_0/source/build/smb_build/main.pl


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/cflags.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2007-04-02 17:08:21 UTC (rev 22030)
+++ branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2007-04-02 17:11:36 UTC (rev 22031)
@@ -6,9 +6,12 @@
 package cflags;
 use strict;
 
-sub create_cflags($$)
+sub create_cflags($$$$)
 {
-	my ($CTX, $file) = @_;
+	my $CTX = shift;
+	my $srcdir = shift;
+	my $builddir = shift;
+	my $file = shift;
 
 	open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
 
@@ -18,7 +21,18 @@
 		next unless defined ($key->{FINAL_CFLAGS});
 		next unless ($#{$key->{FINAL_CFLAGS}} >= 0);
 
-		my $cflags = join(' ', @{$key->{FINAL_CFLAGS}});
+		# Rewrite CFLAGS so that both the source and the build
+		# directories are in the path.
+		my $cflags = "";
+		foreach my $flag (@{$key->{FINAL_CFLAGS}}) {
+			my $dir;
+			if (($dir) = ($flag =~ /^-I([^\/].*)$/)) {
+				$cflags .= " -I$builddir/$dir";
+				$cflags .= " -I$srcdir/$dir";
+			} else {
+				$cflags .= " $flag";
+			}
+		}
 
 		foreach (@{$key->{OBJ_LIST}}) {
 			my $ofile = $_;

Modified: branches/SAMBA_4_0/source/build/smb_build/main.pl
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/main.pl	2007-04-02 17:08:21 UTC (rev 22030)
+++ branches/SAMBA_4_0/source/build/smb_build/main.pl	2007-04-02 17:11:36 UTC (rev 22031)
@@ -71,8 +71,10 @@
 $mkenv->write("Makefile");
 header::create_smb_build_h($OUTPUT, "include/build.h");
 
-cflags::create_cflags($OUTPUT, "extra_cflags.txt");
+cflags::create_cflags($OUTPUT, $config::config{srcdir},
+		    $config::config{builddir}, "extra_cflags.txt");
 
+
 summary::show($OUTPUT, \%config::config);
 
 1;



More information about the samba-cvs mailing list