diff options
author | Guido van Rossum <guido@python.org> | 1998-08-25 14:06:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-08-25 14:06:55 (GMT) |
commit | baf0603493f6f1eee073a479497291785b067f61 (patch) | |
tree | 7b9b04abcd5d890d1d76d6cd81984b1a0f55ee11 /Tools/freeze/winmakemakefile.py | |
parent | 6c74fea07d42ac6bc3bc078fb13f903f6cdbbcb9 (diff) | |
download | cpython-baf0603493f6f1eee073a479497291785b067f61.zip cpython-baf0603493f6f1eee073a479497291785b067f61.tar.gz cpython-baf0603493f6f1eee073a479497291785b067f61.tar.bz2 |
New version, with contributions from Sjoerd Mullender and Mark Hammond.
Sjoerd writes:
This version of freeze creates one file per Python module, instead of
one humongous file for all Python modules.
bkfile: new module to used to write files with backups. No new file
is produced if the new contents is identical to the old.
New option "-x excluded-module" for modulefinder test program.
New option "-i filename" for freeze main program to include a list of
options in place of the -i option.
Diffstat (limited to 'Tools/freeze/winmakemakefile.py')
-rw-r--r-- | Tools/freeze/winmakemakefile.py | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/Tools/freeze/winmakemakefile.py b/Tools/freeze/winmakemakefile.py index 3f37e77..351e9ca 100644 --- a/Tools/freeze/winmakemakefile.py +++ b/Tools/freeze/winmakemakefile.py @@ -50,13 +50,29 @@ def makemakefile(outfp, vars, files, target): sys.stdout = save def realwork(vars, moddefns, target): - print "# Makefile for Windows (NT or 95) generated by freeze.py script" + print "# Makefile for Microsoft Visual C++ 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 + print 'DEBUG=0 # Set to 1 to use the _d versions of Python.' + print '!IF $(DEBUG)' + print 'debug_suffix=_d' + print 'c_debug=/Zi /Od /DDEBUG /D_DEBUG' + print 'l_debug=/DEBUG' + print 'temp_dir=Build\\Debug' + print '!ELSE' + print 'debug_suffix=' + print 'c_debug=/Ox' + print 'l_debug=' + print 'temp_dir=Build\\Release' + print '!ENDIF' + print + + print '# The following line assumes you have built Python using the standard instructions' + print '# Otherwise fix the following line to point to the library.' + print 'pythonlib = "$(pythonhome)/pcbuild/python15$(debug_suffix).lib"' + print # We only ever write one "entry point" symbol - either # "main" or "WinMain". Therefore, there is no need to @@ -69,21 +85,27 @@ def realwork(vars, moddefns, target): target_link_flags = "-dll" target_ext = ".dll" - print "cdl = /MD" # XXX - Should this come from vars? User may have specific requirements... + + print "# As the target uses Python15.dll, we must use this compiler option!" + print "cdl = /MD" + print + print "all: $(target)$(debug_suffix)%s" % (target_ext) print - print "all: $(target)%s" % (target_ext) + + print '$(temp_dir):' + print ' if not exist $(temp_dir)\. mkdir $(temp_dir)' print objects = [] - libs = ["shell32.lib", "comdlg32.lib", "wsock32.lib", "user32.lib"] + libs = ["shell32.lib", "comdlg32.lib", "wsock32.lib", "user32.lib", "oleaut32.lib"] for moddefn in moddefns: print "# Module", moddefn.name for file in moddefn.sourceFiles: 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 -nologo $(cdl) /D BUILD_FREEZE", + print '$(temp_dir)\%s.obj: "%s"' % (base, file) + print "\t@$(CC) -c -nologo /Fo$* $(cdl) $(c_debug) /D BUILD_FREEZE", print "-I$(pythonhome)/Include -I$(pythonhome)/PC \\" print "\t\t$(cflags) $(cdebug) $(cinclude) \\" extra = moddefn.GetCompilerOptions() @@ -102,20 +124,20 @@ def realwork(vars, moddefns, target): print ; print print "OBJS=", - for obj in objects: print '"%s"' % (obj), + for obj in objects: print '"$(temp_dir)\%s"' % (obj), print ; print print "LIBS=", for lib in libs: print '"%s"' % (lib), print ; print - print "$(target)%s: $(OBJS)" % (target_ext) - print "\tlink -out:$(target)%s %s" % (target_ext, target_link_flags), + print "$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext) + print "\tlink -out:$(target)$(debug_suffix)%s %s" % (target_ext, target_link_flags), print "\t$(OBJS) \\" print "\t$(LIBS) \\" print "\t$(ADDN_LINK_FILES) \\" - print "\t\t$(pythonlib) $(lcustom)\\" - print "\t\t$(resources)" + print "\t$(pythonlib) $(lcustom) $(l_debug)\\" + print "\t$(resources)" print print "clean:" print "\t-rm -f *.obj" |