1997-08-13 22:45:33 -03:00
|
|
|
import sys, os, string
|
|
|
|
|
1998-03-04 14:12:39 -04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
|
1997-08-13 22:45:33 -03:00
|
|
|
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
|
1998-03-07 01:10:00 -04:00
|
|
|
print 'target = %s' % target
|
|
|
|
print 'pythonhome = "%s"' % vars['prefix']
|
1997-08-14 17:13:46 -03:00
|
|
|
# XXX The following line is fishy and may need manual fixing
|
1998-03-07 01:10:00 -04:00
|
|
|
print 'pythonlib = "%s"' % (vars['exec_prefix'] +
|
|
|
|
"/pcbuild/release/python15.lib")
|
1997-08-13 22:45:33 -03:00
|
|
|
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")
|
1998-03-07 01:10:00 -04:00
|
|
|
print '%s.obj: "%s"' % (base, file)
|
1997-08-13 22:45:33 -03:00
|
|
|
print "\t$(CC) -c $(cdl)",
|
|
|
|
print "-I$(pythonhome)/Include -I$(pythonhome)/PC \\"
|
|
|
|
print "\t\t$(cflags) $(cdebug) $(cinclude) \\"
|
1998-03-07 01:10:00 -04:00
|
|
|
print '\t\t"%s"' % file
|
1998-03-06 15:55:36 -04:00
|
|
|
print
|
1997-08-13 22:45:33 -03:00
|
|
|
|
|
|
|
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)"
|
1998-03-07 01:10:00 -04:00
|
|
|
print
|
|
|
|
print "clean:"
|
|
|
|
print "\t\t-rm *.obj"
|
|
|
|
print "\t\t-rm $(target).exe"
|
1997-08-13 22:45:33 -03:00
|
|
|
|
|
|
|
# Local Variables:
|
|
|
|
# indent-tabs-mode: nil
|
|
|
|
# End:
|