summaryrefslogtreecommitdiffstats
path: root/source4/script
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-02-21 09:55:13 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-02-21 09:55:13 +1100
commit774fa12ac1695600710ce9fac18024edd38161ee (patch)
tree5440d8c0f00d28656e0d8f65f3b771eb11a01842 /source4/script
parent49b3a4829325967df9d1e616ad32e5379ce6cf5d (diff)
parent910a1cafdf253255510d3aff7cc2385da43331dd (diff)
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit 5cd3310b78a85243eb436d05db3228c3495f9162)
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/cflags.pl35
1 files changed, 25 insertions, 10 deletions
diff --git a/source4/script/cflags.pl b/source4/script/cflags.pl
index 7f435d46f5..37b5aa7e71 100755
--- a/source4/script/cflags.pl
+++ b/source4/script/cflags.pl
@@ -8,20 +8,35 @@ use strict;
my $target = shift;
-sub check_flags($)
+my $vars = {};
+
+sub check_flags($$);
+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 my $key (keys %$vars) {
+ my $val = $vars->{$key};
+ $data =~ s/\$\($key\)/$val/g;
+ }
+ # Remove undefined variables
+ $data =~ s/\$\([A-Za-z0-9_]+\)//g;
+ print "$data ";
+ }
}
close(IN);
- print "\n";
}
-check_flags($target);
+check_flags("extra_cflags.txt", $target);
+print "\n";
exit 0;