blob: 7ce3ba3555edd78dffd5d0df57dbbe030f37026f (
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
39
40
41
42
43
44
45
46
47
48
49
|
# SMB Build System
#
# Copyright (C) Jelmer Vernooij 2006
# Released under the GNU GPL
package cflags;
use strict;
sub create_cflags($$$$)
{
my $CTX = shift;
my $srcdir = shift;
my $builddir = shift;
my $file = shift;
open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
foreach my $key (values %{$CTX}) {
next unless defined ($key->{OBJ_LIST});
next unless defined ($key->{FINAL_CFLAGS});
next unless ($#{$key->{FINAL_CFLAGS}} >= 0);
# Rewrite CFLAGS so that both the source and the build
# directories are in the path.
my $cflags = "";
foreach my $flag (@{$key->{FINAL_CFLAGS}}) {
my $dir;
if (($dir) = ($flag =~ /^-I([^\/].*)$/)) {
$cflags .= " -I$builddir/$dir";
$cflags .= " -I$srcdir/$dir";
} else {
$cflags .= " $flag";
}
}
foreach (@{$key->{OBJ_LIST}}) {
my $ofile = $_;
my $dfile = $_;
$dfile =~ s/\.o$/.d/;
$dfile =~ s/\.ho$/.d/;
print CFLAGS_TXT "$ofile $dfile: CFLAGS+= $cflags\n";
}
}
close(CFLAGS_TXT);
print __FILE__.": creating $file\n";
}
1;
|