summaryrefslogtreecommitdiff
path: root/source4/script/cflags.pl
blob: f98ed9f6111e9d8394bb539e74ca2e8717cc80e0 (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
#!/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 $target2 = "./$target";

sub check_flags($)
{
    my ($name)=@_;
	open (IN, "extra_cflags.txt");
    while (<IN> =~ /^([^:]+): (.*)$/) {
		next unless (grep(/^$target$/, (split / /, $1)) ||
			     grep(/^$target2$/, (split / /, $1)));
		$_ = $2;
		s/^CFLAGS\+=//;
		print "$_ ";
	}
	close(IN);
	print "\n";
}

check_flags($target);

exit 0;