-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathprepare-config.perl
More file actions
45 lines (37 loc) · 966 Bytes
/
prepare-config.perl
File metadata and controls
45 lines (37 loc) · 966 Bytes
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
# This file processes the configurations options in Config.sh, producing
# two files:
#
# GIZMO_config.h to be included in each source file (via allvars.h)
# compile_time_info.c code to be compiled in, which will print the configuration
#
# This file was originally part of GADGET3 by Volker Springel.
#
if(@ARGV[0])
{
open(FILE, @ARGV[0]);
}
else
{
open(FILE, "Config.sh");
}
open(OUTFILE, ">GIZMO_config.h");
open(COUTF, ">compile_time_info.c");
print COUTF "#include <stdio.h>\n";
print COUTF "void output_compile_time_options(void)\n\{\n";
print COUTF "printf(\n";
while($line=<FILE>)
{
chop $line;
@fields = split ' ' , $line;
if(substr($fields[0], 0, 1) ne "#")
{
if(length($fields[0]) > 0)
{
@subfields = split '=', $fields[0];
print OUTFILE "#define $subfields[0] $subfields[1]\n";
print COUTF "\" $fields[0]\\n\"\n";
}
}
}
print COUTF "\"\\n\");\n";
print COUTF "\}\n";