1 |
williamc |
1.1 |
#!/usr/local/bin/perl5
|
2 |
|
|
#
|
3 |
|
|
# Parse the site file specified by the first argument 1 and produce a
|
4 |
|
|
# makefile specified by argument 2
|
5 |
|
|
# version defaults by argument 3
|
6 |
|
|
|
7 |
|
|
open (OUT, ">$ARGV[1]" );
|
8 |
williamc |
1.2 |
open (requires, "<$ARGV[0]_reqs" );
|
9 |
|
|
while( <requires> ) {
|
10 |
|
|
print OUT $_;
|
11 |
|
|
}
|
12 |
|
|
close requirements;
|
13 |
williamc |
1.1 |
# group stuff - prototypeonly - hardcoded in for now
|
14 |
|
|
#
|
15 |
|
|
print OUT<<ENDTEXT;
|
16 |
|
|
ifdef GROUP_G3
|
17 |
|
|
cmsim=true
|
18 |
|
|
GEANT=true
|
19 |
|
|
endif
|
20 |
|
|
ENDTEXT
|
21 |
|
|
|
22 |
|
|
# project defualts
|
23 |
|
|
|
24 |
|
|
open (defaultsfile, "<$ARGV[2]" ) || die "Unable to open file $ARGV[2] $!";
|
25 |
|
|
while( <defaultsfile> ) {
|
26 |
|
|
chomp;
|
27 |
|
|
next if /^#/;
|
28 |
|
|
next if /^\s*$/;
|
29 |
|
|
($product, $version )=split /:/;
|
30 |
|
|
print OUT<<ENDTEXT;
|
31 |
|
|
ifdef $product
|
32 |
|
|
${product}_V_$version=true
|
33 |
|
|
endif
|
34 |
|
|
ENDTEXT
|
35 |
|
|
}
|
36 |
|
|
close defaultsfile;
|
37 |
|
|
|
38 |
|
|
open (file, "<$ARGV[0]" ) || die "Unable to open file $ARGV[0] $!";
|
39 |
|
|
while( <file> ) {
|
40 |
|
|
chomp;
|
41 |
|
|
next if /^#/;
|
42 |
|
|
next if /^\s*$/;
|
43 |
|
|
($product, $version, $type, $variable, $value, @junk)=split /:/;
|
44 |
|
|
next if ( $variable=~/\&/ );
|
45 |
|
|
if ( ! $version=="" ) {
|
46 |
|
|
$product=$product."_V_".$version;
|
47 |
|
|
}
|
48 |
|
|
print OUT<<ENDTEXT;
|
49 |
|
|
ifdef $product
|
50 |
|
|
$variable += $value
|
51 |
|
|
endif
|
52 |
|
|
ENDTEXT
|
53 |
|
|
}
|
54 |
|
|
close file;
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
# Prototype only
|
58 |
|
|
print OUT 'INCLUDEPATH+=$(addprefix -I,$(INCLUDE))'."\n";
|
59 |
williamc |
1.2 |
print OUT 'LDFLAGS+=$(addprefix -L,$(LIBDIR))'."\n";
|
60 |
williamc |
1.1 |
print OUT 'CPPFLAGS+=$(addprefix -D,$(CPPDEFINES))'."\n";
|
61 |
williamc |
1.2 |
print OUT 'LDLIBS+=$(addprefix -l,$(lib))'."\n";
|
62 |
|
|
print OUT 'LDLIBS+=$(addprefix -l,$(REQUIRES))'."\n";
|
63 |
williamc |
1.1 |
|
64 |
|
|
close OUT;
|