/PC/os2emx/Makefile

http://unladen-swallow.googlecode.com/ · Makefile · 701 lines · 489 code · 86 blank · 126 comment · 9 complexity · ebf0a377d8e53a075873589d3195c685 MD5 · raw file

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