Home | History | Annotate | Download | only in os2emx
      1 #####################==================----------------
      2 #
      3 # Top-Level Makefile for Building Python 2.6 for OS/2 using GCC/EMX
      4 # Originally written by Andrew Zabolotny, <bit (at] eltech.ru> for Python 1.5.2
      5 # Modified by Andrew MacIntyre, <andymac (at] pcug.org.au> for Python 2.6
      6 #
      7 # This makefile was developed for use with [P]GCC/EMX compiler any
      8 # version and GNU Make.
      9 #
     10 # The output of the build is a largish Python26.DLL containing the
     11 # essential modules of Python and a small Python.exe program to start
     12 # the interpreter. When embedding Python within another program, only
     13 # Python26.DLL is needed. We also build python_s.a static library (which
     14 # can be converted into OMF (.lib) format using emxomf tool) and both
     15 # python.a and python.lib import libraries.  Then the optional 
     16 # extension modules, which are OS/2 DLLs renamed with a PYD file extension.
     17 #
     18 # Recommended build order:
     19 #   make depend		(if you have makedep)
     20 #   make all
     21 #   make lx		(if you have lxlite)
     22 #   make test		(optional)
     23 #
     24 #####################==================----------------
     25 
     26 # === Compilation mode: debug or release ===
     27 MODE=		optimize
     28 #MODE=		debug
     29 # === Assert() enabled ===
     30 ASSERTIONS=no
     31 #ASSERTIONS=yes
     32 # === Hard-wire installation location ===
     33 FIXED_PYHOME=no
     34 #FIXED_PYHOME=yes
     35 
     36 # === Optional modules ===
     37 # Do you have the InfoZip compression library installed?
     38 HAVE_ZLIB=	no
     39 # Do you have the Ultra Fast Crypt (UFC) library installed?
     40 HAVE_UFC=	no
     41 # Do you have the Tcl/Tk library installed?
     42 HAVE_TCLTK=	no
     43 # Do you have the GNU readline library installed?
     44 # NOTE: I'm using a modified version of Kai Uwe Rommel's port that 
     45 #       - is compiled with multithreading enabled
     46 #       - is linked statically
     47 #       I have had no success trying to use a DLL version, even when
     48 #       compiled with multithreading enabled.
     49 HAVE_GREADLINE=	no
     50 # Do you have the BSD DB library (v1.85) as included in the EMXBSD package?
     51 # NOTE: this library needs to be recompiled with a structure member
     52 #       renamed to avoid problems with the multithreaded errno support
     53 #       (there is a structure member called errno, used for shadowing the
     54 #       real errno, which conflicts with the errno redefinition of -Zmt)
     55 HAVE_BSDDB=	no
     56 # Do you have the ncurses library installed? EMX's BSD curses aren't enough! 
     57 HAVE_NCURSES=	no
     58 # Do you have the GDBM library installed?
     59 HAVE_GDBM=	no
     60 # Do you have the BZ2 compression library installed?
     61 HAVE_BZ2=	no
     62 # Do you have the OpenSSL libraries installed
     63 HAVE_OPENSSL=	no
     64 
     65 # === install locations ===
     66 # default value of PYTHONHOME
     67 LIB_DIR=C:/Python26
     68 # default is to have everything in or under PYTHONHOME
     69 EXE_DIR=$(LIB_DIR)
     70 DLL_DIR=$(EXE_DIR)
     71 
     72 
     73 # === The Tools ===
     74 CC=		gcc
     75 CFLAGS=		-Zmt -Wall $(INCLUDE)
     76 CFLAGS.LIB=	$(CFLAGS)
     77 LD=		gcc
     78 LDFLAGS=	-Zmt -Zcrtdll -L. -lgcc
     79 LDFLAGS.EXE=	$(LDFLAGS)
     80 LDFLAGS.DLL=	$(LDFLAGS) -Zdll
     81 LDFLAGS.A=	$(LDFLAGS) $(LIBS)
     82 ARFLAGS=	crs
     83 IMPLIB=		emximp
     84 EXPLIB=		emxexp
     85 EXEOPT=		emxbind
     86 PY_DEF=		-DPy_BUILD_CORE
     87 
     88 
     89 # adjust C compiler settings based on build options
     90 ifeq ($(MODE),debug)
     91   CFLAGS+=	-g -O
     92   LDFLAGS+=	-g
     93 else
     94   CFLAGS+=	-s -O3 -fomit-frame-pointer -mprobe
     95   LDFLAGS+=	-s
     96 endif
     97 CFLAGS+=	$(PY_DEF)
     98 ifeq ($(ASSERTIONS),no)
     99   CFLAGS+=	-DNDEBUG
    100 endif
    101 ifeq ($(FIXED_PYHOME),yes)
    102   CFLAGS+=	-DPREFIX=$(DQUOTE)$(LIB_DIR)$(DQUOTE)
    103 endif
    104 
    105 # We're using the OMF format since EMX's ld has an obscure bug
    106 # because of which it sometimes fails to build relocations
    107 # in .data segment that point to another .data locations
    108 # (except for the final linking if the .EXEs)
    109 OMF=		yes
    110 
    111 # if fork() support is required, the main executable must be linked with ld
    112 EXEOMF=		no
    113 
    114 # File extensions
    115 MODULE.EXT=	.pyd
    116 MODLIB.EXT=	.dll
    117 ifeq ($(OMF),yes)
    118   O=		.obj
    119   A=		.lib
    120   AR=		emxomfar
    121   CFLAGS+=	-Zomf
    122   LDFLAGS+=	-Zomf
    123   ifeq ($(MODE),debug)
    124     ARFLAGS=	-p64 crs
    125   else
    126     ARFLAGS=	-p32 crs
    127   endif
    128 else
    129   O=		.o
    130   A=		.a
    131   AR=		ar
    132 endif
    133 
    134 
    135 # === Build time resource settings ===
    136 
    137 # EMX's default number of file handles is 40, which is sometimes insufficient
    138 # (the tempfile regression test tries to create 100 temporary files)
    139 NFILES=250
    140 
    141 # The default stack size for child threads is 64k bytes, which is
    142 # insufficient for some applications which do a lot of work in threads
    143 # (such as Zope, especially in conjunction with Plone).
    144 # Note that this setting is distinct from the stack size for the main
    145 # thread, which is set via the %.def rule below.
    146 # EMX documents that the thread stack size should be at least 32768 bytes;
    147 # for Zope/Plone at least 128k bytes is recommended.
    148 # Uncomment & adjust the next line to override the default stack size:
    149 #CFLAGS+=	-DTHREAD_STACK_SIZE=0x20000
    150 
    151 
    152 # === The environment ===
    153 
    154 # Source file paths
    155 SRCPATH=.;../../Python;../../Parser;../../Objects;../../Include;../../Modules
    156 # Python contains the central core, containing the builtins and interpreter.
    157 # Parser contains Python's Internal Parser and
    158 #   Standalone Parser Generator Program (Shares Some of Python's Modules)
    159 # Objects contains Python Object Types
    160 # Modules contains extension Modules (Built-In or as Separate DLLs)
    161 
    162 # Unix shells tend to use "$" as delimiter for variable names.
    163 # Test for this behaviour and set $(BUCK) variable correspondigly ...
    164 __TMP__:=$(shell echo $$$$)
    165 ifeq ($(__TMP__),$$$$)
    166   BUCK=		$$
    167   BRO=		(
    168   BRC=		)
    169 else
    170   BUCK=		\$$
    171   BRO=		\(
    172   BRC=		\)
    173 endif
    174 # Compute the "double quote" variable
    175 __TMP__:=$(shell echo "")
    176 ifeq ($(__TMP__),"")
    177   DQUOTE=	"
    178 else
    179   DQUOTE=	\"
    180 endif
    181 
    182 # Include paths
    183 #INCLUDE=	-I$(subst ;, -I, $(SRCPATH))
    184 INCLUDE=	-I. -I../../Include
    185 
    186 # Path to search for .c files
    187 vpath %.c .;..;$(SRCPATH)
    188 
    189 # Top of the package tree
    190 TOP=		../../
    191 
    192 # Directory for output files
    193 OUTBASE=	out/
    194 OUT=		$(OUTBASE)$(MODE)/
    195 
    196 # Additional libraries
    197 LIBS=		-lsocket
    198 
    199 # Utility macro: replacement for $^
    200 ^^=		$(filter-out %$A,$^)
    201 # Use $(L^) to link with all libraries specified as dependencies
    202 L^=		$(addprefix -l,$(basename $(notdir $(filter %$A,$+))))
    203 
    204 # Build rules
    205 $(OUT)%$O: %.c
    206 	$(CC) $(CFLAGS.LIB) -c $< -o $@
    207 
    208 %.a:
    209 	$(LD) $(LDFLAGS.A) -o $@ $(^^) $(L^)
    210 
    211 %.dll:
    212 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
    213 
    214 %.pyd: $(OUT)%module$O $(OUT)%_m.def
    215 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(PYTHON.IMPLIB) $(LIBS)
    216 
    217 %.exe:
    218 	$(LD) $(LDFLAGS.EXE) -o $@ $(^^) $(L^)
    219 
    220 %_m.def:
    221 	@echo Creating .DEF file: $@
    222 	@echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
    223         ifeq ($(DESCRIPTION.$(notdir $*)$(MODULE.EXT)),)
    224 	  @echo DESCRIPTION $(DQUOTE)Python standard module $(notdir $*)$(DQUOTE) >>$@
    225         else
    226 	  @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@
    227         endif
    228 	@echo DATA MULTIPLE NONSHARED >>$@
    229 	@echo EXPORTS >>$@
    230 	@echo 	init$(notdir $*) >>$@
    231 
    232 %.def:
    233 	@echo Creating .DEF file: $@
    234 	@echo NAME $(notdir $*) $(EXETYPE.$(notdir $*).exe) >$@
    235 	@echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*).exe)$(DQUOTE) >>$@
    236 	@echo STACKSIZE 2097152 >>$@
    237 
    238 # Output file names
    239 PYTHON_VER=	2.6
    240 PYTHON_LIB=	python27
    241 PYTHON.LIB=	$(PYTHON_LIB)_s$A
    242 PYTHON.IMPLIB=	$(PYTHON_LIB)$A
    243 ifeq ($(EXEOMF),yes)
    244   PYTHON.EXEIMP=	$(PYTHON.IMPLIB)
    245   LDMODE.EXE=		-Zomf
    246 else
    247   PYTHON.EXEIMP=	$(PYTHON_LIB).a
    248   LDMODE.EXE = 
    249 endif
    250 PYTHON.DLL=	$(PYTHON_LIB).dll
    251 PYTHON.DEF=	$(PYTHON_LIB).def
    252 PYTHON.EXE=	python.exe
    253 PYTHONPM.EXE=	pythonpm.exe
    254 PGEN.EXE=	pgen.exe
    255 LIBRARY=	$(PYTHON.LIB)
    256 LD_LIBRARY=	$(PYTHON.IMPLIB)
    257 
    258 # Additional executable parameters
    259 EXETYPE.$(PYTHON.EXE)=		WINDOWCOMPAT
    260 EXETYPE.$(PYTHONPM.EXE)=	WINDOWAPI
    261 EXETYPE.$(PGEN.EXE)=		WINDOWCOMPAT
    262 DESCRIPTION.$(PYTHON.EXE)=	Python object-oriented programming language interpreter for OS/2
    263 DESCRIPTION.$(PYTHONPM.EXE)=	$(DESCRIPTION.$(PYTHON.EXE))
    264 DESCRIPTION.$(PGEN.EXE)=	Python object-oriented programming language parser generator for OS/2
    265 
    266 # Module descriptions
    267 DESCRIPTION.zlib$(MODULE.EXT)=		Python Extension DLL for accessing the InfoZip compression library
    268 DESCRIPTION.crypt$(MODULE.EXT)=		Python Extension DLL implementing the crypt$(BRO)$(BRC) function
    269 DESCRIPTION._tkinter$(MODULE.EXT)=	Python Extension DLL for access to Tcl/Tk Environment
    270 DESCRIPTION.readline$(MODULE.EXT)=	Python Extension DLL for access to GNU ReadLine library
    271 DESCRIPTION.bsddb185$(MODULE.EXT)=	Python Extension DLL for access to BSD DB (v1.85) library
    272 DESCRIPTION._curses$(MODLIB.EXT)=	Python Extension DLL for access to ncurses library
    273 DESCRIPTION.pyexpat$(MODULE.EXT)=	Python Extension DLL for access to expat library
    274 DESCRIPTION.bz2$(MODULE.EXT)=		Python Extension DLL for accessing the bz2 compression library
    275 
    276 # Source files
    277 SRC.OS2EMX=	config.c dlfcn.c getpathp.c
    278 SRC.MAIN=	$(addprefix $(TOP), \
    279 		Modules/getbuildinfo.c \
    280 		Modules/main.c)
    281 SRC.MODULES=	$(addprefix $(TOP), \
    282 		Modules/gcmodule.c \
    283 		Modules/signalmodule.c \
    284 		Modules/posixmodule.c \
    285 		Modules/threadmodule.c \
    286 		Modules/arraymodule.c \
    287 		Modules/binascii.c \
    288 		Modules/cmathmodule.c \
    289 		Modules/_codecsmodule.c \
    290 		Modules/_collectionsmodule.c \
    291 		Modules/cPickle.c \
    292 		Modules/cStringIO.c \
    293 		Modules/_csv.c \
    294 		Modules/datetimemodule.c \
    295 		Modules/dlmodule.c \
    296 		Modules/errnomodule.c \
    297 		Modules/fcntlmodule.c \
    298 		Modules/_fileio.c \
    299 		Modules/_functoolsmodule.c \
    300 		Modules/_heapqmodule.c \
    301 		Modules/imageop.c \
    302 		Modules/itertoolsmodule.c \
    303 		Modules/_localemodule.c \
    304 		Modules/mathmodule.c \
    305 		Modules/md5.c \
    306 		Modules/md5module.c \
    307 		Modules/operator.c \
    308 		Modules/_randommodule.c \
    309 		Modules/shamodule.c \
    310 		Modules/sha256module.c \
    311 		Modules/sha512module.c \
    312 		Modules/_sre.c \
    313 		Modules/stropmodule.c \
    314 		Modules/_struct.c \
    315 		Modules/symtablemodule.c \
    316 		Modules/termios.c \
    317 		Modules/timemodule.c \
    318 		Modules/timingmodule.c \
    319 		Modules/_weakref.c \
    320 		Modules/xxsubtype.c \
    321 		Modules/zipimport.c)
    322 SRC.PARSE1=	$(addprefix $(TOP), \
    323 		Parser/acceler.c \
    324 		Parser/grammar1.c \
    325 		Parser/listnode.c \
    326 		Parser/node.c \
    327 		Parser/parser.c \
    328 		Parser/parsetok.c \
    329 		Parser/bitset.c \
    330 		Parser/metagrammar.c)
    331 SRC.PARSE2=	$(addprefix $(TOP), \
    332 		Parser/tokenizer.c \
    333 		Parser/myreadline.c)
    334 SRC.PARSER=	$(SRC.PARSE1) \
    335 		$(SRC.PARSE2)
    336 SRC.PYTHON=	$(addprefix $(TOP), \
    337 		Python/Python-ast.c \
    338 		Python/asdl.c \
    339 		Python/ast.c \
    340 		Python/bltinmodule.c \
    341 		Python/exceptions.c \
    342 		Python/ceval.c \
    343 		Python/compile.c \
    344 		Python/codecs.c \
    345 		Python/errors.c \
    346 		Python/formatter_string.c \
    347 		Python/formatter_unicode.c \
    348 		Python/frozen.c \
    349 		Python/frozenmain.c \
    350 		Python/future.c \
    351 		Python/getargs.c \
    352 		Python/getcompiler.c \
    353 		Python/getcopyright.c \
    354 		Python/getplatform.c \
    355 		Python/getversion.c \
    356 		Python/graminit.c \
    357 		Python/import.c \
    358 		Python/importdl.c \
    359 		Python/marshal.c \
    360 		Python/modsupport.c \
    361 		Python/mysnprintf.c \
    362 		Python/mystrtoul.c \
    363 		Python/peephole.c \
    364 		Python/pyarena.c \
    365 		Python/pyctype.c \
    366 		Python/pyfpe.c \
    367 		Python/pymath.c \
    368 		Python/pystate.c \
    369 		Python/pystrtod.c \
    370 		Python/pythonrun.c \
    371 		Python/structmember.c \
    372 		Python/symtable.c \
    373 		Python/sysmodule.c \
    374 		Python/traceback.c \
    375 		Python/getopt.c \
    376 		Python/dynload_shlib.c \
    377 		Python/thread.c \
    378 		Python/_warnings.c)
    379 SRC.OBJECT=	$(addprefix $(TOP), \
    380 		Objects/abstract.c \
    381 		Objects/boolobject.c \
    382 		Objects/bufferobject.c \
    383 		Objects/bytearrayobject.c \
    384 		Objects/bytes_methods.c \
    385 		Objects/cellobject.c \
    386 		Objects/classobject.c \
    387 		Objects/capsule.c \
    388 		Objects/cobject.c \
    389 		Objects/codeobject.c \
    390 		Objects/complexobject.c \
    391 		Objects/descrobject.c \
    392 		Objects/dictobject.c \
    393 		Objects/enumobject.c \
    394 		Objects/fileobject.c \
    395 		Objects/floatobject.c \
    396 		Objects/frameobject.c \
    397 		Objects/funcobject.c \
    398 		Objects/genobject.c \
    399 		Objects/intobject.c \
    400 		Objects/iterobject.c \
    401 		Objects/listobject.c \
    402 		Objects/longobject.c \
    403 		Objects/methodobject.c \
    404 		Objects/moduleobject.c \
    405 		Objects/object.c \
    406 		Objects/obmalloc.c \
    407 		Objects/rangeobject.c \
    408 		Objects/setobject.c \
    409 		Objects/sliceobject.c \
    410 		Objects/stringobject.c \
    411 		Objects/structseq.c \
    412 		Objects/tupleobject.c \
    413 		Objects/typeobject.c \
    414 		Objects/unicodeobject.c \
    415 		Objects/unicodectype.c \
    416 		Objects/weakrefobject.c)
    417 
    418 SRC.LIB=	$(SRC.OS2EMX) \
    419 		$(SRC.MAIN) \
    420 		$(SRC.PARSER) \
    421 		$(SRC.OBJECT) \
    422 		$(SRC.PYTHON) \
    423 		$(SRC.MODULES)
    424 OBJ.LIB=	$(addprefix $(OUT),$(notdir $(SRC.LIB:.c=$O)))
    425 
    426 SRC.PGEN=	$(SRC.PARSE1) \
    427 		$(addprefix $(TOP), \
    428 		Objects/obmalloc.c) \
    429 		$(addprefix $(TOP), \
    430 		Python/mysnprintf.c) \
    431 		$(addprefix $(TOP), \
    432 		Parser/tokenizer_pgen.c \
    433 		Parser/pgenmain.c \
    434 		Parser/pgen.c \
    435 		Parser/printgrammar.c \
    436 		Parser/grammar.c \
    437 		Parser/firstsets.c) \
    438 		
    439 OBJ.PGEN=	$(addprefix $(OUT),$(notdir $(SRC.PGEN:.c=$O)))
    440 
    441 SRC.EXE=	$(TOP)Modules/python.c
    442 SRC.PMEXE=	pythonpm.c
    443 
    444 # Python modules to be dynamically loaded that:
    445 #   1) have only single source file and require no extra libs
    446 #   2) use the standard module naming convention
    447 #      (the 'module' in ?????module.c is assumed)
    448 # - these can be built with implicit rules
    449 EASYEXTMODULES=	fpectl \
    450 		fpetest \
    451 		parser \
    452 		pwd \
    453 		select 
    454 
    455 # Python modules to be dynamically loaded that need explicit build rules
    456 #  (either multiple source files and/or non-standard module naming)
    457 #  (NOTE: use shortened names for modules affected by 8 char name limit)
    458 HARDEXTMODULES=	_hotshot \
    459 		_socket \
    460 		_testcap \
    461 		unicoded
    462 
    463 # Python modules that are used as libraries and therefore must use
    464 # a .DLL extension
    465 LIBEXTMODULES=
    466 
    467 # Python external ($(MODULE.EXT)) modules - can be EASY or HARD
    468 ifeq ($(HAVE_ZLIB),yes)
    469   HARDEXTMODULES+=	zlib
    470 endif
    471 ifeq ($(HAVE_UFC),yes)
    472   HARDEXTMODULES+=	crypt
    473 endif
    474 ifeq ($(HAVE_TCLTK),yes)
    475   HARDEXTMODULES+=	_tkinter
    476   CFLAGS+=		-DHAS_DIRENT -I/TclTk80/include
    477   TK_LIBS+=		-L/TclTk80/lib -ltcl80 -ltk80
    478 endif
    479 ifeq ($(HAVE_GREADLINE),yes)
    480   HARDEXTMODULES+=	readline
    481 endif
    482 ifeq ($(HAVE_BSDDB),yes)
    483   HARDEXTMODULES+=	bsddb185
    484 endif
    485 ifeq ($(HAVE_NCURSES),yes)
    486   LIBEXTMODULES+=	_curses
    487   HARDEXTMODULES+=	_curses_
    488 endif
    489 ifeq ($(HAVE_GDBM),yes)
    490   HARDEXTMODULES+=	gdbm dbm
    491 endif
    492 ifeq ($(HAVE_BZ2),yes)
    493   HARDEXTMODULES+=	bz2
    494 endif
    495 ifeq ($(HAVE_OPENSSL),yes)
    496   HARDEXTMODULES+=	_ssl
    497 endif
    498 
    499 # Expat is now distributed with the Python source
    500 HARDEXTMODULES+=	pyexpat
    501 EXPAT.INC=	-I../../Modules/expat
    502 EXPAT.DEF=	-DHAVE_EXPAT_H -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 \
    503 		-DXML_CONTENT_BYTES=1024 -DHAVE_MEMMOVE=1 -DHAVE_BCOPY=1
    504 EXPAT.SRC=	$(addprefix ../../Modules/expat/, \
    505 		xmlparse.c \
    506 		xmlrole.c \
    507 		xmltok.c)
    508 
    509 # all the external modules
    510 EXTERNDLLS=	$(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(EASYEXTMODULES)))
    511 EXTERNDLLS+=	$(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(HARDEXTMODULES)))
    512 EXTERNDLLS+=	$(addsuffix $(MODLIB.EXT),$(patsubst %module,%,$(LIBEXTMODULES)))
    513 
    514 # Targets
    515 all:  $(OUT) $(PYTHON.LIB) $(PYTHON.DEF) $(PYTHON.IMPLIB) $(PYTHON.DLL) \
    516 	python_noncore
    517 
    518 python_noncore:
    519 	make PY_DEF= $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) $(EXTERNDLLS)
    520 
    521 clean:
    522 	rm -f $(OUT)*
    523 	rm -f $(PYTHON.LIB) $(PYTHON.IMPLIB) $(PYTHON.EXEIMP) $(PYTHON.DLL) \
    524 	  $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) *$(MODULE.EXT) *.dll
    525 	find ../../Lib -name "*.py[co]" -exec rm {} ";"
    526 
    527 lx:
    528 	@echo Packing everything with lxLite...
    529 	lxlite $(PYTHON.DLL) $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE)
    530 
    531 depend: $(OUTBASE)
    532 	makedep -f $(OUTBASE)python.dep -o $(BUCK)O -p $(BUCK)\(OUT\) \
    533 	  -r -c $(INCLUDE) $(SRC.LIB) $(SRC.PGEN)
    534 
    535 $(OUT): $(OUTBASE)
    536 
    537 $(OUT) $(OUTBASE):
    538 	mkdir.exe $@
    539 
    540 $(PYTHON.LIB): $(OBJ.LIB)
    541 	rm.exe -f $@
    542 	$(AR) $(ARFLAGS) $@ $^
    543 
    544 # the Python core DLL .def file needs to have a number of non-static
    545 # symbols that aren't part of the Python C API removed (commented out)
    546 # from the DLL export list.
    547 $(PYTHON.DEF): $(PYTHON.LIB)
    548 	@echo Creating .DEF file: $@
    549 	@echo LIBRARY $(PYTHON_LIB) INITINSTANCE TERMINSTANCE >$@
    550 	@echo DESCRIPTION $(DQUOTE)Python $(PYTHON_VER) Core DLL$(DQUOTE) >>$@
    551 	@echo PROTMODE >>$@
    552 	@echo DATA MULTIPLE NONSHARED >>$@
    553 	@echo EXPORTS >>$@
    554 	$(EXPLIB) -u $(PYTHON.LIB) |\
    555 	 sed -e "/^  .init.*/s/^ /; /" \
    556 		-e "/^  .pcre_.*/s/^ /; /" \
    557 		-e "/^  .array_methods/s/^ /; /" \
    558 		-e "/^  .fast_save_leave/s/^ /; /" \
    559 		-e "/^  .dlopen/s/^ /; /" \
    560 		-e "/^  .dlsym/s/^ /; /" \
    561 		-e "/^  .dlclose/s/^ /; /" \
    562 		-e "/^  .dlerror/s/^ /; /" \
    563 		-e "/^  ._Py_re_.*/s/^ /; /" \
    564 		-e "/^  ._Py_MD5.*/s/^ /; /" >>$@
    565 
    566 $(PYTHON.IMPLIB): $(PYTHON.DEF)
    567 	$(IMPLIB) -o $@ $^
    568 
    569 $(PYTHON.EXEIMP): $(PYTHON.DEF)
    570 	$(IMPLIB) -o $@ $^
    571 
    572 $(PYTHON.DLL): $(OUT)dllentry$O $(PYTHON.LIB) $(PYTHON.DEF)
    573 
    574 # Explicit make targets for the .EXEs to be able to use LD to link
    575 # (so that fork() will work if required)
    576 
    577 $(PYTHON.EXE): $(SRC.EXE) $(PYTHON.EXEIMP) $(OUT)python.def
    578 	$(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.EXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)python.def
    579 	$(EXEOPT) -aq $(PYTHON.EXE) -h$(NFILES)
    580 
    581 $(PYTHONPM.EXE): $(SRC.PMEXE) $(PYTHON.EXEIMP) $(OUT)pythonpm.def
    582 	$(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.PMEXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)pythonpm.def
    583 	$(EXEOPT) -aq $(PYTHONPM.EXE) -h$(NFILES)
    584 
    585 $(PGEN.EXE): $(OBJ.PGEN) $(OUT)pgen.def
    586 
    587 # Explicit building instructions for those external modules that require 
    588 # awkward handling (due e.g. to non-std naming, or multiple source files)
    589 # - standard modules
    590 
    591 _hotshot$(MODULE.EXT): $(OUT)_hotshot$O $(OUT)_hotshot_m.def $(PYTHON.IMPLIB)
    592 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
    593 
    594 _socket$(MODULE.EXT): $(OUT)socketmodule$O $(OUT)_socket_m.def $(PYTHON.IMPLIB)
    595 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
    596 
    597 # _testcapi needs to be renamed to be useful
    598 _testcapi$(MODULE.EXT): $(OUT)_testcapimodule$O $(OUT)_testcapi_m.def $(PYTHON.IMPLIB)
    599 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
    600 
    601 _testcap$(MODULE.EXT): _testcapi$(MODULE.EXT)
    602 	cp $^ $@
    603 
    604 # unicodedata needs to be renamed to be useful
    605 unicodedata$(MODULE.EXT): $(OUT)unicodedata$O $(OUT)unicodedata_m.def $(PYTHON.IMPLIB)
    606 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(MODULE_LIBS)
    607 
    608 unicoded$(MODULE.EXT): unicodedata$(MODULE.EXT)
    609 	cp $^ $@
    610 
    611 # - optional modules (requiring other software to be installed)
    612 bsddb185$(MODULE.EXT): $(OUT)bsddbmodule$O $(OUT)bsddb185_m.def $(PYTHON.IMPLIB)
    613 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -ldb $(LIBS)
    614 
    615 crypt$(MODULE.EXT): $(OUT)cryptmodule$O $(OUT)crypt_m.def $(PYTHON.IMPLIB)
    616 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -lufc $(LIBS)
    617 
    618 # The _curses_panel module requires a couple of ncurses library entry
    619 # points, which are best exposed as exports from the _curses module DLL
    620 $(OUT)_curses_m.def:
    621 	@echo Creating .DEF file: $@
    622 	@echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
    623 	@echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODLIB.EXT))$(DQUOTE) >>$@
    624 	@echo DATA MULTIPLE NONSHARED >>$@
    625 	@echo EXPORTS >>$@
    626 	@echo 	init_curses >>$@
    627 	@echo 	wnoutrefresh >>$@
    628 	@echo 	_nc_panelhook >>$@
    629 	@echo 	is_linetouched >>$@
    630 	@echo 	mvwin >>$@
    631 	@echo 	stdscr >>$@
    632 	@echo 	wtouchln >>$@
    633 
    634 $(OUT)_curses_panel_m.def:
    635 	@echo Creating .DEF file: $@
    636 	@echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
    637 	@echo DESCRIPTION $(DQUOTE)Python standard module $(notdir $*)$(DQUOTE) >>$@
    638 	@echo DATA MULTIPLE NONSHARED >>$@
    639 	@echo IMPORTS >>$@
    640 	@echo 	_curses.wnoutrefresh >>$@
    641 	@echo 	_curses._nc_panelhook >>$@
    642 	@echo 	_curses.is_linetouched >>$@
    643 	@echo 	_curses.mvwin >>$@
    644 	@echo 	_curses.stdscr >>$@
    645 	@echo 	_curses.wtouchln >>$@
    646 	@echo EXPORTS >>$@
    647 	@echo 	init_curses_panel >>$@
    648 
    649 _curses$(MODLIB.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB)
    650 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses
    651 
    652 # curses_panel needs to be renamed to be useful
    653 _curses_panel$(MODULE.EXT): $(OUT)_curses_panel$O $(OUT)_curses_panel_m.def $(PYTHON.IMPLIB)
    654 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lpanel
    655 
    656 _curses_$(MODULE.EXT): _curses_panel$(MODULE.EXT)
    657 	cp $^ $@
    658 
    659 dbm$(MODULE.EXT): $(OUT)dbmmodule$O $(OUT)dbm_m.def $(PYTHON.IMPLIB)
    660 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
    661 
    662 gdbm$(MODULE.EXT): $(OUT)gdbmmodule$O $(OUT)gdbm_m.def $(PYTHON.IMPLIB)
    663 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
    664 
    665 
    666 # Expat is now distributed with Python, so use the included version
    667 $(OUT)pyexpat$O:	../../Modules/pyexpat.c
    668 	$(CC) $(CFLAGS) $(EXPAT.INC) -c -o $@ $^
    669 $(OUT)xmlparse$O:	../../Modules/expat/xmlparse.c
    670 	$(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
    671 $(OUT)xmlrole$O:	../../Modules/expat/xmlrole.c
    672 	$(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
    673 $(OUT)xmltok$O:	../../Modules/expat/xmltok.c
    674 	$(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
    675 pyexpat$(MODULE.EXT): $(OUT)pyexpat$O $(OUT)xmlparse$O $(OUT)xmlrole$O \
    676 		$(OUT)xmltok$O $(OUT)pyexpat_m.def $(PYTHON.IMPLIB)
    677 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
    678 
    679 readline$(MODULE.EXT): $(OUT)readline$O $(OUT)readline_m.def $(PYTHON.IMPLIB)
    680 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lreadline -lncurses
    681 
    682 #_tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O $(OUT)tkappinit$O
    683 _tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O \
    684 		$(OUT)_tkinter_m.def $(PYTHON.IMPLIB)
    685 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(TK_LIBS)
    686 
    687 zlib$(MODULE.EXT): $(OUT)zlibmodule$O $(OUT)zlib_m.def $(PYTHON.IMPLIB)
    688 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lz
    689 
    690 bz2$(MODULE.EXT): $(OUT)bz2module$O $(OUT)bz2_m.def $(PYTHON.IMPLIB)
    691 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lbz2
    692 
    693 _ssl$(MODULE.EXT): $(OUT)_ssl$O $(OUT)_ssl_m.def $(PYTHON.IMPLIB)
    694 	$(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lssl -lcrypto
    695 
    696 # the test target
    697 test:
    698 	-find ../../Lib -name "*.py[co]" -exec rm {} ";"
    699 	-./python -E -tt ../../lib/test/regrtest.py -l -u "network"
    700 	./python -E -tt ../../lib/test/regrtest.py -l -u "network"
    701 
    702 -include $(OUTBASE)python.dep
    703