blob: 9fbf29d8f0cbaf05bdc6b85569275002c1da96d4 [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
83MANDIR= $(prefix)/man
84INCLUDEDIR= $(prefix)/include
85CONFINCLUDEDIR= $(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 \
240 Objects/fileobject.o \
241 Objects/floatobject.o \
242 Objects/frameobject.o \
243 Objects/funcobject.o \
244 Objects/intobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000245 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000246 Objects/listobject.o \
247 Objects/longobject.o \
248 Objects/dictobject.o \
249 Objects/methodobject.o \
250 Objects/moduleobject.o \
251 Objects/object.o \
252 Objects/rangeobject.o \
253 Objects/sliceobject.o \
254 Objects/stringobject.o \
255 Objects/tupleobject.o \
256 Objects/typeobject.o \
257 Objects/unicodeobject.o \
258 Objects/unicodectype.o
259
260
261##########################################################################
262# objects that get linked into the Python library
263LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000264 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000265 $(PARSER_OBJS) \
266 $(OBJECT_OBJS) \
267 $(PYTHON_OBJS) \
268 $(MODULE_OBJS) \
269 $(SIGNAL_OBJS) \
270 $(MODOBJS)
271
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000272#########################################################################
273# Rules
274
275# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000276all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000277
278# Build the interpreter
Fred Drakea1a84e72001-03-06 05:52:16 +0000279$(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY)
280 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
281 Modules/$(MAINOBJ) \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000282 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
283
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000284platform: $(PYTHON)
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000285 ./$(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 +0000286
287
288# Build the shared modules
289sharedmods: $(PYTHON)
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000290 ./$(PYTHON) -E $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000291
Neil Schemenauer18821822001-01-27 21:42:38 +0000292# buildno should really depend on something like LIBRARY_SRC
293buildno: $(PARSER_OBJS) \
294 $(OBJECT_OBJS) \
295 $(PYTHON_OBJS) \
296 $(MODULE_OBJS) \
297 $(SIGNAL_OBJS) \
298 $(MODOBJS) \
299 $(srcdir)/Modules/getbuildinfo.c
300 if test -f buildno; then \
301 expr `cat buildno` + 1 >buildno1; \
302 mv -f buildno1 buildno; \
303 else echo 1 >buildno; fi
304
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000305# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000306# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000307$(LIBRARY): $(LIBRARY_OBJS)
308 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000309 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000310 $(AR) cr $@ $(PARSER_OBJS)
311 $(AR) cr $@ $(OBJECT_OBJS)
312 $(AR) cr $@ $(PYTHON_OBJS)
313 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
314 $(AR) cr $@ $(MODOBJS)
315 $(RANLIB) $@
316
Martin v. Löwis130fb172001-07-19 11:00:41 +0000317# This rule is only here for DG/UX and BeOS!!!
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000318libpython$(VERSION).so: $(LIBRARY)
319 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
320 *dgux*) \
321 test -d dgux || mkdir dgux; \
322 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
323 /bin/rm -rf ./dgux \
324 ;; \
325 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000326 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000327 ;; \
328 esac
329
330# This rule is here for OPENSTEP/Rhapsody/MacOSX
331libpython$(VERSION).dylib: $(LIBRARY)
332 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
333 -framework System @LIBTOOL_CRUFT@
334
335# This rule builds the Cygwin Python DLL
336libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
337 dlltool --export-all --output-def $@ $^
338 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
339 $(LIBS) $(MODLIBS) $(SYSLIBS)
340
341
342oldsharedmods: $(SHAREDMODS)
343
344
345Makefile Modules/config.c: Makefile.pre \
346 $(srcdir)/Modules/config.c.in \
347 $(MAKESETUP) \
348 Modules/Setup.config \
349 Modules/Setup \
350 Modules/Setup.local
351 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
352 -s Modules \
353 Modules/Setup.config \
354 Modules/Setup.local \
355 Modules/Setup
356 @mv config.c Modules
357 @echo "The Makefile was updated, you may need to re-run make."
358
359
360Modules/Setup: $(srcdir)/Modules/Setup.dist
361 @if test -f Modules/Setup; then \
362 echo "-----------------------------------------------"; \
363 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
364 echo "check to make sure you have all the updates you"; \
365 echo "need in your Modules/Setup file."; \
366 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000367 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000368
369############################################################################
370# Special rules for object files
371
372Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000373 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000374
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000375Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000376 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
377 -DPREFIX='"$(prefix)"' \
378 -DEXEC_PREFIX='"$(exec_prefix)"' \
379 -DVERSION='"$(VERSION)"' \
380 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000381 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000382
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000383Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
384 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000385
386
387$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000388 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000389
390$(PGEN): $(PGENOBJS)
391 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
392
393Parser/grammar.o: $(srcdir)/Parser/grammar.c \
394 $(srcdir)/Parser/assert.h \
395 $(srcdir)/Include/token.h \
396 $(srcdir)/Include/grammar.h
397Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
398
399
Neil Schemenauer40417742001-02-27 02:45:36 +0000400Python/compile.o Python/symtable.o: $(GRAMMAR_H)
401
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000402Python/getplatform.o: $(srcdir)/Python/getplatform.c
Neil Schemenauer89e90d62001-06-02 06:16:02 +0000403 $(CC) -c $(CFLAGS) $(CPPFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000404
405Python/importdl.o: $(srcdir)/Python/importdl.c
Neil Schemenauer89e90d62001-06-02 06:16:02 +0000406 $(CC) -c $(CFLAGS) $(CPPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000407
Neil Schemenauera35c6882001-02-27 04:45:05 +0000408Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000409
410Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
411 $(srcdir)/Objects/unicodetype_db.h
412
Jack Jansenc49e5b72001-06-19 15:00:23 +0000413Mac/Python/macglue.o: $(srcdir)/Mac/Python/macglue.c
414 $(CC) -c $(CFLAGS) $(CPPFLAGS) -I$(srcdir)/Mac/Include -I$(srcdir)/Python -o $@ $(srcdir)/Mac/Python/macglue.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000415
416############################################################################
417# Header files
418
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000419PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000420 Include/Python.h \
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000421 pyconfig.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000422 Include/patchlevel.h \
423 Include/pyport.h \
424 Include/pymem.h \
425 Include/object.h \
426 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000427 Include/compile.h \
428 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000429 Include/pydebug.h \
430 Include/unicodeobject.h \
431 Include/intobject.h \
432 Include/longobject.h \
433 Include/floatobject.h \
434 Include/complexobject.h \
435 Include/rangeobject.h \
436 Include/stringobject.h \
437 Include/bufferobject.h \
438 Include/tupleobject.h \
439 Include/listobject.h \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000440 Include/iterobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000441 Include/dictobject.h \
442 Include/methodobject.h \
443 Include/moduleobject.h \
444 Include/funcobject.h \
445 Include/classobject.h \
446 Include/fileobject.h \
447 Include/cobject.h \
448 Include/traceback.h \
449 Include/sliceobject.h \
450 Include/codecs.h \
451 Include/pyerrors.h \
452 Include/pystate.h \
453 Include/modsupport.h \
454 Include/ceval.h \
455 Include/pythonrun.h \
456 Include/sysmodule.h \
457 Include/intrcheck.h \
458 Include/import.h \
459 Include/abstract.h \
460 Include/pyfpe.h
461
Fred Drakea1a84e72001-03-06 05:52:16 +0000462$(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000463
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000464
465######################################################################
466
467# Test the interpreter (twice, once without .pyc files, once with)
468TESTOPTS= -l
469TESTPROG= $(srcdir)/Lib/test/regrtest.py
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000470TESTPYTHON= ./$(PYTHON) -E -tt
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000471test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000472 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000473 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
474 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000475
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000476QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000477 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000478 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000479quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000480 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000481 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
482 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000483
Barry Warsaw42119252001-03-03 04:14:21 +0000484MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
485 test_longexp
486memtest: all platform
487 -rm -f $(srcdir)/Lib/test/*.py[co]
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000488 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
489 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
Barry Warsaw42119252001-03-03 04:14:21 +0000490
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000491# Install everything
492install: altinstall bininstall maninstall
493
494# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000495altinstall: altbininstall libinstall inclinstall libainstall \
496 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000497
498# Install shared libraries enabled by Setup
499DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
500
501oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
502 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000503 if test $$i != X; then \
504 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
505 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
506 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000507 done
508
509$(DESTSHARED):
510 @for i in $(DESTDIRS); \
511 do \
512 if test ! -d $$i; then \
513 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000514 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000515 else true; \
516 fi; \
517 done
518
519
520# Install the interpreter (by creating a hard link to python$(VERSION))
521bininstall: altbininstall
522 -if test -f $(BINDIR)/$(PYTHON); \
523 then rm -f $(BINDIR)/$(PYTHON); \
524 else true; \
525 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000526 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000527
528# Install the interpreter with $(VERSION) affixed
529# This goes into $(exec_prefix)
530altbininstall: $(PYTHON)
531 @for i in $(BINDIR); \
532 do \
533 if test ! -d $$i; then \
534 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000535 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000536 else true; \
537 fi; \
538 done
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000539 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000540 if test -f libpython$(VERSION).so; then \
541 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
542 else true; \
543 fi
544 if test -f "$(DLLLIBRARY)"; then \
Neil Schemenauercf20d4f2001-03-16 11:50:43 +0000545 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000546 else true; \
547 fi
548
549# Install the manual page
550maninstall:
551 @for i in $(MANDIR) $(MANDIR)/man1; \
552 do \
553 if test ! -d $$i; then \
554 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000555 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000556 else true; \
557 fi; \
558 done
559 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
560 $(MANDIR)/man1/python.1
561
562# Install the library
563PLATDIR= plat-$(MACHDEP)
564MACHDEPS= $(PLATDIR)
565XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
566LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
567 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000568libinstall: $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000569 @for i in $(SCRIPTDIR) $(LIBDEST); \
570 do \
571 if test ! -d $$i; then \
572 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000573 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000574 else true; \
575 fi; \
576 done
577 @for d in $(LIBSUBDIRS); \
578 do \
579 a=$(srcdir)/Lib/$$d; \
580 if test ! -d $$a; then continue; else true; fi; \
581 b=$(LIBDEST)/$$d; \
582 if test ! -d $$b; then \
583 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000584 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000585 else true; \
586 fi; \
587 done
588 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
589 do \
590 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000591 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
592 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000593 else \
594 $(INSTALL_DATA) $$i $(LIBDEST); \
595 echo $(INSTALL_DATA) $$i $(LIBDEST); \
596 fi; \
597 done
598 @for d in $(LIBSUBDIRS); \
599 do \
600 a=$(srcdir)/Lib/$$d; \
601 if test ! -d $$a; then continue; else true; fi; \
602 b=$(LIBDEST)/$$d; \
603 for i in $$a/*; \
604 do \
605 case $$i in \
606 *CVS) ;; \
607 *.py[co]) ;; \
608 *.orig) ;; \
609 *~) ;; \
610 *) \
611 if test -d $$i; then continue; fi; \
612 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000613 echo $(INSTALL_SCRIPT) $$i $$b; \
614 $(INSTALL_SCRIPT) $$i $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000615 else \
616 echo $(INSTALL_DATA) $$i $$b; \
617 $(INSTALL_DATA) $$i $$b; \
618 fi;; \
619 esac; \
620 done; \
621 done
622 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
623 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000624 ./$(PYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
625 $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000626 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000627 ./$(PYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000628
629# Create the PLATDIR source directory, if one wasn't distributed..
630$(srcdir)/Lib/$(PLATDIR):
631 mkdir $(srcdir)/Lib/$(PLATDIR)
632 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
633 export PATH; PATH="`pwd`:$$PATH"; \
634 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000635 export EXE; EXE="$(EXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000636 cd $(srcdir)/Lib/$(PLATDIR); ./regen
637
638# Install the include files
639INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
640inclinstall:
641 @for i in $(INCLDIRSTOMAKE); \
642 do \
643 if test ! -d $$i; then \
644 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000645 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000646 else true; \
647 fi; \
648 done
649 @for i in $(srcdir)/Include/*.h; \
650 do \
651 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
652 $(INSTALL_DATA) $$i $(INCLUDEPY); \
653 done
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000654 $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000655
656# Install the library and miscellaneous stuff needed for extending/embedding
657# This goes into $(exec_prefix)
658LIBPL= $(LIBP)/config
659libainstall: all
660 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
661 do \
662 if test ! -d $$i; then \
663 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000664 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000665 else true; \
666 fi; \
667 done
668 @if test -d $(LDLIBRARY); then :; else \
669 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
670 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
671 fi
672 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Fred Drakea1a84e72001-03-06 05:52:16 +0000673 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000674 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
675 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
676 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
677 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
678 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000679 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
680 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000681 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
682 @if [ -s Modules/python.exp -a \
683 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
684 echo; echo "Installing support files for building shared extension modules on AIX:"; \
685 $(INSTALL_DATA) Modules/python.exp \
686 $(LIBPL)/python.exp; \
687 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000688 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000689 $(LIBPL)/makexp_aix; \
690 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000691 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000692 $(LIBPL)/ld_so_aix; \
693 echo "$(LIBPL)/ld_so_aix"; \
694 echo; echo "See Misc/AIX-NOTES for details."; \
695 else true; \
696 fi
697 @case "$(MACHDEP)" in beos*) \
698 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000699 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000700 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000701 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000702 echo "$(LIBPL)/ar_beos"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000703 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000704 echo "$(LIBPL)/ld_so_beos"; \
705 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000706 ;; \
707 esac
708
709# Install the dynamically loadable modules
710# This goes into $(exec_prefix)
711sharedinstall:
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000712 ./$(PYTHON) -E $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000713 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000714
715# Build the toplevel Makefile
716Makefile.pre: Makefile.pre.in config.status
717 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
718 $(MAKE) -f Makefile.pre Makefile
719
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000720# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000721config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000722 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000723
724.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
725
726# Some make's put the object file in the current directory
727.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000728 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000729
730# Rerun configure with the same options as it was run last time,
731# provided the config.status script exists
732recheck:
733 $(SHELL) config.status --recheck
734 $(SHELL) config.status
735
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000736# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000737autoconf:
738 (cd $(srcdir); autoconf)
739 (cd $(srcdir); autoheader)
740
741# Create a tags file for vi
742tags::
743 cd $(srcdir); \
744 ctags -w -t Include/*.h; \
745 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
746 done; \
747 sort tags -o tags
748
749# Create a tags file for GNU Emacs
750TAGS::
751 cd $(srcdir); \
752 etags Include/*.h; \
753 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
754
755# Sanitation targets -- clean leaves libraries, executables and tags
756# files, which clobber removes those as well
757
758clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000759 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000760 find . -name '*.s[ol]' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000761 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000762
763clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000764 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000765 tags TAGS \
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000766 config.cache config.log pyconfig.h Modules/config.c
Guido van Rossum1d88c592001-06-06 17:51:57 +0000767 -rm -rf build platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000768
769# Make things extra clean, before making a distribution:
770# remove all generated files, even Makefile[.pre]
771distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000772 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000773 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000774 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
775 -o -name '[@,#]*' -o -name '*.old' \
776 -o -name '*.orig' -o -name '*.rej' \
777 -o -name '*.bak' ')' \
778 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000779
780# Check for smelly exported symbols (not starting with Py/_Py)
781smelly: all
782 nm -p $(LIBRARY) | \
783 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
784
785# Find files with funny names
786funny:
787 find $(DISTDIRS) -type d \
788 -o -name '*.[chs]' \
789 -o -name '*.py' \
790 -o -name '*.doc' \
791 -o -name '*.sty' \
792 -o -name '*.bib' \
793 -o -name '*.dat' \
794 -o -name '*.el' \
795 -o -name '*.fd' \
796 -o -name '*.in' \
797 -o -name '*.tex' \
798 -o -name '*,[vpt]' \
799 -o -name 'Setup' \
800 -o -name 'Setup.*' \
801 -o -name README \
802 -o -name Makefile \
803 -o -name ChangeLog \
804 -o -name Repository \
805 -o -name Root \
806 -o -name Entries \
807 -o -name Tag \
808 -o -name tags \
809 -o -name TAGS \
810 -o -name .cvsignore \
811 -o -name MANIFEST \
812 -o -print
813
814# IF YOU PUT ANYTHING HERE IT WILL GO AWAY