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
60
61
62
63
64
65
|
import sys, os, string
WINMAINTEMPLATE = """
#include <windows.h>
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
return main(__argc, __argv);
}
"""
def makemakefile(outfp, vars, files, target):
save = sys.stdout
try:
sys.stdout = outfp
realwork(vars, files, target)
finally:
sys.stdout = save
def realwork(vars, files, target):
print "# Makefile for Windows (NT or 95) generated by freeze.py script"
print
print 'target = %s' % target
print 'pythonhome = "%s"' % vars['prefix']
# XXX The following line is fishy and may need manual fixing
print 'pythonlib = "%s"' % (vars['exec_prefix'] +
"/pcbuild/release/python15.lib")
print "subsystem =", vars['subsystem']
print
print "all: $(target).exe"
print
objects = []
for file in files:
base = os.path.basename(file)
base, ext = os.path.splitext(base)
objects.append(base + ".obj")
print '%s.obj: "%s"' % (base, file)
print "\t$(CC) -c $(cdl)",
print "-I$(pythonhome)/Include -I$(pythonhome)/PC \\"
print "\t\t$(cflags) $(cdebug) $(cinclude) \\"
print '\t\t"%s"' % file
print
print "$(target).exe:",
for obj in objects: print obj,
print
print "\tlink -out:$(target).exe",
for obj in objects: print obj,
print "\\"
print "\t\t$(pythonlib) $(lcustom) shell32.lib comdlg32.lib wsock32.lib \\"
print "\t\t-subsystem:$(subsystem) $(resources)"
print
print "clean:"
print "\t\t-rm *.obj"
print "\t\t-rm $(target).exe"
# Local Variables:
# indent-tabs-mode: nil
# End:
|