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 |
|
|
# group stuff - prototypeonly - hardcoded in for now
|
9 |
|
|
#
|
10 |
|
|
print OUT<<ENDTEXT;
|
11 |
|
|
ifdef GROUP_G3
|
12 |
|
|
cmsim=true
|
13 |
|
|
GEANT=true
|
14 |
|
|
endif
|
15 |
|
|
ENDTEXT
|
16 |
|
|
|
17 |
|
|
# project defualts
|
18 |
|
|
|
19 |
|
|
open (defaultsfile, "<$ARGV[2]" ) || die "Unable to open file $ARGV[2] $!";
|
20 |
|
|
while( <defaultsfile> ) {
|
21 |
|
|
chomp;
|
22 |
|
|
next if /^#/;
|
23 |
|
|
next if /^\s*$/;
|
24 |
|
|
($product, $version )=split /:/;
|
25 |
|
|
print OUT<<ENDTEXT;
|
26 |
|
|
ifdef $product
|
27 |
|
|
${product}_V_$version=true
|
28 |
|
|
endif
|
29 |
|
|
ENDTEXT
|
30 |
|
|
}
|
31 |
|
|
close defaultsfile;
|
32 |
|
|
|
33 |
|
|
open (file, "<$ARGV[0]" ) || die "Unable to open file $ARGV[0] $!";
|
34 |
|
|
while( <file> ) {
|
35 |
|
|
chomp;
|
36 |
|
|
next if /^#/;
|
37 |
|
|
next if /^\s*$/;
|
38 |
|
|
($product, $version, $type, $variable, $value, @junk)=split /:/;
|
39 |
|
|
next if ( $variable=~/\&/ );
|
40 |
|
|
if ( ! $version=="" ) {
|
41 |
|
|
$product=$product."_V_".$version;
|
42 |
|
|
}
|
43 |
|
|
print OUT<<ENDTEXT;
|
44 |
|
|
ifdef $product
|
45 |
|
|
$variable += $value
|
46 |
|
|
endif
|
47 |
|
|
ENDTEXT
|
48 |
|
|
}
|
49 |
|
|
close file;
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
# Prototype only
|
53 |
|
|
print OUT 'INCLUDEPATH+=$(addprefix -I,$(INCLUDE))'."\n";
|
54 |
|
|
print OUT 'LIBDIR+=$(addprefix -L,$(LIBDIR))'."\n";
|
55 |
|
|
print OUT 'CPPFLAGS+=$(addprefix -D,$(CPPDEFINES))'."\n";
|
56 |
|
|
print OUT 'lib+=$(addprefix -l,$(lib))'."\n";
|
57 |
|
|
print OUT 'lib+=$(addprefix -l,$(REQUIRES))'."\n";
|
58 |
|
|
|
59 |
|
|
close OUT;
|