blob: 9c7e873927e77acbe1824d6a0ed525da6c54e090 [file] [log] [blame]
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001# Top-level Makefile for Python
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00002#
Neil Schemenauer85515ad2001-01-24 17:11:43 +00003# 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:
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00008#
Neil Schemenauer85515ad2001-01-24 17:11:43 +00009# ./configure
10# make
11# make test
12# make install
Guido van Rossum7cb32ae2001-08-17 15:32:31 +000013#
Neil Schemenauer85515ad2001-01-24 17:11:43 +000014# 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.
Guido van Rossum7cb32ae2001-08-17 15:32:31 +000018#
Neil Schemenauer85515ad2001-01-24 17:11:43 +000019# 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@
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000033MAINCC= @MAINCC@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000034LINKCC= @LINKCC@
35AR= @AR@
36RANLIB= @RANLIB@
Martin v. Löwisdea59e52006-01-05 10:00:36 +000037SVNVERSION= @SVNVERSION@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000038
39# Shell used by make (some versions default to the login shell, which is bad)
40SHELL= /bin/sh
41
42# Use this to make a link between python$(VERSION) and python in $(BINDIR)
43LN= @LN@
44
45# Portable install script (configure doesn't always guess right)
46INSTALL= @INSTALL@
47INSTALL_PROGRAM=@INSTALL_PROGRAM@
Neil Schemenauer3f5cc202001-04-10 23:03:35 +000048INSTALL_SCRIPT= @INSTALL_SCRIPT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000049INSTALL_DATA= @INSTALL_DATA@
50# Shared libraries must be installed with executable mode on some systems;
51# rather than figuring out exactly which, we always give them executable mode.
52# Also, making them read-only seems to be a good idea...
53INSTALL_SHARED= ${INSTALL} -m 555
54
55MAKESETUP= $(srcdir)/Modules/makesetup
56
57# Compiler options
58OPT= @OPT@
Skip Montanarodecc6a42003-01-01 20:07:49 +000059BASECFLAGS= @BASECFLAGS@
Brett Cannon08cd5982005-04-24 22:26:38 +000060CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
Brett Cannon516592f2004-12-07 00:42:59 +000061# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
62# be able to build extension modules using the directories specified in the
63# environment variables
Thomas Wouters89d996e2007-09-08 17:39:28 +000064CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000065LDFLAGS= @LDFLAGS@
66LDLAST= @LDLAST@
67SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000068CCSHARED= @CCSHARED@
69LINKFORSHARED= @LINKFORSHARED@
70# Extra C flags added for building the interpreter object files.
71CFLAGSFORSHARED=@CFLAGSFORSHARED@
72# C flags used for building the interpreter object files
Mark Hammond8235ea12002-07-19 06:55:41 +000073PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000074
Neil Schemenauer85515ad2001-01-24 17:11:43 +000075
76# Machine-dependent subdirectories
77MACHDEP= @MACHDEP@
78
79# Install prefix for architecture-independent files
80prefix= @prefix@
81
82# Install prefix for architecture-dependent files
83exec_prefix= @exec_prefix@
84
Thomas Woutersbca54802007-09-10 19:32:14 +000085# Install prefix for data files
86datarootdir= @datarootdir@
87
Neil Schemenauer85515ad2001-01-24 17:11:43 +000088# Expanded directories
89BINDIR= $(exec_prefix)/bin
90LIBDIR= $(exec_prefix)/lib
Martin v. Löwisd429ab62001-08-02 06:20:20 +000091MANDIR= @mandir@
92INCLUDEDIR= @includedir@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000093CONFINCLUDEDIR= $(exec_prefix)/include
94SCRIPTDIR= $(prefix)/lib
95
96# Detailed destination directories
97BINLIBDEST= $(LIBDIR)/python$(VERSION)
98LIBDEST= $(SCRIPTDIR)/python$(VERSION)
99INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
100CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
101LIBP= $(LIBDIR)/python$(VERSION)
102
103# Symbols used for using shared libraries
104SO= @SO@
105LDSHARED= @LDSHARED@
Neil Schemenauer75e33892001-02-16 03:36:53 +0000106BLDSHARED= @BLDSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000107DESTSHARED= $(BINLIBDEST)/lib-dynload
108
109# Executable suffix (.exe on Windows and Mac OS X)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000110EXE= @EXEEXT@
Jack Jansen1999ef42001-12-06 21:47:20 +0000111BUILDEXE= @BUILDEXEEXT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000112
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000113# Short name and location for Mac OS X Python framework
Thomas Wouters477c8d52006-05-27 19:21:47 +0000114UNIVERSALSDK=@UNIVERSALSDK@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000115PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
116PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
117PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
118PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
Jack Jansen6b08a402004-06-03 12:41:45 +0000119# Deployment target selected during configure, to be checked
Thomas Wouters477c8d52006-05-27 19:21:47 +0000120# by distutils. The export statement is needed to ensure that the
121# deployment target is active during build.
122MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
123@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
124
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000125# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
126OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000127
Martin v. Löwis1142de32002-03-29 16:28:31 +0000128# Environment to run shared python without installed libraries
129RUNSHARED= @RUNSHARED@
130
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000131# Modes for directories, executables and data files created by the
132# install process. Default to user-only-writable for all file types.
133DIRMODE= 755
134EXEMODE= 755
135FILEMODE= 644
136
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000137# configure script arguments
138CONFIG_ARGS= @CONFIG_ARGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000139
140
141# Subdirectories with code
142SRCDIRS= @SRCDIRS@
143
144# Other subdirectories
145SUBDIRSTOO= Include Lib Misc Demo
146
147# Files and directories to be distributed
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000148CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000149DISTFILES= README ChangeLog $(CONFIGFILES)
150DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
151DIST= $(DISTFILES) $(DISTDIRS)
152
153
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000154LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000155LDLIBRARY= @LDLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000156BLDLIBRARY= @BLDLIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000157DLLLIBRARY= @DLLLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000158LDLIBRARYDIR= @LDLIBRARYDIR@
Martin v. Löwis1142de32002-03-29 16:28:31 +0000159INSTSONAME= @INSTSONAME@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000160
161
162LIBS= @LIBS@
163LIBM= @LIBM@
164LIBC= @LIBC@
165SYSLIBS= $(LIBM) $(LIBC)
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000166SHLIBS= @SHLIBS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000167
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000168THREADOBJ= @THREADOBJ@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000169DLINCLDIR= @DLINCLDIR@
170DYNLOADFILE= @DYNLOADFILE@
Jack Jansenc49e5b72001-06-19 15:00:23 +0000171MACHDEP_OBJS= @MACHDEP_OBJS@
Christian Heimes32fbe592007-11-12 15:01:33 +0000172LIBOBJDIR= Python/
173LIBOBJS= @LIBOBJS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000174
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000175PYTHON= python$(EXE)
Jack Jansen1999ef42001-12-06 21:47:20 +0000176BUILDPYTHON= python$(BUILDEXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000177
Christian Heimes33fe8092008-04-13 13:53:33 +0000178# The task to run while instrument when building the profile-opt target
Benjamin Petersonf10a79a2008-10-11 00:49:57 +0000179PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
180#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
Christian Heimes33fe8092008-04-13 13:53:33 +0000181
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000182# === Definitions added by makesetup ===
183
184
185##########################################################################
186# Modules
187MODULE_OBJS= \
188 Modules/config.o \
189 Modules/getpath.o \
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +0000190 Modules/main.o \
191 Modules/gcmodule.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000192
193# Used of signalmodule.o is not available
194SIGNAL_OBJS= @SIGNAL_OBJS@
195
196
197##########################################################################
198# Grammar
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000199GRAMMAR_H= $(srcdir)/Include/graminit.h
200GRAMMAR_C= $(srcdir)/Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000201GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
202
203
204##########################################################################
205# Parser
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000206PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000207
208POBJS= \
209 Parser/acceler.o \
210 Parser/grammar1.o \
211 Parser/listnode.o \
212 Parser/node.o \
213 Parser/parser.o \
214 Parser/parsetok.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000215 Parser/bitset.o \
Guido van Rossumd3ab37f2003-04-17 14:55:42 +0000216 Parser/metagrammar.o \
217 Parser/firstsets.o \
218 Parser/grammar.o \
219 Parser/pgen.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000220
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000221PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000222
223PGOBJS= \
Neil Schemenauerfd1030e2002-04-22 03:05:25 +0000224 Objects/obmalloc.o \
Guido van Rossumf2272522001-12-04 03:54:08 +0000225 Python/mysnprintf.o \
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000226 Parser/tokenizer_pgen.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000227 Parser/printgrammar.o \
228 Parser/pgenmain.o
229
Georg Brandl86def6c2008-01-21 20:36:10 +0000230PARSER_HEADERS= \
231 Parser/parser.h \
232 Parser/tokenizer.h
233
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000234PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
235
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000236##########################################################################
237# AST
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000238AST_H_DIR= $(srcdir)/Include
239AST_H= $(AST_H_DIR)/Python-ast.h
240AST_C_DIR= $(srcdir)/Python
241AST_C= $(AST_C_DIR)/Python-ast.c
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000242AST_ASDL= $(srcdir)/Parser/Python.asdl
243
244ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
245# XXX Note that a build now requires Python exist before the build starts
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000246ASDLGEN= $(srcdir)/Parser/asdl_c.py
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000247
248##########################################################################
249# Python
Antoine Pitroub52ec782009-01-25 16:34:23 +0000250
251OPCODETARGETS_H= \
252 $(srcdir)/Python/opcode_targets.h
253
254OPCODETARGETGEN= \
255 $(srcdir)/Python/makeopcodetargets.py
256
257OPCODETARGETGEN_FILES= \
258 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
259
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000260PYTHON_OBJS= \
Christian Heimes33fe8092008-04-13 13:53:33 +0000261 Python/_warnings.o \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000262 Python/Python-ast.o \
263 Python/asdl.o \
264 Python/ast.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000265 Python/bltinmodule.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000266 Python/ceval.o \
267 Python/compile.o \
268 Python/codecs.o \
269 Python/errors.o \
270 Python/frozen.o \
271 Python/frozenmain.o \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000272 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000273 Python/getargs.o \
274 Python/getcompiler.o \
275 Python/getcopyright.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000276 Python/getplatform.o \
277 Python/getversion.o \
278 Python/graminit.o \
279 Python/import.o \
280 Python/importdl.o \
281 Python/marshal.o \
282 Python/modsupport.o \
283 Python/mystrtoul.o \
Marc-André Lemburge5006eb2001-07-31 13:24:44 +0000284 Python/mysnprintf.o \
Thomas Wouters00ee7ba2006-08-21 19:07:27 +0000285 Python/peephole.o \
Neal Norwitzadb69fc2005-12-17 20:54:49 +0000286 Python/pyarena.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000287 Python/pyfpe.o \
Christian Heimes53876d92008-04-19 00:31:39 +0000288 Python/pymath.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000289 Python/pystate.o \
290 Python/pythonrun.o \
291 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000292 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000293 Python/sysmodule.o \
294 Python/traceback.o \
295 Python/getopt.o \
Christian Heimes99170a52007-12-19 02:07:34 +0000296 Python/pystrcmp.o \
Martin v. Löwis737ea822004-06-08 18:52:54 +0000297 Python/pystrtod.o \
Eric Smith8c663262007-08-25 02:26:07 +0000298 Python/formatter_unicode.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000299 Python/$(DYNLOADFILE) \
Christian Heimes32fbe592007-11-12 15:01:33 +0000300 $(LIBOBJS) \
Jack Jansenc49e5b72001-06-19 15:00:23 +0000301 $(MACHDEP_OBJS) \
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000302 $(THREADOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000303
304
305##########################################################################
306# Objects
307OBJECT_OBJS= \
308 Objects/abstract.o \
Guido van Rossum77f6a652002-04-03 22:41:51 +0000309 Objects/boolobject.o \
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000310 Objects/bytes_methods.o \
Christian Heimes2c9c7a52008-05-26 13:42:13 +0000311 Objects/bytearrayobject.o \
Guido van Rossum4dfe8a12006-04-22 23:28:04 +0000312 Objects/bytesobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000313 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000314 Objects/classobject.o \
315 Objects/cobject.o \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000316 Objects/codeobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000317 Objects/complexobject.o \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000318 Objects/descrobject.o \
Guido van Rossum7dab2422002-04-26 19:40:56 +0000319 Objects/enumobject.o \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000320 Objects/exceptions.o \
Martin v. Löwise440e472004-06-01 15:22:42 +0000321 Objects/genobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000322 Objects/fileobject.o \
323 Objects/floatobject.o \
324 Objects/frameobject.o \
325 Objects/funcobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000326 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000327 Objects/listobject.o \
328 Objects/longobject.o \
329 Objects/dictobject.o \
Travis E. Oliphantb99f7622007-08-18 11:21:56 +0000330 Objects/memoryobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000331 Objects/methodobject.o \
332 Objects/moduleobject.o \
333 Objects/object.o \
Tim Peters1221c0a2002-03-23 00:20:15 +0000334 Objects/obmalloc.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000335 Objects/rangeobject.o \
Raymond Hettingera690a992003-11-16 16:17:49 +0000336 Objects/setobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000337 Objects/sliceobject.o \
Guido van Rossum98bf58f2001-10-18 20:34:25 +0000338 Objects/structseq.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000339 Objects/tupleobject.o \
340 Objects/typeobject.o \
Georg Brandl52d168a2008-01-07 18:10:24 +0000341 Objects/unicodeobject.o \
342 Objects/unicodectype.o \
343 Objects/weakrefobject.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000344
345
346##########################################################################
347# objects that get linked into the Python library
348LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000349 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000350 $(PARSER_OBJS) \
351 $(OBJECT_OBJS) \
352 $(PYTHON_OBJS) \
353 $(MODULE_OBJS) \
354 $(SIGNAL_OBJS) \
355 $(MODOBJS)
356
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000357#########################################################################
358# Rules
359
360# Default target
Guido van Rossum8ce8a782007-11-01 19:42:39 +0000361all: build_all
362build_all: $(BUILDPYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000363
Christian Heimes33fe8092008-04-13 13:53:33 +0000364# Compile a binary with gcc profile guided optimization.
365profile-opt:
366 @echo "Building with support for profile generation:"
367 $(MAKE) clean
368 $(MAKE) build_all_generate_profile
369 @echo "Running benchmark to generate profile data:"
370 $(MAKE) profile-removal
371 $(MAKE) run_profile_task
372 @echo "Rebuilding with profile guided optimizations:"
373 $(MAKE) clean
374 $(MAKE) build_all_use_profile
375
376build_all_generate_profile:
377 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
378
379run_profile_task:
380 ./$(BUILDPYTHON) $(PROFILE_TASK)
381
382build_all_use_profile:
383 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
384
Georg Brandlb533e262008-05-25 18:19:30 +0000385coverage:
386 @echo "Building with support for coverage checking:"
387 $(MAKE) clean
388 $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
389
390
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000391# Build the interpreter
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000392$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
Fred Drakea1a84e72001-03-06 05:52:16 +0000393 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000394 Modules/python.o \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000395 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000396
Jack Jansen1999ef42001-12-06 21:47:20 +0000397platform: $(BUILDPYTHON)
Guido van Rossum452bf512007-02-09 05:32:43 +0000398 $(RUNSHARED) ./$(BUILDPYTHON) -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 +0000399
400
401# Build the shared modules
Jack Jansen1999ef42001-12-06 21:47:20 +0000402sharedmods: $(BUILDPYTHON)
Thomas Wouters89f507f2006-12-13 04:49:30 +0000403 @case $$MAKEFLAGS in \
Christian Heimes1af737c2008-01-23 08:24:23 +0000404 *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
Martin v. Löwis1142de32002-03-29 16:28:31 +0000405 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
Guido van Rossum1140cb22001-09-12 18:59:25 +0000406 esac
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000407
408# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000409# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000410$(LIBRARY): $(LIBRARY_OBJS)
411 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000412 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000413 $(AR) cr $@ $(PARSER_OBJS)
414 $(AR) cr $@ $(OBJECT_OBJS)
415 $(AR) cr $@ $(PYTHON_OBJS)
416 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
417 $(AR) cr $@ $(MODOBJS)
418 $(RANLIB) $@
419
Martin v. Löwis1142de32002-03-29 16:28:31 +0000420libpython$(VERSION).so: $(LIBRARY_OBJS)
Martin v. Löwisbc122622003-06-14 13:11:24 +0000421 if test $(INSTSONAME) != $(LDLIBRARY); then \
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000422 $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
Martin v. Löwis45ec95d2003-03-30 15:37:33 +0000423 $(LN) -f $(INSTSONAME) $@; \
Georg Brandlb1441c72009-01-03 22:33:39 +0000424 else \
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000425 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
Martin v. Löwis45ec95d2003-03-30 15:37:33 +0000426 fi
Martin v. Löwis1142de32002-03-29 16:28:31 +0000427
Georg Brandlb1441c72009-01-03 22:33:39 +0000428libpython$(VERSION).dylib: $(LIBRARY_OBJS)
429 $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
430
431
Martin v. Löwis1142de32002-03-29 16:28:31 +0000432libpython$(VERSION).sl: $(LIBRARY_OBJS)
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000433 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000434
Jack Jansenea0c3822002-08-01 21:57:49 +0000435# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
436# minimal framework (not including the Lib directory and such) in the current
437# directory.
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000438RESSRCDIR=Mac/Resources/framework
Jack Jansenea0c3822002-08-01 21:57:49 +0000439$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
440 $(LIBRARY) \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000441 $(RESSRCDIR)/Info.plist
Jack Jansen246debb2002-02-12 21:30:53 +0000442 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000443 if test "${UNIVERSALSDK}"; then \
Georg Brandlfcaf9102008-07-16 02:17:56 +0000444 $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000445 -isysroot "${UNIVERSALSDK}" \
446 -all_load $(LIBRARY) -Wl,-single_module \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000447 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000448 -compatibility_version $(VERSION) \
449 -current_version $(VERSION); \
450 else \
Guido van Rossumb5a755e2007-07-18 18:15:48 +0000451 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000452 @LIBTOOL_CRUFT@ ;\
453 fi
Jack Jansenea0c3822002-08-01 21:57:49 +0000454 $(INSTALL) -d -m $(DIRMODE) \
455 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
456 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
457 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
Jack Jansenc736b8d2002-08-04 21:17:20 +0000458 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
Jack Jansenb36687a2004-07-16 08:43:47 +0000459 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
Jack Jansenc736b8d2002-08-04 21:17:20 +0000460 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
461 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000462
Jason Tishler30765592003-09-04 11:04:06 +0000463# This rule builds the Cygwin Python DLL and import library if configured
464# for a shared core library; otherwise, this rule is a noop.
465$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
466 if test -n "$(DLLLIBRARY)"; then \
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000467 $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
468 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
Jason Tishler30765592003-09-04 11:04:06 +0000469 else true; \
470 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000471
472
473oldsharedmods: $(SHAREDMODS)
474
475
476Makefile Modules/config.c: Makefile.pre \
477 $(srcdir)/Modules/config.c.in \
478 $(MAKESETUP) \
479 Modules/Setup.config \
480 Modules/Setup \
481 Modules/Setup.local
482 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
483 -s Modules \
484 Modules/Setup.config \
485 Modules/Setup.local \
486 Modules/Setup
487 @mv config.c Modules
488 @echo "The Makefile was updated, you may need to re-run make."
489
490
491Modules/Setup: $(srcdir)/Modules/Setup.dist
492 @if test -f Modules/Setup; then \
493 echo "-----------------------------------------------"; \
494 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
495 echo "check to make sure you have all the updates you"; \
496 echo "need in your Modules/Setup file."; \
Alexandre Vassalottieca20b62008-05-16 02:54:33 +0000497 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000498 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000499 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000500
501############################################################################
502# Special rules for object files
503
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000504Modules/getbuildinfo.o: $(PARSER_OBJS) \
505 $(OBJECT_OBJS) \
506 $(PYTHON_OBJS) \
507 $(MODULE_OBJS) \
508 $(SIGNAL_OBJS) \
509 $(MODOBJS) \
510 $(srcdir)/Modules/getbuildinfo.c
Thomas Wouters89f507f2006-12-13 04:49:30 +0000511 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000512
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000513Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000514 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
515 -DPREFIX='"$(prefix)"' \
516 -DEXEC_PREFIX='"$(exec_prefix)"' \
517 -DVERSION='"$(VERSION)"' \
518 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000519 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000520
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000521Modules/python.o: $(srcdir)/Modules/python.c
522 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000523
524
525$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Guido van Rossum8ce8a782007-11-01 19:42:39 +0000526 -@$(INSTALL) -d Include
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000527 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000528
529$(PGEN): $(PGENOBJS)
Martin v. Löwis6702d8a2003-07-13 10:10:42 +0000530 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000531
532Parser/grammar.o: $(srcdir)/Parser/grammar.c \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000533 $(srcdir)/Include/token.h \
534 $(srcdir)/Include/grammar.h
535Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
536
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000537Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
538
Thomas Woutersfc7bb8c2007-01-15 15:49:28 +0000539Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
540
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000541$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
542 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000543
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000544$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
545 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000546
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000547Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
Neil Schemenauer40417742001-02-27 02:45:36 +0000548
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000549Python/getplatform.o: $(srcdir)/Python/getplatform.c
Mark Hammond8235ea12002-07-19 06:55:41 +0000550 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000551
552Python/importdl.o: $(srcdir)/Python/importdl.c
Mark Hammond8235ea12002-07-19 06:55:41 +0000553 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000554
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000555Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
556 $(srcdir)/Objects/unicodetype_db.h
557
Christian Heimesda996832008-03-22 18:37:22 +0000558BYTESTR_DEPS = \
Neal Norwitz22c65422008-03-24 05:03:36 +0000559 $(srcdir)/Include/bytes_methods.h \
Christian Heimesda996832008-03-22 18:37:22 +0000560 $(srcdir)/Objects/stringlib/count.h \
561 $(srcdir)/Objects/stringlib/ctype.h \
562 $(srcdir)/Objects/stringlib/eq.h \
563 $(srcdir)/Objects/stringlib/fastsearch.h \
564 $(srcdir)/Objects/stringlib/find.h \
565 $(srcdir)/Objects/stringlib/partition.h \
566 $(srcdir)/Objects/stringlib/stringdefs.h \
567 $(srcdir)/Objects/stringlib/string_format.h \
568 $(srcdir)/Objects/stringlib/transmogrify.h \
569 $(srcdir)/Objects/stringlib/unicodedefs.h \
Eric Smith5807c412008-05-11 21:00:57 +0000570 $(srcdir)/Objects/stringlib/localeutil.h
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000571
Benjamin Peterson9ae32202009-01-13 21:53:28 +0000572Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000573
Benjamin Peterson9ae32202009-01-13 21:53:28 +0000574Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000575
Eric Smith8c663262007-08-25 02:26:07 +0000576Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
Benjamin Petersonb197fec2009-01-13 22:25:18 +0000577 $(BYTESTR_DEPS) \
578 $(srcdir)/Objects/stringlib/formatter.h
Eric Smith8c663262007-08-25 02:26:07 +0000579
Antoine Pitroub52ec782009-01-25 16:34:23 +0000580$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
581 $(OPCODETARGETGEN) $(OPCODETARGETS_H)
582
583Python/ceval.o: $(OPCODETARGETS_H)
584
Eric Smith8c663262007-08-25 02:26:07 +0000585Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
Benjamin Petersonb197fec2009-01-13 22:25:18 +0000586 $(BYTESTR_DEPS)
Eric Smith8c663262007-08-25 02:26:07 +0000587
588
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000589############################################################################
590# Header files
591
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000592PYTHON_HEADERS= \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000593 Include/Python-ast.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000594 Include/Python.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000595 Include/abstract.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000596 Include/asdl.h \
597 Include/ast.h \
598 Include/bitset.h \
Guido van Rossum77f6a652002-04-03 22:41:51 +0000599 Include/boolobject.h \
Christian Heimesf78b1c62007-12-02 16:52:32 +0000600 Include/bytes_methods.h \
Christian Heimes2c9c7a52008-05-26 13:42:13 +0000601 Include/bytearrayobject.h \
Guido van Rossum4dfe8a12006-04-22 23:28:04 +0000602 Include/bytesobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000603 Include/cellobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000604 Include/ceval.h \
605 Include/classobject.h \
606 Include/cobject.h \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000607 Include/code.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000608 Include/codecs.h \
609 Include/compile.h \
610 Include/complexobject.h \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000611 Include/descrobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000612 Include/dictobject.h \
Guido van Rossum7dab2422002-04-26 19:40:56 +0000613 Include/enumobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000614 Include/errcode.h \
615 Include/eval.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000616 Include/fileobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000617 Include/floatobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000618 Include/frameobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000619 Include/funcobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000620 Include/genobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000621 Include/import.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000622 Include/intrcheck.h \
623 Include/iterobject.h \
624 Include/listobject.h \
Christian Heimesf78b1c62007-12-02 16:52:32 +0000625 Include/longintrepr.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000626 Include/longobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000627 Include/marshal.h \
Travis E. Oliphantb99f7622007-08-18 11:21:56 +0000628 Include/memoryobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000629 Include/metagrammar.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000630 Include/methodobject.h \
631 Include/modsupport.h \
632 Include/moduleobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000633 Include/node.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000634 Include/object.h \
635 Include/objimpl.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000636 Include/opcode.h \
637 Include/osdefs.h \
Thomas Woutersfc7bb8c2007-01-15 15:49:28 +0000638 Include/parsetok.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000639 Include/patchlevel.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000640 Include/pgen.h \
641 Include/pgenheaders.h \
Neal Norwitzadb69fc2005-12-17 20:54:49 +0000642 Include/pyarena.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000643 Include/pydebug.h \
644 Include/pyerrors.h \
645 Include/pyfpe.h \
Christian Heimes53876d92008-04-19 00:31:39 +0000646 Include/pymath.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000647 Include/pygetopt.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000648 Include/pymem.h \
649 Include/pyport.h \
650 Include/pystate.h \
Christian Heimes99170a52007-12-19 02:07:34 +0000651 Include/pystrcmp.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000652 Include/pystrtod.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000653 Include/pythonrun.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000654 Include/pythread.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000655 Include/rangeobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000656 Include/setobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000657 Include/sliceobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000658 Include/structmember.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000659 Include/structseq.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000660 Include/symtable.h \
661 Include/sysmodule.h \
662 Include/traceback.h \
663 Include/tupleobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000664 Include/ucnhash.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000665 Include/unicodeobject.h \
Christian Heimes33fe8092008-04-13 13:53:33 +0000666 Include/warnings.h \
Fred Drake502ed822001-10-05 21:56:02 +0000667 Include/weakrefobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000668 pyconfig.h \
669 $(PARSER_HEADERS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000670
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000671$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000672
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000673
674######################################################################
675
676# Test the interpreter (twice, once without .pyc files, once with)
Skip Montanaroc9803ab2003-05-06 16:17:27 +0000677# In the past, we've had problems where bugs in the marshalling or
678# elsewhere caused bytecode read from .pyc files to behave differently
679# than bytecode generated directly from a .py source file. Sometimes
680# the bytecode read from a .pyc file had the bug, somtimes the directly
681# generated bytecode. This is sometimes a very shy bug needing a lot of
682# sample data.
683
Neal Norwitzdf431652006-02-22 07:24:06 +0000684TESTOPTS= -l $(EXTRATESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000685TESTPROG= $(srcdir)/Lib/test/regrtest.py
Georg Brandle1b5ac62008-06-04 13:06:58 +0000686TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -bb
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000687test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000688 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000689 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
690 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000691
Skip Montanaro446ad712003-05-06 15:30:20 +0000692testall: all platform
693 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Thomas Woutersd2d29152008-01-25 23:21:16 +0000694 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
Christian Heimes905a9042007-11-21 02:51:50 +0000695 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Skip Montanaro446ad712003-05-06 15:30:20 +0000696 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
697 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
698
Thomas Wouters477c8d52006-05-27 19:21:47 +0000699# Run the unitests for both architectures in a Universal build on OSX
700# Must be run on an Intel box.
701testuniversal: all platform
702 if [ `arch` != 'i386' ];then \
703 echo "This can only be used on OSX/i386" ;\
704 exit 1 ;\
705 fi
706 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
707 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
708 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
Georg Brandle1b5ac62008-06-04 13:06:58 +0000709 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
Thomas Wouters477c8d52006-05-27 19:21:47 +0000710
711
Martin v. Löwisbfa8bd72006-03-13 10:59:32 +0000712# Like testall, but with a single pass only
Thomas Wouters89d996e2007-09-08 17:39:28 +0000713# run an optional script to include some information about the build environment
Martin v. Löwisbfa8bd72006-03-13 10:59:32 +0000714buildbottest: all platform
Thomas Wouters89d996e2007-09-08 17:39:28 +0000715 -@if which pybuildbot.identify >/dev/null 2>&1; then \
716 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
717 fi
Martin v. Löwisbfa8bd72006-03-13 10:59:32 +0000718 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
719
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000720QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000721 test_unicodedata test_re test_sre test_select test_poll \
Guido van Rossum33d26892007-08-05 15:29:28 +0000722 test_struct test_zlib
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000723quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000724 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000725 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
726 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000727
Barry Warsaw42119252001-03-03 04:14:21 +0000728MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
729 test_longexp
730memtest: all platform
731 -rm -f $(srcdir)/Lib/test/*.py[co]
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000732 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
733 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
Barry Warsaw42119252001-03-03 04:14:21 +0000734
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000735# Install everything
Guido van Rossumdc21db32008-04-07 18:37:41 +0000736fullinstall: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
737
738# "make install" is an alias for "make altinstall" since we never want to
739# overwrite Python 2.x.
740install: altinstall
Guido van Rossum6d4df9b2008-05-08 17:53:56 +0000741 @echo "* Note: not installed as 'python'."
742 @echo "* Use 'make fullinstall' to install as 'python'."
743 @echo "* However, 'make fullinstall' is discouraged,"
744 @echo "* as it will clobber your Python 2.x installation."
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000745
746# Install almost everything without disturbing previous versions
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000747altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
748 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000749
750# Install shared libraries enabled by Setup
751DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
752
753oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
754 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000755 if test $$i != X; then \
756 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000757 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
Neil Schemenauerac959772001-02-06 14:50:27 +0000758 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000759 done
760
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000761$(DESTSHARED):
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000762 @for i in $(DESTDIRS); \
763 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000764 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000765 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000766 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000767 else true; \
768 fi; \
769 done
770
771
772# Install the interpreter (by creating a hard link to python$(VERSION))
773bininstall: altbininstall
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000774 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
775 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000776 else true; \
777 fi
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000778 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Thomas Wouters89d996e2007-09-08 17:39:28 +0000779 -rm -f $(DESTDIR)$(BINDIR)/python-config
780 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000781
782# Install the interpreter with $(VERSION) affixed
783# This goes into $(exec_prefix)
Jack Jansen1999ef42001-12-06 21:47:20 +0000784altbininstall: $(BUILDPYTHON)
Martin v. Löwisd8a20d22002-05-08 08:59:59 +0000785 @for i in $(BINDIR) $(LIBDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000786 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000787 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000788 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000789 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000790 else true; \
791 fi; \
792 done
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000793 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
Georg Brandlb1441c72009-01-03 22:33:39 +0000794 if test -f $(LDLIBRARY); then \
Georg Brandl1f01deb2009-01-03 22:47:39 +0000795 if test -n "$(DLLLIBRARY)" ; then \
796 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000797 else \
Georg Brandlb1441c72009-01-03 22:33:39 +0000798 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
799 if test $(LDLIBRARY) != $(INSTSONAME); then \
800 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
Martin v. Löwise3be8602003-11-18 19:54:20 +0000801 fi \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000802 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000803 else true; \
804 fi
805
806# Install the manual page
807maninstall:
808 @for i in $(MANDIR) $(MANDIR)/man1; \
809 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000810 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000811 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000812 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000813 else true; \
814 fi; \
815 done
816 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Benjamin Peterson1a6e0d02008-10-25 15:49:17 +0000817 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000818
819# Install the library
820PLATDIR= plat-$(MACHDEP)
Jack Jansen83f898c2002-12-30 22:23:40 +0000821EXTRAPLATDIR= @EXTRAPLATDIR@
822MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000823XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
Georg Brandl6e47a332008-05-17 19:15:58 +0000824LIBSUBDIRS= tkinter site-packages test test/output test/data \
Anthony Baxter1e2bd5b2004-07-12 09:25:18 +0000825 test/decimaltestdata \
Fred Drake0e474a82007-10-11 18:01:43 +0000826 encodings \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000827 email email/mime email/test email/test/data \
Brett Cannon35af8d42008-05-26 18:56:21 +0000828 html json json/tests http dbm xmlrpc \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000829 sqlite3 sqlite3/test \
Jeremy Hylton1afc1692008-06-18 20:49:58 +0000830 logging bsddb bsddb/test csv wsgiref urllib \
Alexandre Vassalottie9f305f2008-05-16 04:39:54 +0000831 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000832 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
Fred Drakee612c8e2005-01-19 06:24:58 +0000833 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000834 setuptools setuptools/command setuptools/tests setuptools.egg-info \
Benjamin Peterson6bf2d6b2008-06-20 02:54:41 +0000835 multiprocessing multiprocessing/dummy \
Fred Drakee612c8e2005-01-19 06:24:58 +0000836 curses $(MACHDEPS)
Guido van Rossum8ce8a782007-11-01 19:42:39 +0000837libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000838 @for i in $(SCRIPTDIR) $(LIBDEST); \
839 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000840 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000841 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000842 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000843 else true; \
844 fi; \
845 done
846 @for d in $(LIBSUBDIRS); \
847 do \
848 a=$(srcdir)/Lib/$$d; \
849 if test ! -d $$a; then continue; else true; fi; \
850 b=$(LIBDEST)/$$d; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000851 if test ! -d $(DESTDIR)$$b; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000852 echo "Creating directory $$b"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000853 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000854 else true; \
855 fi; \
856 done
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000857 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000858 do \
859 if test -x $$i; then \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000860 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000861 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000862 else \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000863 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000864 echo $(INSTALL_DATA) $$i $(LIBDEST); \
865 fi; \
866 done
867 @for d in $(LIBSUBDIRS); \
868 do \
869 a=$(srcdir)/Lib/$$d; \
870 if test ! -d $$a; then continue; else true; fi; \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000871 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000872 b=$(LIBDEST)/$$d; \
873 for i in $$a/*; \
874 do \
875 case $$i in \
876 *CVS) ;; \
877 *.py[co]) ;; \
878 *.orig) ;; \
879 *~) ;; \
880 *) \
881 if test -d $$i; then continue; fi; \
882 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000883 echo $(INSTALL_SCRIPT) $$i $$b; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000884 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000885 else \
886 echo $(INSTALL_DATA) $$i $$b; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000887 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000888 fi;; \
889 esac; \
890 done; \
891 done
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000892 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
Guido van Rossum827bfd02007-07-15 13:12:42 +0000893 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
Georg Brandle1b5ac62008-06-04 13:06:58 +0000894 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +0000895 -d $(LIBDEST) -f \
Neal Norwitz892a33f2005-10-04 04:32:42 +0000896 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
Guido van Rossum827bfd02007-07-15 13:12:42 +0000897 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
Georg Brandle1b5ac62008-06-04 13:06:58 +0000898 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +0000899 -d $(LIBDEST) -f \
Neal Norwitz892a33f2005-10-04 04:32:42 +0000900 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
Hye-Shik Chang0e5e6c72004-03-18 07:51:27 +0000901 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
Georg Brandle1b5ac62008-06-04 13:06:58 +0000902 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +0000903 -d $(LIBDEST)/site-packages -f \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000904 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
Hye-Shik Chang0e5e6c72004-03-18 07:51:27 +0000905 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
Georg Brandle1b5ac62008-06-04 13:06:58 +0000906 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +0000907 -d $(LIBDEST)/site-packages -f \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000908 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
Martin v. Löwis3faa84f2008-03-22 00:07:09 +0000909 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
Martin v. Löwis4fe5ed82008-08-01 14:15:22 +0000910 ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000911
912# Create the PLATDIR source directory, if one wasn't distributed..
913$(srcdir)/Lib/$(PLATDIR):
914 mkdir $(srcdir)/Lib/$(PLATDIR)
915 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
916 export PATH; PATH="`pwd`:$$PATH"; \
917 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000918 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
Jack Jansen0d153662001-12-19 09:24:40 +0000919 export EXE; EXE="$(BUILDEXE)"; \
Benjamin Petersonfce25a72008-12-30 18:05:46 +0000920 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000921
922# Install the include files
923INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
924inclinstall:
925 @for i in $(INCLDIRSTOMAKE); \
926 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000927 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000928 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000929 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000930 else true; \
931 fi; \
932 done
933 @for i in $(srcdir)/Include/*.h; \
934 do \
935 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000936 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000937 done
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000938 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000939
940# Install the library and miscellaneous stuff needed for extending/embedding
941# This goes into $(exec_prefix)
942LIBPL= $(LIBP)/config
943libainstall: all
944 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
945 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000946 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000947 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000948 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000949 else true; \
950 fi; \
951 done
Martin v. Löwis1142de32002-03-29 16:28:31 +0000952 @if test -d $(LIBRARY); then :; else \
Jack Jansen127e56e2001-09-11 14:41:54 +0000953 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000954 if test "$(SO)" = .dll; then \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000955 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000956 else \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000957 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
958 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000959 fi; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000960 else \
Martin v. Löwis1142de32002-03-29 16:28:31 +0000961 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000962 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000963 fi
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000964 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000965 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000966 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
967 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
968 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
969 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
970 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
971 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
972 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000973 # Substitution happens here, as the completely-expanded BINDIR
974 # is not available in configure
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000975 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
976 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000977 rm python-config
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000978 @if [ -s Modules/python.exp -a \
979 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
980 echo; echo "Installing support files for building shared extension modules on AIX:"; \
981 $(INSTALL_DATA) Modules/python.exp \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000982 $(DESTDIR)$(LIBPL)/python.exp; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000983 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000984 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000985 $(DESTDIR)$(LIBPL)/makexp_aix; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000986 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000987 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000988 $(DESTDIR)$(LIBPL)/ld_so_aix; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000989 echo "$(LIBPL)/ld_so_aix"; \
990 echo; echo "See Misc/AIX-NOTES for details."; \
991 else true; \
992 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000993
994# Install the dynamically loadable modules
995# This goes into $(exec_prefix)
996sharedinstall:
Martin v. Löwis1142de32002-03-29 16:28:31 +0000997 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
998 --prefix=$(prefix) \
Guido van Rossumb33e7892001-10-17 06:26:53 +0000999 --install-scripts=$(BINDIR) \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001000 --install-platlib=$(DESTSHARED) \
1001 --root=/$(DESTDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001002
Jack Jansencb4321e2002-08-09 00:18:21 +00001003# Here are a couple of targets for MacOSX again, to install a full
1004# framework-based Python. frameworkinstall installs everything, the
1005# subtargets install specific parts. Much of the actual work is offloaded to
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001006# the Makefile in Mac
Jack Jansencb4321e2002-08-09 00:18:21 +00001007#
Thomas Wouters477c8d52006-05-27 19:21:47 +00001008#
1009# This target is here for backward compatiblity, previous versions of Python
1010# hadn't integrated framework installation in the normal install process.
1011frameworkinstall: install
Guido van Rossumed2f7252002-08-09 19:18:25 +00001012
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001013# On install, we re-make the framework
1014# structure in the install location, /Library/Frameworks/ or the argument to
1015# --enable-framework. If --enable-framework has been specified then we have
1016# automatically set prefix to the location deep down in the framework, so we
1017# only have to cater for the structural bits of the framework.
1018
Jack Jansencb4321e2002-08-09 00:18:21 +00001019frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1020
1021frameworkinstallstructure: $(LDLIBRARY)
Jack Jansen127e56e2001-09-11 14:41:54 +00001022 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001023 echo Not configured with --enable-framework; \
Jack Jansen127e56e2001-09-11 14:41:54 +00001024 exit 1; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001025 else true; \
1026 fi
Jack Jansencb4321e2002-08-09 00:18:21 +00001027 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001028 if test ! -d $(DESTDIR)$$i; then \
Jack Jansen9592fe92003-05-25 22:01:32 +00001029 echo "Creating directory $(DESTDIR)$$i"; \
1030 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001031 else true; \
1032 fi; \
1033 done
Jack Jansen9592fe92003-05-25 22:01:32 +00001034 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
Benjamin Peterson4c29b472008-07-01 14:42:51 +00001035 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
Jack Jansen9592fe92003-05-25 22:01:32 +00001036 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
Christian Heimes81ee3ef2008-05-04 22:42:01 +00001037 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
Jack Jansen9592fe92003-05-25 22:01:32 +00001038 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1039 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
Jack Jansen4735b232003-06-20 20:36:53 +00001040 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00001041
Jack Jansencb4321e2002-08-09 00:18:21 +00001042# This installs Mac/Lib into the framework
Thomas Wouters0e3f5912006-08-11 14:57:12 +00001043# Install a number of symlinks to keep software that expects a normal unix
1044# install (which includes python-config) happy.
Jack Jansencb4321e2002-08-09 00:18:21 +00001045frameworkinstallmaclib:
Christian Heimes81ee3ef2008-05-04 22:42:01 +00001046 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
Jack Jansencb4321e2002-08-09 00:18:21 +00001047
1048# This installs the IDE, the Launcher and other apps into /Applications
1049frameworkinstallapps:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001050 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
Jack Jansencb4321e2002-08-09 00:18:21 +00001051
Georg Brandlfcaf9102008-07-16 02:17:56 +00001052frameworkinstallapps4way:
1053 cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
1054
Jack Jansencb4321e2002-08-09 00:18:21 +00001055# This install the unix python and pythonw tools in /usr/local/bin
1056frameworkinstallunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001057 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1058
Georg Brandlfcaf9102008-07-16 02:17:56 +00001059frameworkinstallunixtools4way:
1060 cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
1061
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001062frameworkaltinstallunixtools:
1063 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
Jack Jansen0b06be72002-06-21 14:48:38 +00001064
Georg Brandlfcaf9102008-07-16 02:17:56 +00001065frameworkaltinstallunixtools4way:
1066 cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
1067
Jack Jansena1b77582003-06-19 22:35:20 +00001068# This installs the Demos and Tools into the applications directory.
1069# It is not part of a normal frameworkinstall
1070frameworkinstallextras:
Mark Dickinson09027aa2008-12-18 19:49:35 +00001071 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
Jack Jansena1b77582003-06-19 22:35:20 +00001072
Skip Montanarodecc6a42003-01-01 20:07:49 +00001073# This installs a few of the useful scripts in Tools/scripts
1074scriptsinstall:
Martin v. Löwis01f43112003-01-03 20:39:29 +00001075 SRCDIR=$(srcdir) $(RUNSHARED) \
Skip Montanarodecc6a42003-01-01 20:07:49 +00001076 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1077 --prefix=$(prefix) \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001078 --install-scripts=$(BINDIR) \
1079 --root=/$(DESTDIR)
Skip Montanarodecc6a42003-01-01 20:07:49 +00001080
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001081# Build the toplevel Makefile
1082Makefile.pre: Makefile.pre.in config.status
1083 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1084 $(MAKE) -f Makefile.pre Makefile
1085
Neil Schemenauer64b1b682001-03-22 00:32:32 +00001086# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001087config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +00001088 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001089
Jack Jansen1999ef42001-12-06 21:47:20 +00001090.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001091
1092# Some make's put the object file in the current directory
1093.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +00001094 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001095
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001096# Run reindent on the library
1097reindent:
Christian Heimesfd66e512008-01-29 12:18:50 +00001098 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001099
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001100# Rerun configure with the same options as it was run last time,
1101# provided the config.status script exists
1102recheck:
1103 $(SHELL) config.status --recheck
1104 $(SHELL) config.status
1105
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00001106# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001107autoconf:
1108 (cd $(srcdir); autoconf)
1109 (cd $(srcdir); autoheader)
1110
1111# Create a tags file for vi
1112tags::
1113 cd $(srcdir); \
1114 ctags -w -t Include/*.h; \
1115 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1116 done; \
Guido van Rossumc9489662002-02-28 19:26:08 +00001117 sort -o tags tags
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001118
1119# Create a tags file for GNU Emacs
1120TAGS::
1121 cd $(srcdir); \
1122 etags Include/*.h; \
1123 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1124
1125# Sanitation targets -- clean leaves libraries, executables and tags
1126# files, which clobber removes those as well
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001127pycremoval:
1128 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001129
Guido van Rossum77b5e332007-08-29 23:24:02 +00001130rmtestturds:
1131 -rm -f *BAD *GOOD *SKIPPED
1132 -rm -rf OUT
1133 -rm -f *.TXT
1134 -rm -f *.txt
1135 -rm -f gb-18030-2000.xml
1136
Guido van Rossum8188e632007-08-29 23:48:29 +00001137docclean:
1138 -rm -rf Doc/build
1139 -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1140
Guido van Rossum5420bc32007-08-29 23:35:30 +00001141clean: pycremoval
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +00001142 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +00001143 find . -name '*.s[ol]' -exec rm -f {} ';'
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001144 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1145 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001146
Christian Heimes33fe8092008-04-13 13:53:33 +00001147profile-removal:
1148 find . -name '*.gc??' -exec rm -f {} ';'
1149
1150clobber: clean profile-removal
Jack Jansen1999ef42001-12-06 21:47:20 +00001151 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +00001152 tags TAGS \
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00001153 config.cache config.log pyconfig.h Modules/config.c
Guido van Rossum1d88c592001-06-06 17:51:57 +00001154 -rm -rf build platform
Jack Jansenc6096892003-02-27 23:19:46 +00001155 -rm -rf $(PYTHONFRAMEWORKDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001156
1157# Make things extra clean, before making a distribution:
1158# remove all generated files, even Makefile[.pre]
Neal Norwitz1a196b52006-01-03 01:38:53 +00001159# Keep configure and Python-ast.[ch], it's possible they can't be generated
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001160distclean: clobber
Martin v. Löwisdea59e52006-01-05 10:00:36 +00001161 -rm -f core Makefile Makefile.pre config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +00001162 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +00001163 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1164 -o -name '[@,#]*' -o -name '*.old' \
1165 -o -name '*.orig' -o -name '*.rej' \
1166 -o -name '*.bak' ')' \
1167 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001168
1169# Check for smelly exported symbols (not starting with Py/_Py)
1170smelly: all
1171 nm -p $(LIBRARY) | \
1172 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1173
1174# Find files with funny names
1175funny:
Guido van Rossum77b5e332007-08-29 23:24:02 +00001176 find $(DISTDIRS) \
1177 -name .svn -prune \
1178 -o -type d \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001179 -o -name '*.[chs]' \
1180 -o -name '*.py' \
1181 -o -name '*.doc' \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001182 -o -name '*.dat' \
1183 -o -name '*.el' \
1184 -o -name '*.fd' \
1185 -o -name '*.in' \
Guido van Rossum77b5e332007-08-29 23:24:02 +00001186 -o -name '*.gif' \
1187 -o -name '*.txt' \
1188 -o -name '*.xml' \
1189 -o -name '*.xbm' \
1190 -o -name '*.xpm' \
1191 -o -name '*.uue' \
1192 -o -name '*.decTest' \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001193 -o -name '*,[vpt]' \
1194 -o -name 'Setup' \
1195 -o -name 'Setup.*' \
Guido van Rossum77b5e332007-08-29 23:24:02 +00001196 -o -name regen \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001197 -o -name README \
1198 -o -name Makefile \
1199 -o -name ChangeLog \
1200 -o -name Repository \
1201 -o -name Root \
1202 -o -name Entries \
1203 -o -name Tag \
1204 -o -name tags \
1205 -o -name TAGS \
1206 -o -name .cvsignore \
1207 -o -name MANIFEST \
1208 -o -print
1209
Christian Heimesada8c3b2008-03-18 18:26:33 +00001210# Perform some verification checks on any modified files.
Brett Cannona741ebf2008-09-05 23:01:27 +00001211patchcheck:
Georg Brandlfcaf9102008-07-16 02:17:56 +00001212 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
Christian Heimesada8c3b2008-03-18 18:26:33 +00001213
Guido van Rossum9454ad72001-08-18 21:08:22 +00001214# Dependencies
1215
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00001216Python/thread.o: @THREADHEADERS@
Guido van Rossum9454ad72001-08-18 21:08:22 +00001217
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001218# Declare targets that aren't real files
Guido van Rossum8ce8a782007-11-01 19:42:39 +00001219.PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001220.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1221.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1222.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1223.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001224.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
Brett Cannon16512cd2008-10-06 22:48:11 +00001225.PHONY: smelly funny patchcheck
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001226
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001227# IF YOU PUT ANYTHING HERE IT WILL GO AWAY