blob: 10dc9bd629ed376cbd9ec3360d318d6ed8677510 [file] [log] [blame]
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +00001#####################==================----------------
Andrew MacIntyre41d97d62002-02-17 05:23:30 +00002#
3# Top-Level Makefile for Building Python 2.3 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.3
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 Python23.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# Python23.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#
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +000024#####################==================----------------
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000025
26# === Compilation mode: debug or release ===
27MODE= optimize
28#MODE= debug
29# === Assert() enabled ===
30#ASSERTIONS=no
31ASSERTIONS=yes
32
33# === Optional modules ===
34# Do you have the InfoZip compression library installed?
35ZLIB= no
36# Do you have the Ultra Fast Crypt (UFC) library installed?
37UFC= no
38# Do you have the Tcl/Tk library installed?
39TCLTK= no
40# Do you have the GNU multiprecision library installed?
41GMPZ= no
42# Do you have the GNU readline library installed?
43# NOTE: I'm using a modified version of Kai Uwe Rommel's port that
44# - is compiled with multithreading enabled
45# - is linked statically
46# I have had no success trying to use a DLL version, even with
47# the multithreading switch.
Andrew MacIntyre3c5bfbe2003-01-02 12:38:39 +000048GREADLINE= no
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000049# Do you have the BSD DB library (v1.85) as included in the EMXBSD package?
50# NOTE: this library needs to be recompiled with a structure member
51# renamed to avoid problems with the multithreaded errno support
52# (there is a structure member called errno, used for shadowing the
53# real errno, which conflicts with the errno redefinition of -Zmt)
54BSDDB= no
55# Do you have the ncurses library installed? EMX's BSD curses aren't enough!
56CURSES= no
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000057# Do you have the GDBM library installed?
58GDBM= no
Andrew MacIntyre978697b2002-12-31 11:18:08 +000059# Do you have the BZ2 compression library installed?
60BZ2= no
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000061
62# === The Tools ===
63CC= gcc
64CFLAGS= -Zmt -Wall $(INCLUDE)
65CFLAGS.LIB= $(CFLAGS)
66LD= gcc
67LDFLAGS= -Zmt -Zcrtdll -L. -lgcc
68LDFLAGS.EXE= $(LDFLAGS)
69LDFLAGS.DLL= $(LDFLAGS) -Zdll
70LDFLAGS.A= $(LDFLAGS) $(LIBS)
71ARFLAGS= crs
72IMPLIB= emximp
73EXPLIB= emxexp
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +000074EXEOPT= emxbind
75
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000076
77# adjust C compiler settings based on build options
78ifeq ($(MODE),debug)
79 CFLAGS+= -g -O
80 LDFLAGS+= -g
81else
82 CFLAGS+= -s -O2
83 LDFLAGS+= -s
84endif
85ifeq ($(ASSERTIONS),no)
86 CFLAGS+= -DNDEBUG
87endif
88
89# We're using the OMF format since EMX's ld has a obscure bug
90# because of which it sometimes fails to build relocations
91# in .data segment that point to another .data locations
92# (except for the final linking if the .EXEs)
93OMF= yes
94
95# if fork() support is required, the main executable must be linked with ld
96EXEOMF= no
97
98# File extensions
99MODULE.EXT= .pyd
100ifeq ($(OMF),yes)
101 O= .obj
102 A= .lib
103 AR= emxomfar
104 CFLAGS+= -Zomf
105 LDFLAGS+= -Zomf
106 ifeq ($(MODE),debug)
107 ARFLAGS= -p64 crs
108 else
109 ARFLAGS= -p32 crs
110 endif
111else
112 O= .o
113 A= .a
114 AR= ar
115endif
116
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000117# EMX's default number of file handles is 40, which is sometimes insufficient
118# (the tempfile regression test tries to create 100 temporary files)
119NFILES=250
120
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000121# Source file paths
122SRCPATH=.;../../Python;../../Parser;../../Objects;../../Include;../../Modules
123# Python contains the central core, containing the builtins and interpreter.
124# Parser contains Python's Internal Parser and
125# Standalone Parser Generator Program (Shares Some of Python's Modules)
126# Objects contains Python Object Types
127# Modules contains extension Modules (Built-In or as Separate DLLs)
128
129# Unix shells tend to use "$" as delimiter for variable names.
130# Test for this behaviour and set $(BUCK) variable correspondigly ...
131__TMP__:=$(shell echo $$$$)
132ifeq ($(__TMP__),$$$$)
133 BUCK= $$
134 BRO= (
135 BRC= )
136else
137 BUCK= \$$
138 BRO= \(
139 BRC= \)
140endif
141# Compute the "double quote" variable
142__TMP__:=$(shell echo "")
143ifeq ($(__TMP__),"")
144 DQUOTE= "
145else
146 DQUOTE= \"
147endif
148
149# Include paths
150#INCLUDE= -I$(subst ;, -I, $(SRCPATH))
151INCLUDE= -I. -I../../Include
152
153# Path to search for .c files
154vpath %.c .;..;$(SRCPATH)
155
156# Top of the package tree
157TOP= ../../
158
159# Directory for output files
160OUTBASE= out/
161OUT= $(OUTBASE)$(MODE)/
162
163# Additional libraries
164LIBS= -lsocket
165
166# Utility macro: replacement for $^
167^^= $(filter-out %$A,$^)
168# Use $(L^) to link with all libraries specified as dependencies
169L^= $(addprefix -l,$(basename $(notdir $(filter %$A,$+))))
170
171# Build rules
172$(OUT)%$O: %.c
173 $(CC) $(CFLAGS.LIB) -c $< -o $@
174
175%.a:
176 $(LD) $(LDFLAGS.A) -o $@ $(^^) $(L^)
177
178%.dll:
179 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
180
181%.pyd: $(OUT)%module$O $(OUT)%_m.def
182 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(PYTHON.IMPLIB) $(LIBS)
183
184%.exe:
185 $(LD) $(LDFLAGS.EXE) -o $@ $(^^) $(L^)
186
187%_m.def:
188 @echo Creating .DEF file: $@
189 @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
190 ifeq ($(DESCRIPTION.$(notdir $*)$(MODULE.EXT)),)
191 @echo DESCRIPTION $(DQUOTE)Python standard module $(notdir $*)$(DQUOTE) >>$@
192 else
193 @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@
194 endif
195 @echo DATA MULTIPLE NONSHARED >>$@
196 @echo EXPORTS >>$@
197 @echo init$(notdir $*) >>$@
198
199%.def:
200 @echo Creating .DEF file: $@
201 @echo NAME $(notdir $*) $(EXETYPE.$(notdir $*).exe) >$@
202 @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*).exe)$(DQUOTE) >>$@
203 @echo STACKSIZE 1048576 >>$@
204
205# Output file names
206PYTHON_VER= 2.3
207PYTHON_LIB= python23
208PYTHON.LIB= $(PYTHON_LIB)_s$A
209PYTHON.IMPLIB= $(PYTHON_LIB)$A
210ifeq ($(EXEOMF),yes)
211 PYTHON.EXEIMP= $(PYTHON.IMPLIB)
212 LDMODE.EXE= -Zomf
213else
214 PYTHON.EXEIMP= $(PYTHON_LIB).a
215 LDMODE.EXE =
216endif
217PYTHON.DLL= $(PYTHON_LIB).dll
218PYTHON.DEF= $(PYTHON_LIB).def
219PYTHON.EXE= python.exe
220PYTHONPM.EXE= pythonpm.exe
221PGEN.EXE= pgen.exe
222LIBRARY= $(PYTHON.LIB)
223LD_LIBRARY= $(PYTHON.IMPLIB)
224
225# Additional executable parameters
226EXETYPE.$(PYTHON.EXE)= WINDOWCOMPAT
227EXETYPE.$(PYTHONPM.EXE)= WINDOWAPI
228EXETYPE.$(PGEN.EXE)= WINDOWCOMPAT
229DESCRIPTION.$(PYTHON.EXE)= Python object-oriented programming language interpreter for OS/2
230DESCRIPTION.$(PYTHONPM.EXE)= $(DESCRIPTION.$(PYTHON.EXE))
231DESCRIPTION.$(PGEN.EXE)= Python object-oriented programming language parser generator for OS/2
232
233# Module descriptions
234DESCRIPTION.zlib$(MODULE.EXT)= Python Extension DLL for accessing the InfoZip compression library
235DESCRIPTION.crypt$(MODULE.EXT)= Python Extension DLL implementing the crypt$(BRO)$(BRC) function
236DESCRIPTION._tkinter$(MODULE.EXT)= Python Extension DLL for access to Tcl/Tk Environment
237DESCRIPTION.mpz$(MODULE.EXT)= Python Extension DLL for access to GNU multi-precision library
238DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library
Andrew MacIntyree7a8cad2002-12-04 12:37:17 +0000239DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000240DESCRIPTION._curses$(MODULE.EXT)= Python Extension DLL for access to ncurses library
241DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000242DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000243
244# Source files
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000245SRC.OS2EMX= config.c dlfcn.c getpathp.c
246SRC.MAIN= $(addprefix $(TOP), \
247 Modules/getbuildinfo.c \
248 Modules/main.c)
249SRC.MODULES= $(addprefix $(TOP), \
250 Modules/gcmodule.c \
251 Modules/signalmodule.c \
252 Modules/posixmodule.c \
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000253 Modules/threadmodule.c)
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000254SRC.PARSE1= $(addprefix $(TOP), \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000255 Parser/acceler.c \
256 Parser/grammar1.c \
257 Parser/listnode.c \
258 Parser/node.c \
259 Parser/parser.c \
260 Parser/parsetok.c \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000261 Parser/bitset.c \
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000262 Parser/metagrammar.c)
263SRC.PARSE2= $(addprefix $(TOP), \
264 Parser/tokenizer.c \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000265 Parser/myreadline.c)
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000266SRC.PARSER= $(SRC.PARSE1) \
267 $(SRC.PARSE2)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000268SRC.PYTHON= $(addprefix $(TOP), \
269 Python/bltinmodule.c \
270 Python/exceptions.c \
271 Python/ceval.c \
272 Python/compile.c \
273 Python/codecs.c \
274 Python/errors.c \
275 Python/frozen.c \
276 Python/frozenmain.c \
277 Python/future.c \
278 Python/getargs.c \
279 Python/getcompiler.c \
280 Python/getcopyright.c \
281 Python/getmtime.c \
282 Python/getplatform.c \
283 Python/getversion.c \
284 Python/graminit.c \
285 Python/import.c \
286 Python/importdl.c \
287 Python/marshal.c \
288 Python/modsupport.c \
289 Python/mysnprintf.c \
290 Python/mystrtoul.c \
291 Python/pyfpe.c \
292 Python/pystate.c \
293 Python/pythonrun.c \
294 Python/structmember.c \
295 Python/symtable.c \
296 Python/sysmodule.c \
297 Python/traceback.c \
298 Python/getopt.c \
299 Python/dynload_shlib.c \
300 Python/thread.c)
301SRC.OBJECT= $(addprefix $(TOP), \
302 Objects/abstract.c \
Andrew MacIntyre6c655312002-04-15 12:09:45 +0000303 Objects/boolobject.c \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000304 Objects/bufferobject.c \
305 Objects/cellobject.c \
306 Objects/classobject.c \
307 Objects/cobject.c \
308 Objects/complexobject.c \
309 Objects/descrobject.c \
310 Objects/dictobject.c \
Andrew MacIntyre07c639f2002-04-30 13:06:32 +0000311 Objects/enumobject.c \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000312 Objects/fileobject.c \
313 Objects/floatobject.c \
314 Objects/frameobject.c \
315 Objects/funcobject.c \
316 Objects/intobject.c \
317 Objects/iterobject.c \
318 Objects/listobject.c \
319 Objects/longobject.c \
320 Objects/methodobject.c \
321 Objects/moduleobject.c \
322 Objects/object.c \
Andrew MacIntyre6c655312002-04-15 12:09:45 +0000323 Objects/obmalloc.c \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000324 Objects/rangeobject.c \
325 Objects/sliceobject.c \
326 Objects/stringobject.c \
327 Objects/structseq.c \
328 Objects/tupleobject.c \
329 Objects/typeobject.c \
330 Objects/unicodeobject.c \
331 Objects/unicodectype.c \
332 Objects/weakrefobject.c)
333
334SRC.LIB= $(SRC.OS2EMX) \
335 $(SRC.MAIN) \
336 $(SRC.PARSER) \
337 $(SRC.OBJECT) \
338 $(SRC.PYTHON) \
339 $(SRC.MODULES)
340OBJ.LIB= $(addprefix $(OUT),$(notdir $(SRC.LIB:.c=$O)))
341
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000342SRC.PGEN= $(SRC.PARSE1) \
343 $(addprefix $(TOP), \
344 Objects/obmalloc.c) \
345 $(addprefix $(TOP), \
346 Python/mysnprintf.c) \
347 $(addprefix $(TOP), \
348 Parser/tokenizer_pgen.c \
349 Parser/pgenmain.c \
350 Parser/pgen.c \
351 Parser/printgrammar.c \
352 Parser/grammar.c \
353 Parser/firstsets.c) \
354
355OBJ.PGEN= $(addprefix $(OUT),$(notdir $(SRC.PGEN:.c=$O)))
356
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000357SRC.EXE= $(TOP)Modules/python.c
358SRC.PMEXE= pythonpm.c
359
360# Python modules to be dynamically loaded that:
361# 1) have only single source file and require no extra libs
362# 2) use the standard module naming convention
363# (the 'module' in ?????module.c is assumed)
364# - these can be built with implicit rules
365EASYEXTMODULES= array \
366 cmath \
367 _codecs \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000368 datetime \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000369 dl \
370 errno \
371 fcntl \
372 fpectl \
373 fpetest \
374 _locale \
375 math \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000376 parser \
377 pwd \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000378 _random \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000379 rgbimg \
380 rotor \
381 select \
382 sha \
383 strop \
384 struct \
385 time \
386 timing
387
388# Python modules to be dynamically loaded that need explicit build rules
389# (either multiple source files and/or non-standard module naming)
390# (NOTE: use shortened names for modules affected by 8 char name limit)
391HARDEXTMODULES= binascii \
392 cPickle \
393 cStringI \
394 _hotshot \
395 imageop \
Andrew MacIntyre4f28c4d2003-02-19 12:42:36 +0000396 itertool \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000397 md5 \
398 operator \
399 pcre \
400 regex \
401 _socket \
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000402 _sre \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000403 _symtabl \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000404 termios \
405 _testcap \
406 unicoded \
407 _weakref \
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000408 xreadlin \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000409 xxsubtyp \
410 zipimpor
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000411
412# Python external ($(MODULE.EXT)) modules - can be EASY or HARD
413ifeq ($(ZLIB),yes)
414 HARDEXTMODULES+= zlib
415endif
416ifeq ($(UFC),yes)
417 HARDEXTMODULES+= crypt
418endif
419ifeq ($(TCLTK),yes)
420 HARDEXTMODULES+= _tkinter
421 CFLAGS+= -DHAS_DIRENT -I/TclTk80/include
422 TK_LIBS+= -L/TclTk80/lib -ltcl80 -ltk80
423endif
424ifeq ($(GMPZ),yes)
425 HARDEXTMODULES+= mpz
426endif
427ifeq ($(GREADLINE),yes)
428 HARDEXTMODULES+= readline
429endif
430ifeq ($(BSDDB),yes)
Andrew MacIntyree7a8cad2002-12-04 12:37:17 +0000431 HARDEXTMODULES+= bsddb185
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000432endif
433ifeq ($(CURSES),yes)
434 HARDEXTMODULES+= _curses _curses_
435endif
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000436ifeq ($(GDBM),yes)
437 HARDEXTMODULES+= gdbm dbm
438endif
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000439ifeq ($(BZ2),yes)
440 HARDEXTMODULES+= bz2
441endif
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000442
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000443# Expat is now distributed with the Python source
444HARDEXTMODULES+= pyexpat
445EXPAT.INC= -I../../Modules/expat
446EXPAT.DEF= -DHAVE_EXPAT_H -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 \
447 -DXML_CONTENT_BYTES=1024
448EXPAT.SRC= $(addprefix ../../Modules/expat/, \
449 xmlparse.c \
450 xmlrole.c \
451 xmltok.c)
452
453# all the external modules
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000454EXTERNDLLS= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(EASYEXTMODULES)))
455EXTERNDLLS+= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(HARDEXTMODULES)))
456
457# Targets
458all: $(OUT) $(PYTHON.LIB) $(PYTHON.DEF) $(PYTHON.IMPLIB) $(PYTHON.DLL) \
459 $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) $(EXTERNDLLS)
460
461clean:
462 rm -f $(OUT)*
463 rm -f $(PYTHON.LIB) $(PYTHON.IMPLIB) $(PYTHON.EXEIMP) $(PYTHON.DLL) \
464 $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) *$(MODULE.EXT)
465
466lx:
467 @echo Packing everything with lxLite...
468 lxlite $(PYTHON.DLL) $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE)
469
470depend: $(OUTBASE)
471 makedep -f $(OUTBASE)python.dep -o $(BUCK)O -p $(BUCK)\(OUT\) \
472 -r -c $(INCLUDE) $(SRC.LIB) $(SRC.PGEN)
473
474$(OUT): $(OUTBASE)
475
476$(OUT) $(OUTBASE):
477 mkdir.exe $@
478
479$(PYTHON.LIB): $(OBJ.LIB)
480 rm.exe -f $@
481 $(AR) $(ARFLAGS) $@ $^
482
483$(PYTHON.DEF): $(PYTHON.LIB)
484 @echo Creating .DEF file: $@
485 @echo LIBRARY $(PYTHON_LIB) INITINSTANCE TERMINSTANCE >$@
486 @echo DESCRIPTION $(DQUOTE)Python $(PYTHON_VER) Core DLL$(DQUOTE) >>$@
487 @echo PROTMODE >>$@
488 @echo DATA MULTIPLE NONSHARED >>$@
489 @echo EXPORTS >>$@
490 $(EXPLIB) -u $(PYTHON.LIB) >>$@
491
492$(PYTHON.IMPLIB): $(PYTHON.DEF)
493 $(IMPLIB) -o $@ $^
494
495$(PYTHON.EXEIMP): $(PYTHON.DEF)
496 $(IMPLIB) -o $@ $^
497
498$(PYTHON.DLL): $(OUT)dllentry$O $(PYTHON.LIB) $(PYTHON.DEF)
499
500# Explicit make targets for the .EXEs to be able to use LD to link
501# (so that fork() will work if required)
502
503$(PYTHON.EXE): $(SRC.EXE) $(PYTHON.EXEIMP) $(OUT)python.def
504 $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.EXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)python.def
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000505 $(EXEOPT) -aq $(PYTHON.EXE) -h$(NFILES)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000506
507$(PYTHONPM.EXE): $(SRC.PMEXE) $(PYTHON.EXEIMP) $(OUT)pythonpm.def
508 $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.PMEXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)pythonpm.def
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000509 $(EXEOPT) -aq $(PYTHONPM.EXE) -h$(NFILES)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000510
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000511$(PGEN.EXE): $(OBJ.PGEN) $(OUT)pgen.def
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000512
513# Explicit building instructions for those external modules that require
514# awkward handling (due e.g. to non-std naming, or multiple source files)
515# - standard modules
516binascii$(MODULE.EXT): $(OUT)binascii$O $(OUT)binascii_m.def $(PYTHON.IMPLIB)
517 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
518
519cPickle$(MODULE.EXT): $(OUT)cPickle$O $(OUT)cPickle_m.def $(PYTHON.IMPLIB)
520 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
521
522# cStringIO needs to be renamed to be useful (8 char DLL name limit)
523cStringIO$(MODULE.EXT): $(OUT)cStringIO$O $(OUT)cStringIO_m.def $(PYTHON.IMPLIB)
524 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
525
526cStringI$(MODULE.EXT): cStringIO$(MODULE.EXT)
527 cp $^ $@
528
529_hotshot$(MODULE.EXT): $(OUT)_hotshot$O $(OUT)_hotshot_m.def $(PYTHON.IMPLIB)
530 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
531
532imageop$(MODULE.EXT): $(OUT)imageop$O $(OUT)imageop_m.def $(PYTHON.IMPLIB)
533 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
534
Andrew MacIntyre4f28c4d2003-02-19 12:42:36 +0000535# itertools needs to be renamed to be useful
536itertools$(MODULE.EXT): $(OUT)itertoolsmodule$O $(OUT)itertools_m.def $(PYTHON.IMPLIB)
537 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
538
539itertool$(MODULE.EXT): itertools$(MODULE.EXT)
540 cp $^ $@
541
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000542md5$(MODULE.EXT): $(OUT)md5module$O $(OUT)md5c$O $(OUT)md5_m.def $(PYTHON.IMPLIB)
543 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
544
545operator$(MODULE.EXT): $(OUT)operator$O $(OUT)operator_m.def $(PYTHON.IMPLIB)
546 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
547
548pcre$(MODULE.EXT): $(OUT)pcremodule$O $(OUT)pypcre$O $(OUT)pcre_m.def $(PYTHON.IMPLIB)
549 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
550
551regex$(MODULE.EXT): $(OUT)regexmodule$O $(OUT)regexpr$O $(OUT)regex_m.def $(PYTHON.IMPLIB)
552 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
553
554_socket$(MODULE.EXT): $(OUT)socketmodule$O $(OUT)_socket_m.def $(PYTHON.IMPLIB)
555 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
556
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000557_sre$(MODULE.EXT): $(OUT)_sre$O $(OUT)_sre_m.def $(PYTHON.IMPLIB)
558 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
559
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000560# _symtable needs to be renamed to be useful
561_symtable$(MODULE.EXT): $(OUT)symtablemodule$O $(OUT)_symtable_m.def $(PYTHON.IMPLIB)
562 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
563
564_symtabl$(MODULE.EXT): _symtable$(MODULE.EXT)
565 cp $^ $@
566
567termios$(MODULE.EXT): $(OUT)termios$O $(OUT)termios_m.def $(PYTHON.IMPLIB)
568 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
569
570# _testcapi needs to be renamed to be useful
571_testcapi$(MODULE.EXT): $(OUT)_testcapimodule$O $(OUT)_testcapi_m.def $(PYTHON.IMPLIB)
572 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
573
574_testcap$(MODULE.EXT): _testcapi$(MODULE.EXT)
575 cp $^ $@
576
577# unicodedata needs to be renamed to be useful
578unicodedata$(MODULE.EXT): $(OUT)unicodedata$O $(OUT)unicodedata_m.def $(PYTHON.IMPLIB)
579 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(MODULE_LIBS)
580
581unicoded$(MODULE.EXT): unicodedata$(MODULE.EXT)
582 cp $^ $@
583
584_weakref$(MODULE.EXT): $(OUT)_weakref$O $(OUT)_weakref_m.def $(PYTHON.IMPLIB)
585 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
586
587# xreadlines needs to be renamed to be useful
588xreadlines$(MODULE.EXT): $(OUT)xreadlinesmodule$O $(OUT)xreadlines_m.def $(PYTHON.IMPLIB)
589 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
590
591xreadlin$(MODULE.EXT): xreadlines$(MODULE.EXT)
592 cp $^ $@
593
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000594# xxsubtype needs to be renamed to be useful
595xxsubtype$(MODULE.EXT): $(OUT)xxsubtype$O $(OUT)xxsubtype_m.def $(PYTHON.IMPLIB)
596 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
597
598xxsubtyp$(MODULE.EXT): xxsubtype$(MODULE.EXT)
599 cp $^ $@
600
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000601# zipimport needs to be renamed to be useful
602zipimport$(MODULE.EXT): $(OUT)zipimport$O $(OUT)zipimport_m.def $(PYTHON.IMPLIB)
603 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
604
605zipimpor$(MODULE.EXT): zipimport$(MODULE.EXT)
606 cp $^ $@
607
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000608# - optional modules (requiring other software to be installed)
Andrew MacIntyree7a8cad2002-12-04 12:37:17 +0000609bsddb185$(MODULE.EXT): $(OUT)bsddbmodule$O $(OUT)bsddb185_m.def $(PYTHON.IMPLIB)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000610 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -ldb $(LIBS)
611
612crypt$(MODULE.EXT): $(OUT)cryptmodule$O $(OUT)crypt_m.def $(PYTHON.IMPLIB)
613 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -lufc $(LIBS)
614
615# The _curses_panel module requires a couple of ncurses library entry
616# points, which are best exposed as exports from the _curses module DLL
617$(OUT)_curses_m.def:
618 @echo Creating .DEF file: $@
619 @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
620 @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@
621 @echo DATA MULTIPLE NONSHARED >>$@
622 @echo EXPORTS >>$@
623 @echo init_curses >>$@
624 @echo wnoutrefresh >>$@
625 @echo _nc_panelhook >>$@
626 @echo is_linetouched >>$@
627 @echo mvwin >>$@
628 @echo stdscr >>$@
629 @echo wtouchln >>$@
630
631$(OUT)_curses_panel_m.def:
632 @echo Creating .DEF file: $@
633 @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
634 @echo DESCRIPTION $(DQUOTE)Python standard module $(notdir $*)$(DQUOTE) >>$@
635 @echo DATA MULTIPLE NONSHARED >>$@
636 @echo IMPORTS >>$@
637 @echo _curses.wnoutrefresh >>$@
638 @echo _curses._nc_panelhook >>$@
639 @echo _curses.is_linetouched >>$@
640 @echo _curses.mvwin >>$@
641 @echo _curses.stdscr >>$@
642 @echo _curses.wtouchln >>$@
643 @echo EXPORTS >>$@
644 @echo init_curses_panel >>$@
645
646_curses$(MODULE.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB)
647 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses
648
649# curses_panel needs to be renamed to be useful
650_curses_panel$(MODULE.EXT): $(OUT)_curses_panel$O $(OUT)_curses_panel_m.def $(PYTHON.IMPLIB)
651 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lpanel
652
653_curses_$(MODULE.EXT): _curses_panel$(MODULE.EXT)
654 cp $^ $@
655
656dbm$(MODULE.EXT): $(OUT)dbmmodule$O $(OUT)dbm_m.def $(PYTHON.IMPLIB)
657 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
658
659gdbm$(MODULE.EXT): $(OUT)gdbmmodule$O $(OUT)gdbm_m.def $(PYTHON.IMPLIB)
660 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
661
662mpz$(MODULE.EXT): $(OUT)mpzmodule$O $(OUT)mpz_m.def $(PYTHON.IMPLIB)
663 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgmp
664
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000665# Expat is now distributed with Python, so use the included version
666$(OUT)pyexpat$O: ../../Modules/pyexpat.c
667 $(CC) $(CFLAGS) $(EXPAT.INC) -c -o $@ $^
668$(OUT)xmlparse$O: ../../Modules/expat/xmlparse.c
669 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
670$(OUT)xmlrole$O: ../../Modules/expat/xmlrole.c
671 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
672$(OUT)xmltok$O: ../../Modules/expat/xmltok.c
673 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
674pyexpat$(MODULE.EXT): $(OUT)pyexpat$O $(OUT)xmlparse$O $(OUT)xmlrole$O \
675 $(OUT)xmltok$O $(OUT)pyexpat_m.def $(PYTHON.IMPLIB)
676 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000677
678readline$(MODULE.EXT): $(OUT)readline$O $(OUT)readline_m.def $(PYTHON.IMPLIB)
679 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lreadline -lncurses
680
681#_tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O $(OUT)tkappinit$O
682_tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O \
683 $(OUT)_tkinter_m.def $(PYTHON.IMPLIB)
684 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(TK_LIBS)
685
686zlib$(MODULE.EXT): $(OUT)zlibmodule$O $(OUT)zlib_m.def $(PYTHON.IMPLIB)
687 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lz
688
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000689bz2$(MODULE.EXT): $(OUT)bz2module$O $(OUT)bz2_m.def $(PYTHON.IMPLIB)
690 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lbz2
691
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000692# the test target
693test:
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000694 -find ../../Lib -name "*.py[co]" -exec rm {} ";"
695 -./python -E -tt ../../lib/test/regrtest.py -l -u "network"
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000696 ./python -E -tt ../../lib/test/regrtest.py -l -u "network"
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000697
698-include $(OUTBASE)python.dep