diff options
Diffstat (limited to 'source4/build/smb_build/cflags.pm')
-rwxr-xr-x | source4/build/smb_build/cflags.pm | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm index 71898a582b..7ce3ba3555 100755 --- a/source4/build/smb_build/cflags.pm +++ b/source4/build/smb_build/cflags.pm @@ -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 @@ sub create_cflags($$) 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 = $_; |