0
0
mirror of https://github.com/python/cpython.git synced 2024-11-28 08:20:55 +01:00
cpython/Tools/freeze/makemakefile.py
Guido van Rossum c8f859a487 Jonathan Giddy:
This second problem only shows up if LDLAST is not an empty string (such
as with threads enabled on DEC Alphas).
1998-06-12 14:09:34 +00:00

31 lines
892 B
Python

# Write the actual Makefile.
import os
import string
def makemakefile(outfp, makevars, files, target):
outfp.write("# Makefile generated by freeze.py script\n\n")
keys = makevars.keys()
keys.sort()
for key in keys:
outfp.write("%s=%s\n" % (key, makevars[key]))
outfp.write("\nall: %s\n\n" % target)
deps = []
for i in range(len(files)):
file = files[i]
if file[-2:] == '.c':
base = os.path.basename(file)
dest = base[:-2] + '.o'
outfp.write("%s: %s\n" % (dest, file))
outfp.write("\t$(CC) $(CFLAGS) -c %s\n" % file)
files[i] = dest
deps.append(dest)
outfp.write("\n%s: %s\n" % (target, string.join(deps)))
outfp.write("\t$(CC) %s -o %s $(LDLAST)\n" %
(string.join(files), target))
outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)