summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/makemakefile.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-10-03 16:33:08 (GMT)
committerGuido van Rossum <guido@python.org>1994-10-03 16:33:08 (GMT)
commit00ff4336a9c4258d72aa11fb5160f7afbbe88d84 (patch)
tree993b2895ba2fcf762d756686970be449c448e365 /Tools/freeze/makemakefile.py
parentdbaf332107b3188980c0bce6aed7ac6bce212ec7 (diff)
downloadcpython-00ff4336a9c4258d72aa11fb5160f7afbbe88d84.zip
cpython-00ff4336a9c4258d72aa11fb5160f7afbbe88d84.tar.gz
cpython-00ff4336a9c4258d72aa11fb5160f7afbbe88d84.tar.bz2
Totally new "freeze" program.
Diffstat (limited to 'Tools/freeze/makemakefile.py')
-rw-r--r--Tools/freeze/makemakefile.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tools/freeze/makemakefile.py b/Tools/freeze/makemakefile.py
new file mode 100644
index 0000000..5418f93
--- /dev/null
+++ b/Tools/freeze/makemakefile.py
@@ -0,0 +1,27 @@
+# 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" % 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\n" % (string.join(files), target))