ยปCore Development>Code coverage>Tools/freeze/makemakefile.py

Python code coverage for Tools/freeze/makemakefile.py

#countcontent
1n/a# Write the actual Makefile.
2n/a
3n/aimport os
4n/a
5n/adef makemakefile(outfp, makevars, files, target):
6n/a outfp.write("# Makefile generated by freeze.py script\n\n")
7n/a
8n/a keys = sorted(makevars.keys())
9n/a for key in keys:
10n/a outfp.write("%s=%s\n" % (key, makevars[key]))
11n/a outfp.write("\nall: %s\n\n" % target)
12n/a
13n/a deps = []
14n/a for i in range(len(files)):
15n/a file = files[i]
16n/a if file[-2:] == '.c':
17n/a base = os.path.basename(file)
18n/a dest = base[:-2] + '.o'
19n/a outfp.write("%s: %s\n" % (dest, file))
20n/a outfp.write("\t$(CC) $(PY_CFLAGS) $(PY_CPPFLAGS) -c %s\n" % file)
21n/a files[i] = dest
22n/a deps.append(dest)
23n/a
24n/a outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
25n/a outfp.write("\t$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
26n/a (' '.join(files), target))
27n/a
28n/a outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)