blob: 1e4334db5cd7f8b62d812a7a613e56bcab1476c9 [file] [log] [blame]
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001# Top-level Makefile for Python
2#
3# As distributed, this file is called Makefile.pre.in; it is processed
4# into the real Makefile by running the script ./configure, which
5# replaces things like @spam@ with values appropriate for your system.
6# This means that if you edit Makefile, your changes get lost the next
7# time you run the configure script. Ideally, you can do:
8#
9# ./configure
10# make
11# make test
12# make install
13#
14# If you have a previous version of Python installed that you don't
15# want to overwrite, you can use "make altinstall" instead of "make
Neil Schemenauer2b2681a2001-02-16 04:16:34 +000016# install". Refer to the "Installing" section in the README file for
17# additional details.
Neil Schemenauer85515ad2001-01-24 17:11:43 +000018#
19# See also the section "Build instructions" in the README file.
20
21# === Variables set by makesetup ===
22
23MODOBJS= _MODOBJS_
24MODLIBS= _MODLIBS_
25
26# === Variables set by configure
27VERSION= @VERSION@
28srcdir= @srcdir@
29VPATH= @srcdir@
30
31CC= @CC@
32CXX= @CXX@
33LINKCC= @LINKCC@
34AR= @AR@
35RANLIB= @RANLIB@
36
37# Shell used by make (some versions default to the login shell, which is bad)
38SHELL= /bin/sh
39
40# Use this to make a link between python$(VERSION) and python in $(BINDIR)
41LN= @LN@
42
43# Portable install script (configure doesn't always guess right)
44INSTALL= @INSTALL@
45INSTALL_PROGRAM=@INSTALL_PROGRAM@
Neil Schemenauer3f5cc202001-04-10 23:03:35 +000046INSTALL_SCRIPT= @INSTALL_SCRIPT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000047INSTALL_DATA= @INSTALL_DATA@
48# Shared libraries must be installed with executable mode on some systems;
49# rather than figuring out exactly which, we always give them executable mode.
50# Also, making them read-only seems to be a good idea...
51INSTALL_SHARED= ${INSTALL} -m 555
52
53MAKESETUP= $(srcdir)/Modules/makesetup
54
55# Compiler options
56OPT= @OPT@
57DEFS= @DEFS@
Neil Schemenauer89e90d62001-06-02 06:16:02 +000058CFLAGS= $(OPT)
59CPPFLAGS= -I. -I$(srcdir)/Include $(DEFS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +000060LDFLAGS= @LDFLAGS@
61LDLAST= @LDLAST@
62SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000063CCSHARED= @CCSHARED@
64LINKFORSHARED= @LINKFORSHARED@
65# Extra C flags added for building the interpreter object files.
66CFLAGSFORSHARED=@CFLAGSFORSHARED@
67# C flags used for building the interpreter object files
Neil Schemenauer89e90d62001-06-02 06:16:02 +000068PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED)
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000069
Neil Schemenauer85515ad2001-01-24 17:11:43 +000070
71# Machine-dependent subdirectories
72MACHDEP= @MACHDEP@
73
74# Install prefix for architecture-independent files
75prefix= @prefix@
76
77# Install prefix for architecture-dependent files
78exec_prefix= @exec_prefix@
79
80# Expanded directories
81BINDIR= $(exec_prefix)/bin
82LIBDIR= $(exec_prefix)/lib
Martin v. Löwisd429ab62001-08-02 06:20:20 +000083MANDIR= @mandir@
84INCLUDEDIR= @includedir@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000085CONFINCLUDEDIR= $(exec_prefix)/include
86SCRIPTDIR= $(prefix)/lib
87
88# Detailed destination directories
89BINLIBDEST= $(LIBDIR)/python$(VERSION)
90LIBDEST= $(SCRIPTDIR)/python$(VERSION)
91INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
92CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
93LIBP= $(LIBDIR)/python$(VERSION)
94
95# Symbols used for using shared libraries
96SO= @SO@
97LDSHARED= @LDSHARED@
Neil Schemenauer75e33892001-02-16 03:36:53 +000098BLDSHARED= @BLDSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000099DESTSHARED= $(BINLIBDEST)/lib-dynload
100
101# Executable suffix (.exe on Windows and Mac OS X)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000102EXE= @EXEEXT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000103
104# Modes for directories, executables and data files created by the
105# install process. Default to user-only-writable for all file types.
106DIRMODE= 755
107EXEMODE= 755
108FILEMODE= 644
109
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000110# configure script arguments
111CONFIG_ARGS= @CONFIG_ARGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000112
113
114# Subdirectories with code
115SRCDIRS= @SRCDIRS@
116
117# Other subdirectories
118SUBDIRSTOO= Include Lib Misc Demo
119
120# Files and directories to be distributed
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000121CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000122DISTFILES= README ChangeLog $(CONFIGFILES)
123DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
124DIST= $(DISTFILES) $(DISTDIRS)
125
126
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000127LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000128LDLIBRARY= @LDLIBRARY@
129DLLLIBRARY= @DLLLIBRARY@
130
131
132LIBS= @LIBS@
133LIBM= @LIBM@
134LIBC= @LIBC@
135SYSLIBS= $(LIBM) $(LIBC)
136
137MAINOBJ= @MAINOBJ@
138LIBOBJS= @LIBOBJS@
139DLINCLDIR= @DLINCLDIR@
140DYNLOADFILE= @DYNLOADFILE@
Jack Jansenc49e5b72001-06-19 15:00:23 +0000141MACHDEP_OBJS= @MACHDEP_OBJS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000142
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000143PYTHON= python$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000144
145# === Definitions added by makesetup ===
146
147
148##########################################################################
149# Modules
150MODULE_OBJS= \
151 Modules/config.o \
152 Modules/getpath.o \
Neil Schemenauer18821822001-01-27 21:42:38 +0000153 Modules/main.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000154
155# Used of signalmodule.o is not available
156SIGNAL_OBJS= @SIGNAL_OBJS@
157
158
159##########################################################################
160# Grammar
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000161GRAMMAR_H= $(srcdir)/Include/graminit.h
162GRAMMAR_C= $(srcdir)/Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000163GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
164
165
166##########################################################################
167# Parser
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000168PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000169
170POBJS= \
171 Parser/acceler.o \
172 Parser/grammar1.o \
173 Parser/listnode.o \
174 Parser/node.o \
175 Parser/parser.o \
176 Parser/parsetok.o \
177 Parser/tokenizer.o \
178 Parser/bitset.o \
179 Parser/metagrammar.o
180
181PARSER_OBJS= $(POBJS) Parser/myreadline.o
182
183PGOBJS= \
184 Parser/firstsets.o \
185 Parser/grammar.o \
186 Parser/pgen.o \
187 Parser/printgrammar.o \
188 Parser/pgenmain.o
189
190PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
191
192
193##########################################################################
194# Python
195PYTHON_OBJS= \
196 Python/bltinmodule.o \
197 Python/exceptions.o \
198 Python/ceval.o \
199 Python/compile.o \
200 Python/codecs.o \
201 Python/errors.o \
202 Python/frozen.o \
203 Python/frozenmain.o \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000204 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000205 Python/getargs.o \
206 Python/getcompiler.o \
207 Python/getcopyright.o \
208 Python/getmtime.o \
209 Python/getplatform.o \
210 Python/getversion.o \
211 Python/graminit.o \
212 Python/import.o \
213 Python/importdl.o \
214 Python/marshal.o \
215 Python/modsupport.o \
216 Python/mystrtoul.o \
Marc-André Lemburge5006eb2001-07-31 13:24:44 +0000217 Python/mysnprintf.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000218 Python/pyfpe.o \
219 Python/pystate.o \
220 Python/pythonrun.o \
221 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000222 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000223 Python/sysmodule.o \
224 Python/traceback.o \
225 Python/getopt.o \
226 Python/$(DYNLOADFILE) \
Jack Jansenc49e5b72001-06-19 15:00:23 +0000227 $(MACHDEP_OBJS) \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000228 $(LIBOBJS)
229
230
231##########################################################################
232# Objects
233OBJECT_OBJS= \
234 Objects/abstract.o \
235 Objects/bufferobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000236 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000237 Objects/classobject.o \
238 Objects/cobject.o \
239 Objects/complexobject.o \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000240 Objects/descrobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000241 Objects/fileobject.o \
242 Objects/floatobject.o \
243 Objects/frameobject.o \
244 Objects/funcobject.o \
245 Objects/intobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000246 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000247 Objects/listobject.o \
248 Objects/longobject.o \
249 Objects/dictobject.o \
250 Objects/methodobject.o \
251 Objects/moduleobject.o \
252 Objects/object.o \
253 Objects/rangeobject.o \
254 Objects/sliceobject.o \
255 Objects/stringobject.o \
256 Objects/tupleobject.o \
257 Objects/typeobject.o \
258 Objects/unicodeobject.o \
259 Objects/unicodectype.o
260
261
262##########################################################################
263# objects that get linked into the Python library
264LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000265 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000266 $(PARSER_OBJS) \
267 $(OBJECT_OBJS) \
268 $(PYTHON_OBJS) \
269 $(MODULE_OBJS) \
270 $(SIGNAL_OBJS) \
271 $(MODOBJS)
272
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000273#########################################################################
274# Rules
275
276# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000277all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000278
279# Build the interpreter
Fred Drakea1a84e72001-03-06 05:52:16 +0000280$(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY)
281 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
282 Modules/$(MAINOBJ) \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000283 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
284
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000285platform: $(PYTHON)
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000286 ./$(PYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000287
288
289# Build the shared modules
290sharedmods: $(PYTHON)
Martin v. Löwisab0cad52001-08-10 20:18:26 +0000291 CC='$(CC)' LDSHARED='$(LDSHARED)' ./$(PYTHON) -E $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000292
Neil Schemenauer18821822001-01-27 21:42:38 +0000293# buildno should really depend on something like LIBRARY_SRC
294buildno: $(PARSER_OBJS) \
295 $(OBJECT_OBJS) \
296 $(PYTHON_OBJS) \
297 $(MODULE_OBJS) \
298 $(SIGNAL_OBJS) \
299 $(MODOBJS) \
300 $(srcdir)/Modules/getbuildinfo.c
301 if test -f buildno; then \
302 expr `cat buildno` + 1 >buildno1; \
303 mv -f buildno1 buildno; \
304 else echo 1 >buildno; fi
305
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000306# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000307# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000308$(LIBRARY): $(LIBRARY_OBJS)
309 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000310 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000311 $(AR) cr $@ $(PARSER_OBJS)
312 $(AR) cr $@ $(OBJECT_OBJS)
313 $(AR) cr $@ $(PYTHON_OBJS)
314 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
315 $(AR) cr $@ $(MODOBJS)
316 $(RANLIB) $@
317
Martin v. Löwis130fb172001-07-19 11:00:41 +0000318# This rule is only here for DG/UX and BeOS!!!
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000319libpython$(VERSION).so: $(LIBRARY)
320 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
321 *dgux*) \
322 test -d dgux || mkdir dgux; \
323 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
324 /bin/rm -rf ./dgux \
325 ;; \
326 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000327 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000328 ;; \
329 esac
330
331# This rule is here for OPENSTEP/Rhapsody/MacOSX
332libpython$(VERSION).dylib: $(LIBRARY)
333 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
334 -framework System @LIBTOOL_CRUFT@
335
336# This rule builds the Cygwin Python DLL
337libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
338 dlltool --export-all --output-def $@ $^
339 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
340 $(LIBS) $(MODLIBS) $(SYSLIBS)
341
342
343oldsharedmods: $(SHAREDMODS)
344
345
346Makefile Modules/config.c: Makefile.pre \
347 $(srcdir)/Modules/config.c.in \
348 $(MAKESETUP) \
349 Modules/Setup.config \
350 Modules/Setup \
351 Modules/Setup.local
352 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
353 -s Modules \
354 Modules/Setup.config \
355 Modules/Setup.local \
356 Modules/Setup
357 @mv config.c Modules
358 @echo "The Makefile was updated, you may need to re-run make."
359
360
361Modules/Setup: $(srcdir)/Modules/Setup.dist
362 @if test -f Modules/Setup; then \
363 echo "-----------------------------------------------"; \
364 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
365 echo "check to make sure you have all the updates you"; \
366 echo "need in your Modules/Setup file."; \
367 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000368 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000369
370############################################################################
371# Special rules for object files
372
373Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000374 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000375
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000376Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000377 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
378 -DPREFIX='"$(prefix)"' \
379 -DEXEC_PREFIX='"$(exec_prefix)"' \
380 -DVERSION='"$(VERSION)"' \
381 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000382 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000383
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000384Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
385 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000386
387
388$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000389 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000390
391$(PGEN): $(PGENOBJS)
392 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
393
394Parser/grammar.o: $(srcdir)/Parser/grammar.c \
395 $(srcdir)/Parser/assert.h \
396 $(srcdir)/Include/token.h \
397 $(srcdir)/Include/grammar.h
398Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
399
400
Neil Schemenauer40417742001-02-27 02:45:36 +0000401Python/compile.o Python/symtable.o: $(GRAMMAR_H)
402
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000403Python/getplatform.o: $(srcdir)/Python/getplatform.c
Neil Schemenauer89e90d62001-06-02 06:16:02 +0000404 $(CC) -c $(CFLAGS) $(CPPFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000405
406Python/importdl.o: $(srcdir)/Python/importdl.c
Neil Schemenauer89e90d62001-06-02 06:16:02 +0000407 $(CC) -c $(CFLAGS) $(CPPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000408
Neil Schemenauera35c6882001-02-27 04:45:05 +0000409Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000410
411Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
412 $(srcdir)/Objects/unicodetype_db.h
413
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000414############################################################################
415# Header files
416
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000417PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000418 Include/Python.h \
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000419 pyconfig.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000420 Include/patchlevel.h \
421 Include/pyport.h \
422 Include/pymem.h \
423 Include/object.h \
424 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000425 Include/compile.h \
426 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000427 Include/pydebug.h \
428 Include/unicodeobject.h \
429 Include/intobject.h \
430 Include/longobject.h \
431 Include/floatobject.h \
432 Include/complexobject.h \
433 Include/rangeobject.h \
434 Include/stringobject.h \
435 Include/bufferobject.h \
436 Include/tupleobject.h \
437 Include/listobject.h \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000438 Include/iterobject.h \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000439 Include/descrobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000440 Include/dictobject.h \
441 Include/methodobject.h \
442 Include/moduleobject.h \
443 Include/funcobject.h \
444 Include/classobject.h \
445 Include/fileobject.h \
446 Include/cobject.h \
447 Include/traceback.h \
448 Include/sliceobject.h \
449 Include/codecs.h \
450 Include/pyerrors.h \
451 Include/pystate.h \
452 Include/modsupport.h \
453 Include/ceval.h \
454 Include/pythonrun.h \
455 Include/sysmodule.h \
456 Include/intrcheck.h \
457 Include/import.h \
458 Include/abstract.h \
459 Include/pyfpe.h
460
Fred Drakea1a84e72001-03-06 05:52:16 +0000461$(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000462
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000463
464######################################################################
465
466# Test the interpreter (twice, once without .pyc files, once with)
467TESTOPTS= -l
468TESTPROG= $(srcdir)/Lib/test/regrtest.py
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000469TESTPYTHON= ./$(PYTHON) -E -tt
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000470test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000471 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000472 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
473 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000474
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000475QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000476 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000477 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000478quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000479 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000480 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
481 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000482
Barry Warsaw42119252001-03-03 04:14:21 +0000483MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
484 test_longexp
485memtest: all platform
486 -rm -f $(srcdir)/Lib/test/*.py[co]
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000487 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
488 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
Barry Warsaw42119252001-03-03 04:14:21 +0000489
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000490# Install everything
491install: altinstall bininstall maninstall
492
493# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000494altinstall: altbininstall libinstall inclinstall libainstall \
495 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000496
497# Install shared libraries enabled by Setup
498DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
499
500oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
501 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000502 if test $$i != X; then \
503 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
504 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
505 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000506 done
507
508$(DESTSHARED):
509 @for i in $(DESTDIRS); \
510 do \
511 if test ! -d $$i; then \
512 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000513 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000514 else true; \
515 fi; \
516 done
517
518
519# Install the interpreter (by creating a hard link to python$(VERSION))
520bininstall: altbininstall
521 -if test -f $(BINDIR)/$(PYTHON); \
522 then rm -f $(BINDIR)/$(PYTHON); \
523 else true; \
524 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000525 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000526
527# Install the interpreter with $(VERSION) affixed
528# This goes into $(exec_prefix)
529altbininstall: $(PYTHON)
530 @for i in $(BINDIR); \
531 do \
532 if test ! -d $$i; then \
533 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000534 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000535 else true; \
536 fi; \
537 done
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000538 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000539 if test -f libpython$(VERSION).so; then \
540 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
541 else true; \
542 fi
543 if test -f "$(DLLLIBRARY)"; then \
Neil Schemenauercf20d4f2001-03-16 11:50:43 +0000544 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000545 else true; \
546 fi
547
548# Install the manual page
549maninstall:
550 @for i in $(MANDIR) $(MANDIR)/man1; \
551 do \
552 if test ! -d $$i; then \
553 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000554 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000555 else true; \
556 fi; \
557 done
558 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
559 $(MANDIR)/man1/python.1
560
561# Install the library
562PLATDIR= plat-$(MACHDEP)
563MACHDEPS= $(PLATDIR)
564XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
565LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
566 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000567libinstall: $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000568 @for i in $(SCRIPTDIR) $(LIBDEST); \
569 do \
570 if test ! -d $$i; then \
571 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000572 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000573 else true; \
574 fi; \
575 done
576 @for d in $(LIBSUBDIRS); \
577 do \
578 a=$(srcdir)/Lib/$$d; \
579 if test ! -d $$a; then continue; else true; fi; \
580 b=$(LIBDEST)/$$d; \
581 if test ! -d $$b; then \
582 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000583 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000584 else true; \
585 fi; \
586 done
587 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
588 do \
589 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000590 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
591 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000592 else \
593 $(INSTALL_DATA) $$i $(LIBDEST); \
594 echo $(INSTALL_DATA) $$i $(LIBDEST); \
595 fi; \
596 done
597 @for d in $(LIBSUBDIRS); \
598 do \
599 a=$(srcdir)/Lib/$$d; \
600 if test ! -d $$a; then continue; else true; fi; \
601 b=$(LIBDEST)/$$d; \
602 for i in $$a/*; \
603 do \
604 case $$i in \
605 *CVS) ;; \
606 *.py[co]) ;; \
607 *.orig) ;; \
608 *~) ;; \
609 *) \
610 if test -d $$i; then continue; fi; \
611 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000612 echo $(INSTALL_SCRIPT) $$i $$b; \
613 $(INSTALL_SCRIPT) $$i $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000614 else \
615 echo $(INSTALL_DATA) $$i $$b; \
616 $(INSTALL_DATA) $$i $$b; \
617 fi;; \
618 esac; \
619 done; \
620 done
621 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
622 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000623 ./$(PYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
624 $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000625 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000626 ./$(PYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000627
628# Create the PLATDIR source directory, if one wasn't distributed..
629$(srcdir)/Lib/$(PLATDIR):
630 mkdir $(srcdir)/Lib/$(PLATDIR)
631 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
632 export PATH; PATH="`pwd`:$$PATH"; \
633 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000634 export EXE; EXE="$(EXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000635 cd $(srcdir)/Lib/$(PLATDIR); ./regen
636
637# Install the include files
638INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
639inclinstall:
640 @for i in $(INCLDIRSTOMAKE); \
641 do \
642 if test ! -d $$i; then \
643 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000644 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000645 else true; \
646 fi; \
647 done
648 @for i in $(srcdir)/Include/*.h; \
649 do \
650 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
651 $(INSTALL_DATA) $$i $(INCLUDEPY); \
652 done
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000653 $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000654
655# Install the library and miscellaneous stuff needed for extending/embedding
656# This goes into $(exec_prefix)
657LIBPL= $(LIBP)/config
658libainstall: all
659 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
660 do \
661 if test ! -d $$i; then \
662 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000663 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000664 else true; \
665 fi; \
666 done
667 @if test -d $(LDLIBRARY); then :; else \
668 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
669 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
670 fi
671 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Fred Drakea1a84e72001-03-06 05:52:16 +0000672 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000673 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
674 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
675 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
676 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
677 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000678 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
679 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000680 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
681 @if [ -s Modules/python.exp -a \
682 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
683 echo; echo "Installing support files for building shared extension modules on AIX:"; \
684 $(INSTALL_DATA) Modules/python.exp \
685 $(LIBPL)/python.exp; \
686 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000687 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000688 $(LIBPL)/makexp_aix; \
689 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000690 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000691 $(LIBPL)/ld_so_aix; \
692 echo "$(LIBPL)/ld_so_aix"; \
693 echo; echo "See Misc/AIX-NOTES for details."; \
694 else true; \
695 fi
696 @case "$(MACHDEP)" in beos*) \
697 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000698 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000699 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000700 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000701 echo "$(LIBPL)/ar_beos"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000702 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000703 echo "$(LIBPL)/ld_so_beos"; \
704 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000705 ;; \
706 esac
707
708# Install the dynamically loadable modules
709# This goes into $(exec_prefix)
710sharedinstall:
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000711 ./$(PYTHON) -E $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000712 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000713
714# Build the toplevel Makefile
715Makefile.pre: Makefile.pre.in config.status
716 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
717 $(MAKE) -f Makefile.pre Makefile
718
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000719# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000720config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000721 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000722
723.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
724
725# Some make's put the object file in the current directory
726.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000727 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000728
729# Rerun configure with the same options as it was run last time,
730# provided the config.status script exists
731recheck:
732 $(SHELL) config.status --recheck
733 $(SHELL) config.status
734
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000735# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000736autoconf:
737 (cd $(srcdir); autoconf)
738 (cd $(srcdir); autoheader)
739
740# Create a tags file for vi
741tags::
742 cd $(srcdir); \
743 ctags -w -t Include/*.h; \
744 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
745 done; \
746 sort tags -o tags
747
748# Create a tags file for GNU Emacs
749TAGS::
750 cd $(srcdir); \
751 etags Include/*.h; \
752 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
753
754# Sanitation targets -- clean leaves libraries, executables and tags
755# files, which clobber removes those as well
756
757clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000758 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000759 find . -name '*.s[ol]' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000760 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000761
762clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000763 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000764 tags TAGS \
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000765 config.cache config.log pyconfig.h Modules/config.c
Guido van Rossum1d88c592001-06-06 17:51:57 +0000766 -rm -rf build platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000767
768# Make things extra clean, before making a distribution:
769# remove all generated files, even Makefile[.pre]
770distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000771 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000772 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000773 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
774 -o -name '[@,#]*' -o -name '*.old' \
775 -o -name '*.orig' -o -name '*.rej' \
776 -o -name '*.bak' ')' \
777 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000778
779# Check for smelly exported symbols (not starting with Py/_Py)
780smelly: all
781 nm -p $(LIBRARY) | \
782 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
783
784# Find files with funny names
785funny:
786 find $(DISTDIRS) -type d \
787 -o -name '*.[chs]' \
788 -o -name '*.py' \
789 -o -name '*.doc' \
790 -o -name '*.sty' \
791 -o -name '*.bib' \
792 -o -name '*.dat' \
793 -o -name '*.el' \
794 -o -name '*.fd' \
795 -o -name '*.in' \
796 -o -name '*.tex' \
797 -o -name '*,[vpt]' \
798 -o -name 'Setup' \
799 -o -name 'Setup.*' \
800 -o -name README \
801 -o -name Makefile \
802 -o -name ChangeLog \
803 -o -name Repository \
804 -o -name Root \
805 -o -name Entries \
806 -o -name Tag \
807 -o -name tags \
808 -o -name TAGS \
809 -o -name .cvsignore \
810 -o -name MANIFEST \
811 -o -print
812
813# IF YOU PUT ANYTHING HERE IT WILL GO AWAY