-
Notifications
You must be signed in to change notification settings - Fork 1
/
conf.py
33 lines (29 loc) · 1.02 KB
/
conf.py
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
from jinja2 import FileSystemLoader, Environment
import os
def main():
cfiles = []
src = ''
obj = ''
deps = ''
files = os.listdir(os.getcwd())
for file in files:
filename, ext = os.path.splitext(file)
if file not in cfiles and ext == '.c':
cfiles.append(file)
for i, file in enumerate(cfiles):
if i < len(cfiles) - 1:
src += '../' + filename + '.c' + ' \\\n'
obj += './' + filename + '.o' + ' \\\n'
deps += './' + filename + '.d' + ' \\\n'
else:
src += '../' + filename + '.c' + ' \n'
obj += './' + filename + '.o' + ' \n'
deps += './' + filename + '.d' + ' \n'
env = Environment(loader=FileSystemLoader('/hpgcc3/templates'))
makeT = env.get_template('subdir.tmpl')
if not os.path.isdir('build'):
os.mkdir('build')
with open('build/subdir.mk', 'w') as file:
file.write(makeT.render(sources=src, objects=obj, dependencies=deps))
if __name__ == '__main__':
main()