summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-11 19:10:21 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-11 19:10:21 +0100
commit6c7a4009458b4b005b3c5f19dc284f0fcc459bcc (patch)
tree3a84992c18f27f141196ec6fcb50afc119a407d9 /source4
parent5aa0a70b06317b7ae77385210fe41bbc2d3c6c5c (diff)
downloadsamba-6c7a4009458b4b005b3c5f19dc284f0fcc459bcc.tar.gz
samba-6c7a4009458b4b005b3c5f19dc284f0fcc459bcc.tar.bz2
samba-6c7a4009458b4b005b3c5f19dc284f0fcc459bcc.zip
Support including files in the cflags.pl script.
(This used to be commit 742e50aeb54d779d383cbf73132224bad3b09777)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/build/smb_build/cflags.pm2
-rwxr-xr-xsource4/script/cflags.pl31
2 files changed, 23 insertions, 10 deletions
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm
index ad6cd42c65..a4ab90a8cd 100755
--- a/source4/build/smb_build/cflags.pm
+++ b/source4/build/smb_build/cflags.pm
@@ -23,6 +23,8 @@ sub create_cflags($$$$) {
open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
+ print CFLAGS_TXT "include mkconfig.mk\n";
+
my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0;
foreach my $key (values %{$CTX}) {
diff --git a/source4/script/cflags.pl b/source4/script/cflags.pl
index 7f435d46f5..f083cefb39 100755
--- a/source4/script/cflags.pl
+++ b/source4/script/cflags.pl
@@ -8,20 +8,31 @@ use strict;
my $target = shift;
-sub check_flags($)
+my $vars = {};
+
+sub check_flags($$)
{
- my ($name)=@_;
- open (IN, "extra_cflags.txt");
- while (<IN> =~ /^([^:]+): (.*)$/) {
- next unless (grep(/^$target$/, (split / /, $1)));
- $_ = $2;
- s/^CFLAGS\+=//;
- print "$_ ";
+ my ($path, $name)=@_;
+ open (IN, $path);
+ foreach my $line (<IN>) {
+ if ($line =~ /^include (.*)$/) {
+ check_flags($1, $name);
+ } elsif ($line =~ /^([A-Za-z0-9_]+) = (.*)$/) {
+ $vars->{$1} = $2;
+ } elsif ($line =~ /^([^:]+): (.*)$/) {
+ next unless (grep(/^$target$/, (split / /, $1)));
+ my $data = $2;
+ $data =~ s/^CFLAGS\+=//;
+ foreach (keys %$vars) {
+ $data =~ s/\$($_)/$vars->{$_}/g;
+ }
+ print "$data ";
+ }
}
close(IN);
- print "\n";
}
-check_flags($target);
+check_flags("extra_cflags.txt", $target);
+print "\n";
exit 0;