diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-11 19:28:59 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-11 19:28:59 +0100 |
commit | a3052e79f41afe91dc5a1c898868c632053ce599 (patch) | |
tree | ebc54f718b31061a81227da8911b3c9a730e32ef /source4/script | |
parent | 6c7a4009458b4b005b3c5f19dc284f0fcc459bcc (diff) | |
download | samba-a3052e79f41afe91dc5a1c898868c632053ce599.tar.gz samba-a3052e79f41afe91dc5a1c898868c632053ce599.tar.bz2 samba-a3052e79f41afe91dc5a1c898868c632053ce599.zip |
Use make variables in cflags file (now supported by cflags.pl)
(This used to be commit d746fcde1006b4b7b33aa65bef9d2fea3ebc9162)
Diffstat (limited to 'source4/script')
-rwxr-xr-x | source4/script/cflags.pl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source4/script/cflags.pl b/source4/script/cflags.pl index f083cefb39..37b5aa7e71 100755 --- a/source4/script/cflags.pl +++ b/source4/script/cflags.pl @@ -10,6 +10,7 @@ my $target = shift; my $vars = {}; +sub check_flags($$); sub check_flags($$) { my ($path, $name)=@_; @@ -17,15 +18,18 @@ sub check_flags($$) foreach my $line (<IN>) { if ($line =~ /^include (.*)$/) { check_flags($1, $name); - } elsif ($line =~ /^([A-Za-z0-9_]+) = (.*)$/) { + } 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; + 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 "; } } |