summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-11 19:28:59 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-11 19:28:59 +0100
commita3052e79f41afe91dc5a1c898868c632053ce599 (patch)
treeebc54f718b31061a81227da8911b3c9a730e32ef
parent6c7a4009458b4b005b3c5f19dc284f0fcc459bcc (diff)
downloadsamba-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)
-rw-r--r--source4/build/m4/public.m48
-rwxr-xr-xsource4/script/cflags.pl10
2 files changed, 11 insertions, 7 deletions
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index e8fbe4b286..d045cf42b7 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -33,7 +33,7 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
@<:@SUBSYSTEM::$1@:>@
OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
-CFLAGS = $4
+CFLAGS = \$($1_CFLAGS)
ENABLE = YES
# End Subsystem $1
###################################
@@ -58,7 +58,7 @@ OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
VERSION = $4
SO_VERSION = $5
-CFLAGS = $6
+CFLAGS = \$($1_CFLAGS)
LDFLAGS = \$($1_LDFLAGS)
PC_NAME = $8
ENABLE = YES
@@ -152,8 +152,8 @@ SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
# Start Ext Lib $1
@<:@EXT_LIB::$1@:>@
LIBS = \$($1_LIBS)
-CFLAGS = $3
-CPPFLAGS = $4
+CFLAGS = \$($1_CFLAGS)
+CPPFLAGS = \$($1_CPPFLAGS)
LDFLAGS = \$($1_LDFLAGS)
PC_NAME = $6
# End Ext Lib $1
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 ";
}
}