Guido van Rossum | 73695ec | 1996-09-05 15:32:18 +0000 | [diff] [blame] | 1 | |
| 2 | !include <ntwin32.mak> # bring in platform specific stuff. |
| 3 | |
| 4 | #Fix a problem with ntwin32.mak and Visual C++ |
| 5 | # problem is .mak defines "link=link32" and "lib=lib32" |
| 6 | # Problem is MSVC linker/library manager use these environment |
| 7 | # variables as additional flags to link/lib |
| 8 | # Consequently, link warns "link32.obj not found" and similarly lib. |
| 9 | # This has really p___ed me of. It has been very hard to get right. |
| 10 | # The LIB variable is used by MSVC to locate system library files, and |
| 11 | # damn ntwin32.mak sets lib. Now although NMAKE is case sensitive, the OS' |
| 12 | # environment vars arent. Therefore /E option _must_ be specified for MSVC |
| 13 | # nmake itself is also very average :-( |
| 14 | # |
| 15 | |
| 16 | # Damn it. Even with .pyd in the suffixes, nmake wont infer a line |
| 17 | # mymodule.dll: |
| 18 | # and run up the .c->.obj, .obj->.pyd. And with all debug turned on, all |
| 19 | # it says is "dont know how to make .." Damn it (probably me, but I gave up:) |
| 20 | #.SUFFIXES : |
| 21 | #.SUFFIXES : .exe .dll .obj .asm .c .cpp .cxx .bas .cbl .for .pas .res .rc |
| 22 | |
| 23 | # Version information. |
| 24 | pyversion=140 |
| 25 | pypatchlevel=b1 |
| 26 | |
| 27 | pythondllext=pyd |
| 28 | linker=$(link) |
| 29 | libmgr=$(implib) |
| 30 | LINK= |
| 31 | |
| 32 | #cdebug = -Z7 -Od # Z7 for win32s debugging |
| 33 | |
| 34 | # |
| 35 | # Additional common definitions |
| 36 | # |
| 37 | cinclude=/I$(pythondir)\Include |
| 38 | python_dll=Py$(pyversion)-$(pypatchlevel).dll |
| 39 | python_defs_lib=$(pythondir)\Modules\Python.lib |
| 40 | python_defs_exp=$(pythondir)\Modules\Python.exp |
| 41 | pythonopts=/DHAVE_CONFIG_H /nologo /MD /G3 |
| 42 | |
| 43 | #!IFDEF MSVC |
| 44 | # Although this is handled, it generates warning. This is to avoid them |
| 45 | #cc=cl |
| 46 | #linker=link |
| 47 | #libmgr=lib |
| 48 | #!ENDIF |
| 49 | |
| 50 | !IFNDEF NODEBUG |
| 51 | ldebug = -debug:full -debugtype:both |
| 52 | !ENDIF |
| 53 | |
| 54 | !ifndef BUILD_DL |
| 55 | cdl=/DUSE_DL_EXPORT /DWIN32_PATCH_LEVEL=\"$(pyversion)-$(pypatchlevel)\" |
| 56 | |
| 57 | .c.obj: |
| 58 | @$(cc) $(cflags) $(ccustom) $(cdebug) $(cinclude) $(pythonopts) $(cdl) $*.c |
| 59 | !else |
| 60 | # |
| 61 | # Useful stuff for building DL modules under NT. |
| 62 | # |
| 63 | |
| 64 | cdl=/DUSE_DL_IMPORT |
| 65 | |
| 66 | #if you have a .DEF file, define HAVE_DEF |
| 67 | # if you dont want precompiled headers, define PCH=0 (in your makefile, not here!) |
| 68 | !ifndef PCH |
| 69 | PCH=1 |
| 70 | !endif |
| 71 | !if "$(PCH)"=="1" |
| 72 | cpch=/YX |
| 73 | !else |
| 74 | cpch= |
| 75 | !endif |
| 76 | |
| 77 | !ifdef HAVE_DEF |
| 78 | export_statements=/DEF:$*.def |
| 79 | !else |
| 80 | export_statements=/EXPORT:init$(*:module=) |
| 81 | !endif |
| 82 | # Note for 'C', I use /Tp, to force as CPP - this will allow .C to define types. |
| 83 | .c.obj: |
| 84 | @echo Warning - compiling as C++ file |
| 85 | @$(cc) $(cdl) $(cflags) $(ccustom) $(cdebug) $(cinclude) $(cpch) $(pythonopts) /DUSE_DL_IMPORT /Tp $*.c |
| 86 | |
| 87 | .cpp.obj: |
| 88 | @$(cc) $(cdl) $(cflags) $(ccustom) $(cdebug) $(cinclude) $(cpch) $(pythonopts) /DUSE_DL_IMPORT $*.cpp |
| 89 | |
| 90 | .obj.$(pythondllext): |
| 91 | @link -dll -out:$*.$(pythondllext) $*.obj $(ldebug) $(export_statements) $(guilibsdll) $(lcustom) $(python_defs_lib) |
| 92 | |
| 93 | !endif # !BUILD_DL |