Guido van Rossum | 58a5948 | 1997-08-14 01:45:33 +0000 | [diff] [blame] | 1 | import sys, os, string |
| 2 | |
Guido van Rossum | f888350 | 1998-03-04 18:12:39 +0000 | [diff] [blame] | 3 | WINMAINTEMPLATE = """ |
| 4 | #include <windows.h> |
| 5 | |
| 6 | int 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 Rossum | 58a5948 | 1997-08-14 01:45:33 +0000 | [diff] [blame] | 17 | def 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 | |
| 25 | def 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 Rossum | 77b3008 | 1997-08-14 20:13:46 +0000 | [diff] [blame] | 30 | # XXX The following line is fishy and may need manual fixing |
Guido van Rossum | 58a5948 | 1997-08-14 01:45:33 +0000 | [diff] [blame] | 31 | 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 Rossum | 0b0e7b5 | 1998-03-06 19:55:36 +0000 | [diff] [blame^] | 47 | print |
Guido van Rossum | 58a5948 | 1997-08-14 01:45:33 +0000 | [diff] [blame] | 48 | |
| 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: |