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 |
open (requires, "<$ARGV[0]_reqs" );
|
18 |
while( <requires> ) {
|
19 |
print OUT $_;
|
20 |
}
|
21 |
close requirements;
|
22 |
|
23 |
# project defualts
|
24 |
|
25 |
open (defaultsfile, "<$ARGV[2]" ) || die "Unable to open file $ARGV[2] $!";
|
26 |
while( <defaultsfile> ) {
|
27 |
chomp;
|
28 |
next if /^#/;
|
29 |
next if /^\s*$/;
|
30 |
($product, $version )=split /:/;
|
31 |
$product=~tr[A-Z][a-z];
|
32 |
print OUT<<ENDTEXT;
|
33 |
ifdef $product
|
34 |
${product}_V_$version=true
|
35 |
endif
|
36 |
ENDTEXT
|
37 |
}
|
38 |
close defaultsfile;
|
39 |
|
40 |
open (file, "<$ARGV[0]" ) || die "Unable to open file $ARGV[0] $!";
|
41 |
while( <file> ) {
|
42 |
chomp;
|
43 |
next if /^#/;
|
44 |
next if /^\s*$/;
|
45 |
($product, $version, $type, $variable, $value, @junk)=split /:/;
|
46 |
next if ( $variable=~/\&/ );
|
47 |
$product=~tr[A-Z][a-z];
|
48 |
if ( ! $version=="" ) {
|
49 |
$product=$product."_V_".$version;
|
50 |
}
|
51 |
print OUT<<ENDTEXT;
|
52 |
ifdef $product
|
53 |
$variable += $value
|
54 |
endif
|
55 |
ENDTEXT
|
56 |
}
|
57 |
close file;
|
58 |
|
59 |
|
60 |
# Prototype only
|
61 |
print OUT 'INCLUDEPATH+=$(addprefix -I,$(INCLUDE))'."\n";
|
62 |
print OUT 'LDFLAGS+=$(addprefix -L,$(LIBDIR))'."\n";
|
63 |
print OUT 'CPPFLAGS+=$(addprefix -D,$(CPPDEFINES))'."\n";
|
64 |
print OUT 'lib+=$(extralib)'."\n";
|
65 |
print OUT 'LDLIBS+=$(addprefix -l,$(lib))'."\n";
|
66 |
print OUT 'LDLIBS+=$(addprefix -l,$(REQUIRES))'."\n";
|
67 |
|
68 |
close OUT;
|