-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_macros.py
More file actions
59 lines (49 loc) · 1.37 KB
/
make_macros.py
File metadata and controls
59 lines (49 loc) · 1.37 KB
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
50
51
52
53
54
55
56
57
58
59
import sys
import os
config_file = open("Config.sh")
names = []
values = []
types = []
#
# Get the configuration options
# and figure out what is a float
#
for line in config_file:
if (line[0]=='#'):
pass
else:
tokens = line.split('=')
if (len(tokens) < 2):
pass
else:
isFloat = 0
names.append(tokens[0])
if (tokens[0] == "OPENMP"):
print "Exporting OpenMP options."
os.system("export OMP_NUM_THREADS="+tokens[1])
#if len(tokens > 1):
values.append(tokens[1])
#else:
# values.append("NULL")
for char in tokens[1]:
if (char == '.'):
isFloat = 1
if (isFloat == 1):
types.append(1)
else:
types.append(0)
#print values
#print names
#print types
config_file.close()
header = open("./include/Compile_Time_Options.h",'w')
i_max = len(values)
i=0
while (i < i_max):
if (types[i] == 0 and values[i] != "NULL"):
header.write("#define " + str(names[i]) + " " + str(int(values[i])) + '\n')
elif(types[i] != 0 and values[i] != "NULL"):
header.write("#define " + str(names[i]) + " " + str(float(values[i])) + '\n')
else:
header.write("#define " + str(names[i]))
i = i + 1