blob: e9b391db5b18f11142e3b94589593a807a1ed26f [file] [log] [blame]
Guido van Rossum58a59481997-08-14 01:45:33 +00001import sys, os, string
2
Guido van Rossumf8883501998-03-04 18:12:39 +00003WINMAINTEMPLATE = """
4#include <windows.h>
5
6int WINAPI WinMain(
7 HINSTANCE hInstance, // handle to current instance
8 HINSTANCE hPrevInstance, // handle to previous instance
9 LPSTR lpCmdLine, // pointer to command line
10 int nCmdShow // show state of window
11 )
12{
13 return main(__argc, __argv);
14}
15"""
16
Guido van Rossum58a59481997-08-14 01:45:33 +000017def makemakefile(outfp, vars, files, target):
18 save = sys.stdout
19 try:
20 sys.stdout = outfp
21 realwork(vars, files, target)
22 finally:
23 sys.stdout = save
24
25def realwork(vars, files, target):
26 print "# Makefile for Windows (NT or 95) generated by freeze.py script"
27 print
28 print "target =", target
29 print "pythonhome =", vars['prefix']
Guido van Rossum77b30081997-08-14 20:13:46 +000030 # XXX The following line is fishy and may need manual fixing
Guido van Rossum58a59481997-08-14 01:45:33 +000031 print "pythonlib =", vars['exec_prefix'] + "/pcbuild/release/python15.lib"
32 print "subsystem =", vars['subsystem']
33 print
34 print "all: $(target).exe"
35 print
36
37 objects = []
38 for file in files:
39 base = os.path.basename(file)
40 base, ext = os.path.splitext(base)
41 objects.append(base + ".obj")
42 print "%s.obj: %s" % (base, file)
43 print "\t$(CC) -c $(cdl)",
44 print "-I$(pythonhome)/Include -I$(pythonhome)/PC \\"
45 print "\t\t$(cflags) $(cdebug) $(cinclude) \\"
46 print "\t\t", file
Guido van Rossum0b0e7b51998-03-06 19:55:36 +000047 print
Guido van Rossum58a59481997-08-14 01:45:33 +000048
49 print "$(target).exe:",
50 for obj in objects: print obj,
51 print
52 print "\tlink -out:$(target).exe",
53 for obj in objects: print obj,
54 print "\\"
55 print "\t\t$(pythonlib) $(lcustom) shell32.lib comdlg32.lib wsock32.lib \\"
56 print "\t\t-subsystem:$(subsystem) $(resources)"
57
58# Local Variables:
59# indent-tabs-mode: nil
60# End: