blob: da7a2ef301180fe7d30c324449580037b6e1d3e9 [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 MacIntyre978697b2002-12-31 11:18:08 +000048GREADLINE= yes
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 \
396 md5 \
397 operator \
398 pcre \
399 regex \
400 _socket \
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000401 _sre \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000402 _symtabl \
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000403 termios \
404 _testcap \
405 unicoded \
406 _weakref \
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000407 xreadlin \
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000408 xxsubtyp \
409 zipimpor
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000410
411# Python external ($(MODULE.EXT)) modules - can be EASY or HARD
412ifeq ($(ZLIB),yes)
413 HARDEXTMODULES+= zlib
414endif
415ifeq ($(UFC),yes)
416 HARDEXTMODULES+= crypt
417endif
418ifeq ($(TCLTK),yes)
419 HARDEXTMODULES+= _tkinter
420 CFLAGS+= -DHAS_DIRENT -I/TclTk80/include
421 TK_LIBS+= -L/TclTk80/lib -ltcl80 -ltk80
422endif
423ifeq ($(GMPZ),yes)
424 HARDEXTMODULES+= mpz
425endif
426ifeq ($(GREADLINE),yes)
427 HARDEXTMODULES+= readline
428endif
429ifeq ($(BSDDB),yes)
Andrew MacIntyree7a8cad2002-12-04 12:37:17 +0000430 HARDEXTMODULES+= bsddb185
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000431endif
432ifeq ($(CURSES),yes)
433 HARDEXTMODULES+= _curses _curses_
434endif
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000435ifeq ($(GDBM),yes)
436 HARDEXTMODULES+= gdbm dbm
437endif
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000438ifeq ($(BZ2),yes)
439 HARDEXTMODULES+= bz2
440endif
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000441
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000442# Expat is now distributed with the Python source
443HARDEXTMODULES+= pyexpat
444EXPAT.INC= -I../../Modules/expat
445EXPAT.DEF= -DHAVE_EXPAT_H -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 \
446 -DXML_CONTENT_BYTES=1024
447EXPAT.SRC= $(addprefix ../../Modules/expat/, \
448 xmlparse.c \
449 xmlrole.c \
450 xmltok.c)
451
452# all the external modules
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000453EXTERNDLLS= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(EASYEXTMODULES)))
454EXTERNDLLS+= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(HARDEXTMODULES)))
455
456# Targets
457all: $(OUT) $(PYTHON.LIB) $(PYTHON.DEF) $(PYTHON.IMPLIB) $(PYTHON.DLL) \
458 $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) $(EXTERNDLLS)
459
460clean:
461 rm -f $(OUT)*
462 rm -f $(PYTHON.LIB) $(PYTHON.IMPLIB) $(PYTHON.EXEIMP) $(PYTHON.DLL) \
463 $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE) *$(MODULE.EXT)
464
465lx:
466 @echo Packing everything with lxLite...
467 lxlite $(PYTHON.DLL) $(PYTHON.EXE) $(PYTHONPM.EXE) $(PGEN.EXE)
468
469depend: $(OUTBASE)
470 makedep -f $(OUTBASE)python.dep -o $(BUCK)O -p $(BUCK)\(OUT\) \
471 -r -c $(INCLUDE) $(SRC.LIB) $(SRC.PGEN)
472
473$(OUT): $(OUTBASE)
474
475$(OUT) $(OUTBASE):
476 mkdir.exe $@
477
478$(PYTHON.LIB): $(OBJ.LIB)
479 rm.exe -f $@
480 $(AR) $(ARFLAGS) $@ $^
481
482$(PYTHON.DEF): $(PYTHON.LIB)
483 @echo Creating .DEF file: $@
484 @echo LIBRARY $(PYTHON_LIB) INITINSTANCE TERMINSTANCE >$@
485 @echo DESCRIPTION $(DQUOTE)Python $(PYTHON_VER) Core DLL$(DQUOTE) >>$@
486 @echo PROTMODE >>$@
487 @echo DATA MULTIPLE NONSHARED >>$@
488 @echo EXPORTS >>$@
489 $(EXPLIB) -u $(PYTHON.LIB) >>$@
490
491$(PYTHON.IMPLIB): $(PYTHON.DEF)
492 $(IMPLIB) -o $@ $^
493
494$(PYTHON.EXEIMP): $(PYTHON.DEF)
495 $(IMPLIB) -o $@ $^
496
497$(PYTHON.DLL): $(OUT)dllentry$O $(PYTHON.LIB) $(PYTHON.DEF)
498
499# Explicit make targets for the .EXEs to be able to use LD to link
500# (so that fork() will work if required)
501
502$(PYTHON.EXE): $(SRC.EXE) $(PYTHON.EXEIMP) $(OUT)python.def
503 $(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 +0000504 $(EXEOPT) -aq $(PYTHON.EXE) -h$(NFILES)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000505
506$(PYTHONPM.EXE): $(SRC.PMEXE) $(PYTHON.EXEIMP) $(OUT)pythonpm.def
507 $(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 +0000508 $(EXEOPT) -aq $(PYTHONPM.EXE) -h$(NFILES)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000509
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000510$(PGEN.EXE): $(OBJ.PGEN) $(OUT)pgen.def
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000511
512# Explicit building instructions for those external modules that require
513# awkward handling (due e.g. to non-std naming, or multiple source files)
514# - standard modules
515binascii$(MODULE.EXT): $(OUT)binascii$O $(OUT)binascii_m.def $(PYTHON.IMPLIB)
516 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
517
518cPickle$(MODULE.EXT): $(OUT)cPickle$O $(OUT)cPickle_m.def $(PYTHON.IMPLIB)
519 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
520
521# cStringIO needs to be renamed to be useful (8 char DLL name limit)
522cStringIO$(MODULE.EXT): $(OUT)cStringIO$O $(OUT)cStringIO_m.def $(PYTHON.IMPLIB)
523 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
524
525cStringI$(MODULE.EXT): cStringIO$(MODULE.EXT)
526 cp $^ $@
527
528_hotshot$(MODULE.EXT): $(OUT)_hotshot$O $(OUT)_hotshot_m.def $(PYTHON.IMPLIB)
529 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
530
531imageop$(MODULE.EXT): $(OUT)imageop$O $(OUT)imageop_m.def $(PYTHON.IMPLIB)
532 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
533
534md5$(MODULE.EXT): $(OUT)md5module$O $(OUT)md5c$O $(OUT)md5_m.def $(PYTHON.IMPLIB)
535 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
536
537operator$(MODULE.EXT): $(OUT)operator$O $(OUT)operator_m.def $(PYTHON.IMPLIB)
538 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
539
540pcre$(MODULE.EXT): $(OUT)pcremodule$O $(OUT)pypcre$O $(OUT)pcre_m.def $(PYTHON.IMPLIB)
541 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
542
543regex$(MODULE.EXT): $(OUT)regexmodule$O $(OUT)regexpr$O $(OUT)regex_m.def $(PYTHON.IMPLIB)
544 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
545
546_socket$(MODULE.EXT): $(OUT)socketmodule$O $(OUT)_socket_m.def $(PYTHON.IMPLIB)
547 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
548
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000549_sre$(MODULE.EXT): $(OUT)_sre$O $(OUT)_sre_m.def $(PYTHON.IMPLIB)
550 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
551
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000552# _symtable needs to be renamed to be useful
553_symtable$(MODULE.EXT): $(OUT)symtablemodule$O $(OUT)_symtable_m.def $(PYTHON.IMPLIB)
554 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
555
556_symtabl$(MODULE.EXT): _symtable$(MODULE.EXT)
557 cp $^ $@
558
559termios$(MODULE.EXT): $(OUT)termios$O $(OUT)termios_m.def $(PYTHON.IMPLIB)
560 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
561
562# _testcapi needs to be renamed to be useful
563_testcapi$(MODULE.EXT): $(OUT)_testcapimodule$O $(OUT)_testcapi_m.def $(PYTHON.IMPLIB)
564 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
565
566_testcap$(MODULE.EXT): _testcapi$(MODULE.EXT)
567 cp $^ $@
568
569# unicodedata needs to be renamed to be useful
570unicodedata$(MODULE.EXT): $(OUT)unicodedata$O $(OUT)unicodedata_m.def $(PYTHON.IMPLIB)
571 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(MODULE_LIBS)
572
573unicoded$(MODULE.EXT): unicodedata$(MODULE.EXT)
574 cp $^ $@
575
576_weakref$(MODULE.EXT): $(OUT)_weakref$O $(OUT)_weakref_m.def $(PYTHON.IMPLIB)
577 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
578
579# xreadlines needs to be renamed to be useful
580xreadlines$(MODULE.EXT): $(OUT)xreadlinesmodule$O $(OUT)xreadlines_m.def $(PYTHON.IMPLIB)
581 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
582
583xreadlin$(MODULE.EXT): xreadlines$(MODULE.EXT)
584 cp $^ $@
585
Andrew MacIntyre4a79e362002-06-10 08:04:29 +0000586# xxsubtype needs to be renamed to be useful
587xxsubtype$(MODULE.EXT): $(OUT)xxsubtype$O $(OUT)xxsubtype_m.def $(PYTHON.IMPLIB)
588 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
589
590xxsubtyp$(MODULE.EXT): xxsubtype$(MODULE.EXT)
591 cp $^ $@
592
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000593# zipimport needs to be renamed to be useful
594zipimport$(MODULE.EXT): $(OUT)zipimport$O $(OUT)zipimport_m.def $(PYTHON.IMPLIB)
595 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
596
597zipimpor$(MODULE.EXT): zipimport$(MODULE.EXT)
598 cp $^ $@
599
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000600# - optional modules (requiring other software to be installed)
Andrew MacIntyree7a8cad2002-12-04 12:37:17 +0000601bsddb185$(MODULE.EXT): $(OUT)bsddbmodule$O $(OUT)bsddb185_m.def $(PYTHON.IMPLIB)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000602 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -ldb $(LIBS)
603
604crypt$(MODULE.EXT): $(OUT)cryptmodule$O $(OUT)crypt_m.def $(PYTHON.IMPLIB)
605 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) -lufc $(LIBS)
606
607# The _curses_panel module requires a couple of ncurses library entry
608# points, which are best exposed as exports from the _curses module DLL
609$(OUT)_curses_m.def:
610 @echo Creating .DEF file: $@
611 @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
612 @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@
613 @echo DATA MULTIPLE NONSHARED >>$@
614 @echo EXPORTS >>$@
615 @echo init_curses >>$@
616 @echo wnoutrefresh >>$@
617 @echo _nc_panelhook >>$@
618 @echo is_linetouched >>$@
619 @echo mvwin >>$@
620 @echo stdscr >>$@
621 @echo wtouchln >>$@
622
623$(OUT)_curses_panel_m.def:
624 @echo Creating .DEF file: $@
625 @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@
626 @echo DESCRIPTION $(DQUOTE)Python standard module $(notdir $*)$(DQUOTE) >>$@
627 @echo DATA MULTIPLE NONSHARED >>$@
628 @echo IMPORTS >>$@
629 @echo _curses.wnoutrefresh >>$@
630 @echo _curses._nc_panelhook >>$@
631 @echo _curses.is_linetouched >>$@
632 @echo _curses.mvwin >>$@
633 @echo _curses.stdscr >>$@
634 @echo _curses.wtouchln >>$@
635 @echo EXPORTS >>$@
636 @echo init_curses_panel >>$@
637
638_curses$(MODULE.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB)
639 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses
640
641# curses_panel needs to be renamed to be useful
642_curses_panel$(MODULE.EXT): $(OUT)_curses_panel$O $(OUT)_curses_panel_m.def $(PYTHON.IMPLIB)
643 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lpanel
644
645_curses_$(MODULE.EXT): _curses_panel$(MODULE.EXT)
646 cp $^ $@
647
648dbm$(MODULE.EXT): $(OUT)dbmmodule$O $(OUT)dbm_m.def $(PYTHON.IMPLIB)
649 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
650
651gdbm$(MODULE.EXT): $(OUT)gdbmmodule$O $(OUT)gdbm_m.def $(PYTHON.IMPLIB)
652 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgdbm
653
654mpz$(MODULE.EXT): $(OUT)mpzmodule$O $(OUT)mpz_m.def $(PYTHON.IMPLIB)
655 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lgmp
656
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000657# Expat is now distributed with Python, so use the included version
658$(OUT)pyexpat$O: ../../Modules/pyexpat.c
659 $(CC) $(CFLAGS) $(EXPAT.INC) -c -o $@ $^
660$(OUT)xmlparse$O: ../../Modules/expat/xmlparse.c
661 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
662$(OUT)xmlrole$O: ../../Modules/expat/xmlrole.c
663 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
664$(OUT)xmltok$O: ../../Modules/expat/xmltok.c
665 $(CC) $(CFLAGS) $(EXPAT.INC) $(EXPAT.DEF) -c -o $@ $^
666pyexpat$(MODULE.EXT): $(OUT)pyexpat$O $(OUT)xmlparse$O $(OUT)xmlrole$O \
667 $(OUT)xmltok$O $(OUT)pyexpat_m.def $(PYTHON.IMPLIB)
668 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000669
670readline$(MODULE.EXT): $(OUT)readline$O $(OUT)readline_m.def $(PYTHON.IMPLIB)
671 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lreadline -lncurses
672
673#_tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O $(OUT)tkappinit$O
674_tkinter$(MODULE.EXT): $(OUT)_tkinter$O $(OUT)tclNotify$O \
675 $(OUT)_tkinter_m.def $(PYTHON.IMPLIB)
676 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) $(TK_LIBS)
677
678zlib$(MODULE.EXT): $(OUT)zlibmodule$O $(OUT)zlib_m.def $(PYTHON.IMPLIB)
679 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lz
680
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000681bz2$(MODULE.EXT): $(OUT)bz2module$O $(OUT)bz2_m.def $(PYTHON.IMPLIB)
682 $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lbz2
683
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000684# the test target
685test:
Andrew MacIntyre978697b2002-12-31 11:18:08 +0000686 -find ../../Lib -name "*.py[co]" -exec rm {} ";"
687 -./python -E -tt ../../lib/test/regrtest.py -l -u "network"
Andrew MacIntyre4fffdff2002-08-18 06:26:33 +0000688 ./python -E -tt ../../lib/test/regrtest.py -l -u "network"
Andrew MacIntyre41d97d62002-02-17 05:23:30 +0000689
690-include $(OUTBASE)python.dep