blob: f083cefb392c5054a13b7716f496afe4e454dc3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env perl
# This is a hack to allow per target cflags. It isn't very elegant, but it
# is the most portable idea we have come up with yet
# tridge@samba.org, July 2005
# jelmer@samba.org, March 2006
use strict;
my $target = shift;
my $vars = {};
sub check_flags($$)
{
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);
}
check_flags("extra_cflags.txt", $target);
print "\n";
exit 0;
|