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