blob: ece1f34063cc800b025ec2f42fcda173f6492021 [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@
Trent Nelson739fc542012-10-17 04:45:30 -040030abs_srcdir= @abs_srcdir@
31abs_builddir= @abs_builddir@
Trent Nelson9effe692012-10-16 08:41:32 -040032
Neil Schemenauer85515ad2001-01-24 17:11:43 +000033
34CC= @CC@
35CXX= @CXX@
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000036MAINCC= @MAINCC@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000037LINKCC= @LINKCC@
38AR= @AR@
39RANLIB= @RANLIB@
doko@ubuntu.com58844492012-06-30 18:25:32 +020040READELF= @READELF@
Georg Brandl0d169ea2010-09-03 22:14:52 +000041SOABI= @SOABI@
Barry Warsaw8cf4eae2010-10-16 01:04:07 +000042LDVERSION= @LDVERSION@
Georg Brandl1ca2e792011-03-05 20:51:24 +010043HGVERSION= @HGVERSION@
44HGTAG= @HGTAG@
45HGBRANCH= @HGBRANCH@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000046
Georg Brandl0d169ea2010-09-03 22:14:52 +000047GNULD= @GNULD@
Tarek Ziadébe720e02009-05-09 11:55:12 +000048
Neil Schemenauer85515ad2001-01-24 17:11:43 +000049# Shell used by make (some versions default to the login shell, which is bad)
50SHELL= /bin/sh
51
52# Use this to make a link between python$(VERSION) and python in $(BINDIR)
53LN= @LN@
54
55# Portable install script (configure doesn't always guess right)
56INSTALL= @INSTALL@
57INSTALL_PROGRAM=@INSTALL_PROGRAM@
Neil Schemenauer3f5cc202001-04-10 23:03:35 +000058INSTALL_SCRIPT= @INSTALL_SCRIPT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000059INSTALL_DATA= @INSTALL_DATA@
60# Shared libraries must be installed with executable mode on some systems;
61# rather than figuring out exactly which, we always give them executable mode.
62# Also, making them read-only seems to be a good idea...
63INSTALL_SHARED= ${INSTALL} -m 555
64
Matthias Klose93a0ef12012-03-15 18:08:34 +010065MKDIR_P= @MKDIR_P@
66
Neil Schemenauer85515ad2001-01-24 17:11:43 +000067MAKESETUP= $(srcdir)/Modules/makesetup
68
69# Compiler options
70OPT= @OPT@
Skip Montanarodecc6a42003-01-01 20:07:49 +000071BASECFLAGS= @BASECFLAGS@
Trent Nelson9effe692012-10-16 08:41:32 -040072BASECPPFLAGS= @BASECPPFLAGS@
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +000073CONFIGURE_CFLAGS= @CFLAGS@
74CONFIGURE_CPPFLAGS= @CPPFLAGS@
75CONFIGURE_LDFLAGS= @LDFLAGS@
76# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
77# command line to append to these values without stomping the pre-set
78# values.
79PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
Brett Cannon516592f2004-12-07 00:42:59 +000080# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
81# be able to build extension modules using the directories specified in the
82# environment variables
Trent Nelson9effe692012-10-16 08:41:32 -040083PY_CPPFLAGS= $(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +000084PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
Martin v. Löwis48e14d32011-05-09 07:37:45 +020085NO_AS_NEEDED= @NO_AS_NEEDED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000086LDLAST= @LDLAST@
87SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000088CCSHARED= @CCSHARED@
89LINKFORSHARED= @LINKFORSHARED@
Tarek Ziadé5662d3e2009-05-07 21:24:43 +000090ARFLAGS= @ARFLAGS@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000091# Extra C flags added for building the interpreter object files.
92CFLAGSFORSHARED=@CFLAGSFORSHARED@
93# C flags used for building the interpreter object files
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +000094PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000095
Neil Schemenauer85515ad2001-01-24 17:11:43 +000096
97# Machine-dependent subdirectories
98MACHDEP= @MACHDEP@
99
100# Install prefix for architecture-independent files
101prefix= @prefix@
102
103# Install prefix for architecture-dependent files
104exec_prefix= @exec_prefix@
105
Thomas Woutersbca54802007-09-10 19:32:14 +0000106# Install prefix for data files
107datarootdir= @datarootdir@
108
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000109# Expanded directories
Antoine Pitrou7a61ba92010-03-21 19:25:26 +0000110BINDIR= @bindir@
111LIBDIR= @libdir@
Martin v. Löwisd429ab62001-08-02 06:20:20 +0000112MANDIR= @mandir@
113INCLUDEDIR= @includedir@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000114CONFINCLUDEDIR= $(exec_prefix)/include
115SCRIPTDIR= $(prefix)/lib
Barry Warsaw8cf4eae2010-10-16 01:04:07 +0000116ABIFLAGS= @ABIFLAGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000117
118# Detailed destination directories
119BINLIBDEST= $(LIBDIR)/python$(VERSION)
120LIBDEST= $(SCRIPTDIR)/python$(VERSION)
Barry Warsaw14d98ac2010-11-24 19:43:47 +0000121INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
122CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000123
124# Symbols used for using shared libraries
125SO= @SO@
Antoine Pitroudbec7802010-10-10 09:37:12 +0000126LDSHARED= @LDSHARED@ $(PY_LDFLAGS)
127BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS)
Tarek Ziadé03d788d2010-04-03 08:46:49 +0000128LDCXXSHARED= @LDCXXSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000129DESTSHARED= $(BINLIBDEST)/lib-dynload
130
131# Executable suffix (.exe on Windows and Mac OS X)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000132EXE= @EXEEXT@
Jack Jansen1999ef42001-12-06 21:47:20 +0000133BUILDEXE= @BUILDEXEEXT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000134
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000135# Short name and location for Mac OS X Python framework
Thomas Wouters477c8d52006-05-27 19:21:47 +0000136UNIVERSALSDK=@UNIVERSALSDK@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000137PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
138PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
139PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
140PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
Jack Jansen6b08a402004-06-03 12:41:45 +0000141# Deployment target selected during configure, to be checked
Thomas Wouters477c8d52006-05-27 19:21:47 +0000142# by distutils. The export statement is needed to ensure that the
143# deployment target is active during build.
144MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
145@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
146
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000147# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
148OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000149
Martin v. Löwis1142de32002-03-29 16:28:31 +0000150# Environment to run shared python without installed libraries
151RUNSHARED= @RUNSHARED@
152
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000153# Modes for directories, executables and data files created by the
154# install process. Default to user-only-writable for all file types.
155DIRMODE= 755
156EXEMODE= 755
157FILEMODE= 644
158
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000159# configure script arguments
160CONFIG_ARGS= @CONFIG_ARGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000161
162
163# Subdirectories with code
164SRCDIRS= @SRCDIRS@
165
166# Other subdirectories
Georg Brandl59b44722010-12-30 22:12:40 +0000167SUBDIRSTOO= Include Lib Misc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000168
169# Files and directories to be distributed
Matthias Klose0f4c16e2012-03-14 23:10:15 +0100170CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000171DISTFILES= README ChangeLog $(CONFIGFILES)
172DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
173DIST= $(DISTFILES) $(DISTDIRS)
174
175
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000176LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000177LDLIBRARY= @LDLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000178BLDLIBRARY= @BLDLIBRARY@
Martin v. Löwisd1fc34d2010-12-30 14:55:47 +0000179PY3LIBRARY= @PY3LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000180DLLLIBRARY= @DLLLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000181LDLIBRARYDIR= @LDLIBRARYDIR@
Martin v. Löwis1142de32002-03-29 16:28:31 +0000182INSTSONAME= @INSTSONAME@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000183
184
185LIBS= @LIBS@
186LIBM= @LIBM@
187LIBC= @LIBC@
188SYSLIBS= $(LIBM) $(LIBC)
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000189SHLIBS= @SHLIBS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000190
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000191THREADOBJ= @THREADOBJ@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000192DLINCLDIR= @DLINCLDIR@
193DYNLOADFILE= @DYNLOADFILE@
Jack Jansenc49e5b72001-06-19 15:00:23 +0000194MACHDEP_OBJS= @MACHDEP_OBJS@
Christian Heimes32fbe592007-11-12 15:01:33 +0000195LIBOBJDIR= Python/
196LIBOBJS= @LIBOBJS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000197
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000198PYTHON= python$(EXE)
Jack Jansen1999ef42001-12-06 21:47:20 +0000199BUILDPYTHON= python$(BUILDEXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000200
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +0200201PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
202_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
203HOST_GNU_TYPE= @host@
204
Christian Heimes33fe8092008-04-13 13:53:33 +0000205# The task to run while instrument when building the profile-opt target
Benjamin Petersonf10a79a2008-10-11 00:49:57 +0000206PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
207#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
Christian Heimes33fe8092008-04-13 13:53:33 +0000208
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000209# === Definitions added by makesetup ===
210
211
212##########################################################################
213# Modules
214MODULE_OBJS= \
215 Modules/config.o \
216 Modules/getpath.o \
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +0000217 Modules/main.o \
218 Modules/gcmodule.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000219
220# Used of signalmodule.o is not available
221SIGNAL_OBJS= @SIGNAL_OBJS@
222
Alexandre Vassalotti8d8d6302009-04-04 19:58:40 +0000223IO_H= Modules/_io/_iomodule.h
Benjamin Peterson4fa88fa2009-03-04 00:14:51 +0000224
225IO_OBJS= \
Alexandre Vassalotti8d8d6302009-04-04 19:58:40 +0000226 Modules/_io/_iomodule.o \
227 Modules/_io/iobase.o \
228 Modules/_io/fileio.o \
229 Modules/_io/bufferedio.o \
230 Modules/_io/textio.o \
231 Modules/_io/bytesio.o \
232 Modules/_io/stringio.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000233
234##########################################################################
235# Grammar
Trent Nelsone60ee292012-08-30 14:52:38 +0000236GRAMMAR_H= Include/graminit.h
237GRAMMAR_C= Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000238GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
239
240
Benjamin Petersond78735d2010-01-01 16:04:23 +0000241LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
242
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000243##########################################################################
244# Parser
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000245PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000246
Matthias Klose93a0ef12012-03-15 18:08:34 +0100247PSRCS= \
248 Parser/acceler.c \
249 Parser/grammar1.c \
250 Parser/listnode.c \
251 Parser/node.c \
252 Parser/parser.c \
253 Parser/bitset.c \
254 Parser/metagrammar.c \
255 Parser/firstsets.c \
256 Parser/grammar.c \
257 Parser/pgen.c
258
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000259POBJS= \
260 Parser/acceler.o \
261 Parser/grammar1.o \
262 Parser/listnode.o \
263 Parser/node.o \
264 Parser/parser.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000265 Parser/bitset.o \
Guido van Rossumd3ab37f2003-04-17 14:55:42 +0000266 Parser/metagrammar.o \
267 Parser/firstsets.o \
268 Parser/grammar.o \
269 Parser/pgen.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000270
Victor Stinner7f2fee32011-04-05 00:39:01 +0200271PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000272
Matthias Klose93a0ef12012-03-15 18:08:34 +0100273PGSRCS= \
274 Objects/obmalloc.c \
275 Python/dynamic_annotations.c \
276 Python/mysnprintf.c \
277 Python/pyctype.c \
278 Parser/tokenizer_pgen.c \
279 Parser/printgrammar.c \
280 Parser/parsetok_pgen.c \
281 Parser/pgenmain.c
282
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000283PGOBJS= \
Neil Schemenauerfd1030e2002-04-22 03:05:25 +0000284 Objects/obmalloc.o \
Jeffrey Yasskin39370832010-05-03 19:29:34 +0000285 Python/dynamic_annotations.o \
Guido van Rossumf2272522001-12-04 03:54:08 +0000286 Python/mysnprintf.o \
Benjamin Petersonbf92b7f2010-04-04 23:03:35 +0000287 Python/pyctype.o \
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000288 Parser/tokenizer_pgen.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000289 Parser/printgrammar.o \
Victor Stinner7f2fee32011-04-05 00:39:01 +0200290 Parser/parsetok_pgen.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000291 Parser/pgenmain.o
292
Georg Brandl86def6c2008-01-21 20:36:10 +0000293PARSER_HEADERS= \
Victor Stinner69f55cc2011-10-12 22:09:40 +0200294 $(srcdir)/Parser/parser.h \
295 $(srcdir)/Include/parsetok.h \
296 $(srcdir)/Parser/tokenizer.h
Georg Brandl86def6c2008-01-21 20:36:10 +0000297
Matthias Klose93a0ef12012-03-15 18:08:34 +0100298PGENSRCS= $(PSRCS) $(PGSRCS)
299PGENOBJS= $(POBJS) $(PGOBJS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000300
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000301##########################################################################
302# AST
Trent Nelsone60ee292012-08-30 14:52:38 +0000303AST_H_DIR= Include
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000304AST_H= $(AST_H_DIR)/Python-ast.h
Trent Nelsone60ee292012-08-30 14:52:38 +0000305AST_C_DIR= Python
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000306AST_C= $(AST_C_DIR)/Python-ast.c
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000307AST_ASDL= $(srcdir)/Parser/Python.asdl
308
309ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
310# XXX Note that a build now requires Python exist before the build starts
Matthias Klosec4c48422012-10-21 23:05:35 +0200311ASDLGEN= @ASDLGEN@ $(srcdir)/Parser/asdl_c.py
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000312
313##########################################################################
314# Python
Antoine Pitroub52ec782009-01-25 16:34:23 +0000315
316OPCODETARGETS_H= \
Trent Nelson9effe692012-10-16 08:41:32 -0400317 Python/opcode_targets.h
Antoine Pitroub52ec782009-01-25 16:34:23 +0000318
319OPCODETARGETGEN= \
320 $(srcdir)/Python/makeopcodetargets.py
321
322OPCODETARGETGEN_FILES= \
323 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
324
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000325PYTHON_OBJS= \
Christian Heimes33fe8092008-04-13 13:53:33 +0000326 Python/_warnings.o \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000327 Python/Python-ast.o \
328 Python/asdl.o \
329 Python/ast.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000330 Python/bltinmodule.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000331 Python/ceval.o \
332 Python/compile.o \
333 Python/codecs.o \
Jeffrey Yasskin39370832010-05-03 19:29:34 +0000334 Python/dynamic_annotations.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000335 Python/errors.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000336 Python/frozenmain.o \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000337 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000338 Python/getargs.o \
339 Python/getcompiler.o \
340 Python/getcopyright.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000341 Python/getplatform.o \
342 Python/getversion.o \
343 Python/graminit.o \
344 Python/import.o \
345 Python/importdl.o \
346 Python/marshal.o \
347 Python/modsupport.o \
348 Python/mystrtoul.o \
Marc-André Lemburge5006eb2001-07-31 13:24:44 +0000349 Python/mysnprintf.o \
Thomas Wouters00ee7ba2006-08-21 19:07:27 +0000350 Python/peephole.o \
Neal Norwitzadb69fc2005-12-17 20:54:49 +0000351 Python/pyarena.o \
Eric Smith6dc46f52009-04-27 20:39:49 +0000352 Python/pyctype.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000353 Python/pyfpe.o \
Christian Heimes53876d92008-04-19 00:31:39 +0000354 Python/pymath.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000355 Python/pystate.o \
356 Python/pythonrun.o \
Alexander Belopolsky6fc4ade2010-08-05 17:34:27 +0000357 Python/pytime.o \
Georg Brandl2daf6ae2012-02-20 19:54:16 +0100358 Python/random.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000359 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000360 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000361 Python/sysmodule.o \
362 Python/traceback.o \
363 Python/getopt.o \
Christian Heimes99170a52007-12-19 02:07:34 +0000364 Python/pystrcmp.o \
Martin v. Löwis737ea822004-06-08 18:52:54 +0000365 Python/pystrtod.o \
Mark Dickinsonb08a53a2009-04-16 19:52:09 +0000366 Python/dtoa.o \
Eric Smith8c663262007-08-25 02:26:07 +0000367 Python/formatter_unicode.o \
Victor Stinner4e314432010-10-07 21:45:39 +0000368 Python/fileutils.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000369 Python/$(DYNLOADFILE) \
Christian Heimes32fbe592007-11-12 15:01:33 +0000370 $(LIBOBJS) \
Jack Jansenc49e5b72001-06-19 15:00:23 +0000371 $(MACHDEP_OBJS) \
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000372 $(THREADOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000373
374
375##########################################################################
376# Objects
377OBJECT_OBJS= \
378 Objects/abstract.o \
Antoine Pitroueeb7eea2011-10-06 18:57:27 +0200379 Objects/accu.o \
Guido van Rossum77f6a652002-04-03 22:41:51 +0000380 Objects/boolobject.o \
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000381 Objects/bytes_methods.o \
Christian Heimes2c9c7a52008-05-26 13:42:13 +0000382 Objects/bytearrayobject.o \
Guido van Rossum4dfe8a12006-04-22 23:28:04 +0000383 Objects/bytesobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000384 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000385 Objects/classobject.o \
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000386 Objects/codeobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000387 Objects/complexobject.o \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000388 Objects/descrobject.o \
Guido van Rossum7dab2422002-04-26 19:40:56 +0000389 Objects/enumobject.o \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000390 Objects/exceptions.o \
Martin v. Löwise440e472004-06-01 15:22:42 +0000391 Objects/genobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000392 Objects/fileobject.o \
393 Objects/floatobject.o \
394 Objects/frameobject.o \
395 Objects/funcobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000396 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000397 Objects/listobject.o \
398 Objects/longobject.o \
399 Objects/dictobject.o \
Travis E. Oliphantb99f7622007-08-18 11:21:56 +0000400 Objects/memoryobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000401 Objects/methodobject.o \
402 Objects/moduleobject.o \
Barry Warsaw409da152012-06-03 16:18:47 -0400403 Objects/namespaceobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000404 Objects/object.o \
Tim Peters1221c0a2002-03-23 00:20:15 +0000405 Objects/obmalloc.o \
Benjamin Petersonb173f782009-05-05 22:31:58 +0000406 Objects/capsule.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000407 Objects/rangeobject.o \
Victor Stinner69f55cc2011-10-12 22:09:40 +0200408 Objects/setobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000409 Objects/sliceobject.o \
Guido van Rossum98bf58f2001-10-18 20:34:25 +0000410 Objects/structseq.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000411 Objects/tupleobject.o \
412 Objects/typeobject.o \
Georg Brandl52d168a2008-01-07 18:10:24 +0000413 Objects/unicodeobject.o \
414 Objects/unicodectype.o \
415 Objects/weakrefobject.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000416
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000417##########################################################################
418# objects that get linked into the Python library
Antoine Pitroue67f48c2012-06-19 22:29:35 +0200419LIBRARY_OBJS_OMIT_FROZEN= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000420 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000421 $(PARSER_OBJS) \
422 $(OBJECT_OBJS) \
423 $(PYTHON_OBJS) \
424 $(MODULE_OBJS) \
425 $(SIGNAL_OBJS) \
426 $(MODOBJS)
427
Antoine Pitroue67f48c2012-06-19 22:29:35 +0200428LIBRARY_OBJS= \
429 $(LIBRARY_OBJS_OMIT_FROZEN) \
430 Python/frozen.o
431
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000432#########################################################################
433# Rules
434
435# Default target
Guido van Rossum8ce8a782007-11-01 19:42:39 +0000436all: build_all
Trent Nelsonc101bf32012-10-16 08:13:12 -0400437build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000438
Christian Heimes33fe8092008-04-13 13:53:33 +0000439# Compile a binary with gcc profile guided optimization.
440profile-opt:
441 @echo "Building with support for profile generation:"
442 $(MAKE) clean
443 $(MAKE) build_all_generate_profile
444 @echo "Running benchmark to generate profile data:"
445 $(MAKE) profile-removal
446 $(MAKE) run_profile_task
447 @echo "Rebuilding with profile guided optimizations:"
448 $(MAKE) clean
449 $(MAKE) build_all_use_profile
450
451build_all_generate_profile:
452 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
453
454run_profile_task:
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +0200455 : # FIXME: can't run for a cross build
Antoine Pitrou2d9db1d2012-06-17 00:27:30 +0200456 $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
Christian Heimes33fe8092008-04-13 13:53:33 +0000457
458build_all_use_profile:
Matthias Klose39b1e5d2012-06-27 14:13:33 +0200459 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use -fprofile-correction"
Christian Heimes33fe8092008-04-13 13:53:33 +0000460
Georg Brandlb533e262008-05-25 18:19:30 +0000461coverage:
462 @echo "Building with support for coverage checking:"
463 $(MAKE) clean
464 $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
465
466
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000467# Build the interpreter
Martin v. Löwisd1fc34d2010-12-30 14:55:47 +0000468$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
Georg Brandl9411eeb2010-08-01 08:46:24 +0000469 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000470
Trent Nelsonc101bf32012-10-16 08:13:12 -0400471platform: $(BUILDPYTHON) pybuilddir.txt
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +0200472 $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000473
Trent Nelsonc101bf32012-10-16 08:13:12 -0400474# Create build directory and generate the sysconfig build-time data there.
475# pybuilddir.txt contains the name of the build dir and is used for
476# sys.path fixup -- see Modules/getpath.c.
477pybuilddir.txt: $(BUILDPYTHON)
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +0200478 $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000479
480# Build the shared modules
Christian Heimes5f381212012-09-07 02:24:58 +0200481# MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
482# -s, --silent or --quiet is always the first char.
Trent Nelsonc101bf32012-10-16 08:13:12 -0400483sharedmods: $(BUILDPYTHON) pybuilddir.txt
Christian Heimes5f381212012-09-07 02:24:58 +0200484 @case "$$MAKEFLAGS" in \
485 s*) quiet="-q";; \
486 *) quiet="";; \
487 esac; \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +0200488 $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
Christian Heimes4e251402012-09-07 02:26:26 +0200489 $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000490
491# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000492# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000493$(LIBRARY): $(LIBRARY_OBJS)
494 -rm -f $@
Tarek Ziadé5662d3e2009-05-07 21:24:43 +0000495 $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
496 $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
497 $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
Antoine Pitroue67f48c2012-06-19 22:29:35 +0200498 $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
Tarek Ziadé5662d3e2009-05-07 21:24:43 +0000499 $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
500 $(AR) $(ARFLAGS) $@ $(MODOBJS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000501 $(RANLIB) $@
502
Barry Warsaw8cf4eae2010-10-16 01:04:07 +0000503libpython$(LDVERSION).so: $(LIBRARY_OBJS)
Martin v. Löwisbc122622003-06-14 13:11:24 +0000504 if test $(INSTSONAME) != $(LDLIBRARY); then \
Antoine Pitroudbec7802010-10-10 09:37:12 +0000505 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
Martin v. Löwis45ec95d2003-03-30 15:37:33 +0000506 $(LN) -f $(INSTSONAME) $@; \
Georg Brandlb1441c72009-01-03 22:33:39 +0000507 else \
Antoine Pitroudbec7802010-10-10 09:37:12 +0000508 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
Martin v. Löwis45ec95d2003-03-30 15:37:33 +0000509 fi
Martin v. Löwis1142de32002-03-29 16:28:31 +0000510
Martin v. Löwisd1fc34d2010-12-30 14:55:47 +0000511libpython3.so: libpython$(LDVERSION).so
Martin v. Löwis48e14d32011-05-09 07:37:45 +0200512 $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
Martin v. Löwisd1fc34d2010-12-30 14:55:47 +0000513
Georg Brandl6e8d17c2011-02-19 08:47:14 +0000514libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
515 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
Victor Stinner4e314432010-10-07 21:45:39 +0000516
Georg Brandlb1441c72009-01-03 22:33:39 +0000517
Martin v. Löwis1142de32002-03-29 16:28:31 +0000518libpython$(VERSION).sl: $(LIBRARY_OBJS)
Antoine Pitroudbec7802010-10-10 09:37:12 +0000519 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000520
Benjamin Peterson6a6666a2010-04-11 21:49:28 +0000521# Copy up the gdb python hooks into a position where they can be automatically
522# loaded by gdb during Lib/test/test_gdb.py
523#
524# Distributors are likely to want to install this somewhere else e.g. relative
525# to the stripped DWARF data for the shared library.
526gdbhooks: $(BUILDPYTHON)-gdb.py
527
528SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
529$(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
530 $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
531
Jack Jansenea0c3822002-08-01 21:57:49 +0000532# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
533# minimal framework (not including the Lib directory and such) in the current
534# directory.
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000535RESSRCDIR=Mac/Resources/framework
Jack Jansenea0c3822002-08-01 21:57:49 +0000536$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
537 $(LIBRARY) \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000538 $(RESSRCDIR)/Info.plist
Jack Jansen246debb2002-02-12 21:30:53 +0000539 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
Ronald Oussoren42d0f682011-03-14 11:04:34 -0400540 $(CC) -o $(LDLIBRARY) $(PY_LDFLAGS) -dynamiclib \
Ronald Oussoren25032492011-03-14 10:11:59 -0400541 -all_load $(LIBRARY) -Wl,-single_module \
542 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
543 -compatibility_version $(VERSION) \
544 -current_version $(VERSION) \
Victor Stinnerdfb866d2011-09-29 01:12:24 +0200545 -framework CoreFoundation $(LIBS);
Jack Jansenea0c3822002-08-01 21:57:49 +0000546 $(INSTALL) -d -m $(DIRMODE) \
547 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
548 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
549 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
Jack Jansenc736b8d2002-08-04 21:17:20 +0000550 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
Jack Jansenb36687a2004-07-16 08:43:47 +0000551 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
Jack Jansenc736b8d2002-08-04 21:17:20 +0000552 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000553
Jason Tishler30765592003-09-04 11:04:06 +0000554# This rule builds the Cygwin Python DLL and import library if configured
555# for a shared core library; otherwise, this rule is a noop.
556$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
557 if test -n "$(DLLLIBRARY)"; then \
Antoine Pitroudbec7802010-10-10 09:37:12 +0000558 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000559 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
Jason Tishler30765592003-09-04 11:04:06 +0000560 else true; \
561 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000562
563
564oldsharedmods: $(SHAREDMODS)
565
566
567Makefile Modules/config.c: Makefile.pre \
568 $(srcdir)/Modules/config.c.in \
569 $(MAKESETUP) \
570 Modules/Setup.config \
571 Modules/Setup \
572 Modules/Setup.local
573 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
574 -s Modules \
575 Modules/Setup.config \
576 Modules/Setup.local \
577 Modules/Setup
578 @mv config.c Modules
579 @echo "The Makefile was updated, you may need to re-run make."
580
581
582Modules/Setup: $(srcdir)/Modules/Setup.dist
583 @if test -f Modules/Setup; then \
584 echo "-----------------------------------------------"; \
585 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
586 echo "check to make sure you have all the updates you"; \
587 echo "need in your Modules/Setup file."; \
Alexandre Vassalottieca20b62008-05-16 02:54:33 +0000588 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000589 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000590 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000591
Antoine Pitrou8e605772011-04-25 21:21:07 +0200592Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
593 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
Marc-Andre Lemburgaed97732012-04-25 19:45:11 +0200594
Brett Cannonfd074152012-04-14 14:10:13 -0400595############################################################################
596# Importlib
Antoine Pitrou8e605772011-04-25 21:21:07 +0200597
Antoine Pitroue67f48c2012-06-19 22:29:35 +0200598Modules/_freeze_importlib: Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
599 $(LINKCC) $(PY_LDFLAGS) -o $@ Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
600
601Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
602 $(MAKE) Modules/_freeze_importlib
603 ./Modules/_freeze_importlib \
604 $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
605
Marc-Andre Lemburgaed97732012-04-25 19:45:11 +0200606
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000607############################################################################
608# Special rules for object files
609
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000610Modules/getbuildinfo.o: $(PARSER_OBJS) \
611 $(OBJECT_OBJS) \
612 $(PYTHON_OBJS) \
613 $(MODULE_OBJS) \
614 $(SIGNAL_OBJS) \
615 $(MODOBJS) \
616 $(srcdir)/Modules/getbuildinfo.c
Georg Brandl13039c82011-03-06 10:13:00 +0100617 $(CC) -c $(PY_CORE_CFLAGS) \
Georg Brandl1ca2e792011-03-05 20:51:24 +0100618 -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
619 -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
620 -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
621 -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000622
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000623Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +0000624 $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000625 -DPREFIX='"$(prefix)"' \
626 -DEXEC_PREFIX='"$(exec_prefix)"' \
627 -DVERSION='"$(VERSION)"' \
628 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000629 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000630
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000631Modules/python.o: $(srcdir)/Modules/python.c
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +0000632 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000633
Victor Stinner69f55cc2011-10-12 22:09:40 +0200634Modules/_testembed.o: $(srcdir)/Modules/_testembed.c
635 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/_testembed.c
636
Barry Warsaw35f3a2c2010-09-03 18:30:30 +0000637Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
638 $(CC) -c $(PY_CORE_CFLAGS) \
639 -DSOABI='"$(SOABI)"' \
640 -o $@ $(srcdir)/Python/dynload_shlib.c
641
Barry Warsaw8cf4eae2010-10-16 01:04:07 +0000642Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
643 $(CC) -c $(PY_CORE_CFLAGS) \
644 -DABIFLAGS='"$(ABIFLAGS)"' \
645 -o $@ $(srcdir)/Python/sysmodule.c
646
Benjamin Peterson4fa88fa2009-03-04 00:14:51 +0000647$(IO_OBJS): $(IO_H)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000648
Matthias Klose93a0ef12012-03-15 18:08:34 +0100649$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
650 @$(MKDIR_P) Include
651 $(MAKE) $(PGEN)
Victor Stinnere1c0c7c2010-12-28 23:14:17 +0000652 $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Matthias Klose93a0ef12012-03-15 18:08:34 +0100653$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
654 $(MAKE) $(GRAMMAR_H)
655 touch $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000656
657$(PGEN): $(PGENOBJS)
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +0000658 $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000659
660Parser/grammar.o: $(srcdir)/Parser/grammar.c \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000661 $(srcdir)/Include/token.h \
662 $(srcdir)/Include/grammar.h
663Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
664
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000665Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
Victor Stinner7f2fee32011-04-05 00:39:01 +0200666Parser/parsetok_pgen.o: $(srcdir)/Parser/parsetok.c
Victor Stinner69f55cc2011-10-12 22:09:40 +0200667Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000668
Thomas Woutersfc7bb8c2007-01-15 15:49:28 +0000669Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
670
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000671$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
Trent Nelsone60ee292012-08-30 14:52:38 +0000672 $(MKDIR_P) $(AST_H_DIR)
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000673 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000674
Benjamin Peterson1f918c12012-01-13 08:45:55 -0500675$(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES)
Trent Nelsone60ee292012-08-30 14:52:38 +0000676 $(MKDIR_P) $(AST_C_DIR)
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000677 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000678
Benjamin Peterson87c8d872009-06-11 22:54:11 +0000679Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
Neil Schemenauer40417742001-02-27 02:45:36 +0000680
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000681Python/getplatform.o: $(srcdir)/Python/getplatform.c
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +0000682 $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000683
684Python/importdl.o: $(srcdir)/Python/importdl.c
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +0000685 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000686
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000687Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
688 $(srcdir)/Objects/unicodetype_db.h
689
Christian Heimesda996832008-03-22 18:37:22 +0000690BYTESTR_DEPS = \
Neal Norwitz22c65422008-03-24 05:03:36 +0000691 $(srcdir)/Include/bytes_methods.h \
Christian Heimesda996832008-03-22 18:37:22 +0000692 $(srcdir)/Objects/stringlib/count.h \
693 $(srcdir)/Objects/stringlib/ctype.h \
694 $(srcdir)/Objects/stringlib/eq.h \
695 $(srcdir)/Objects/stringlib/fastsearch.h \
696 $(srcdir)/Objects/stringlib/find.h \
Antoine Pitroudd4e2f02011-10-13 00:02:27 +0200697 $(srcdir)/Objects/stringlib/find_max_char.h \
Antoine Pitrou74375fc2012-10-18 21:31:22 +0200698 $(srcdir)/Objects/stringlib/join.h \
Christian Heimesda996832008-03-22 18:37:22 +0000699 $(srcdir)/Objects/stringlib/partition.h \
Antoine Pitrouf2c54842010-01-13 08:07:53 +0000700 $(srcdir)/Objects/stringlib/split.h \
Christian Heimesda996832008-03-22 18:37:22 +0000701 $(srcdir)/Objects/stringlib/stringdefs.h \
Christian Heimesda996832008-03-22 18:37:22 +0000702 $(srcdir)/Objects/stringlib/transmogrify.h \
703 $(srcdir)/Objects/stringlib/unicodedefs.h \
Antoine Pitrou3e623242011-11-13 19:37:58 +0100704 $(srcdir)/Objects/stringlib/localeutil.h \
705 $(srcdir)/Objects/stringlib/undef.h
706
707UNICODE_DEPS = $(BYTESTR_DEPS) \
708 $(srcdir)/Objects/stringlib/asciilib.h \
Antoine Pitrou0a3229d2011-11-21 20:39:13 +0100709 $(srcdir)/Objects/stringlib/codecs.h \
Antoine Pitrou3e623242011-11-13 19:37:58 +0100710 $(srcdir)/Objects/stringlib/ucs1lib.h \
711 $(srcdir)/Objects/stringlib/ucs2lib.h \
712 $(srcdir)/Objects/stringlib/ucs4lib.h \
713 $(srcdir)/Objects/stringlib/unicode_format.h \
714 $(srcdir)/Objects/stringlib/unicodedefs.h
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000715
Benjamin Peterson9ae32202009-01-13 21:53:28 +0000716Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000717
Victor Stinner4e314432010-10-07 21:45:39 +0000718Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
Gregory P. Smith60d241f2007-10-16 06:31:30 +0000719
Antoine Pitrou3e623242011-11-13 19:37:58 +0100720Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS)
Eric Smith8c663262007-08-25 02:26:07 +0000721
Martin v. Löwis6fb44722011-09-25 17:36:11 +0200722Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h
723Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
724
Antoine Pitroub52ec782009-01-25 16:34:23 +0000725$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
726 $(OPCODETARGETGEN) $(OPCODETARGETS_H)
727
Victor Stinner69f55cc2011-10-12 22:09:40 +0200728Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
Antoine Pitroub52ec782009-01-25 16:34:23 +0000729
Eric Smith8c663262007-08-25 02:26:07 +0000730Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
Martin v. Löwisd63a3b82011-09-28 07:41:54 +0200731 $(BYTESTR_DEPS)
Eric Smith8c663262007-08-25 02:26:07 +0000732
Trent Nelson4d4ec652012-10-16 08:51:24 -0400733Python/frozen.o: Python/importlib.h
Antoine Pitroua4932352012-04-16 18:29:28 +0200734
Trent Nelson9effe692012-10-16 08:41:32 -0400735Objects/typeobject.o: Objects/typeslots.inc
736Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
737 $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
Eric Smith8c663262007-08-25 02:26:07 +0000738
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000739############################################################################
740# Header files
741
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000742PYTHON_HEADERS= \
Victor Stinner69f55cc2011-10-12 22:09:40 +0200743 $(srcdir)/Include/Python.h \
744 $(srcdir)/Include/abstract.h \
745 $(srcdir)/Include/accu.h \
746 $(srcdir)/Include/asdl.h \
747 $(srcdir)/Include/ast.h \
748 $(srcdir)/Include/bltinmodule.h \
749 $(srcdir)/Include/bitset.h \
750 $(srcdir)/Include/boolobject.h \
751 $(srcdir)/Include/bytes_methods.h \
752 $(srcdir)/Include/bytearrayobject.h \
753 $(srcdir)/Include/bytesobject.h \
754 $(srcdir)/Include/cellobject.h \
755 $(srcdir)/Include/ceval.h \
756 $(srcdir)/Include/classobject.h \
757 $(srcdir)/Include/code.h \
758 $(srcdir)/Include/codecs.h \
759 $(srcdir)/Include/compile.h \
760 $(srcdir)/Include/complexobject.h \
761 $(srcdir)/Include/descrobject.h \
762 $(srcdir)/Include/dictobject.h \
763 $(srcdir)/Include/dtoa.h \
764 $(srcdir)/Include/dynamic_annotations.h \
765 $(srcdir)/Include/enumobject.h \
766 $(srcdir)/Include/errcode.h \
767 $(srcdir)/Include/eval.h \
768 $(srcdir)/Include/fileobject.h \
769 $(srcdir)/Include/fileutils.h \
770 $(srcdir)/Include/floatobject.h \
771 $(srcdir)/Include/frameobject.h \
772 $(srcdir)/Include/funcobject.h \
773 $(srcdir)/Include/genobject.h \
774 $(srcdir)/Include/import.h \
775 $(srcdir)/Include/intrcheck.h \
776 $(srcdir)/Include/iterobject.h \
777 $(srcdir)/Include/listobject.h \
778 $(srcdir)/Include/longintrepr.h \
779 $(srcdir)/Include/longobject.h \
780 $(srcdir)/Include/marshal.h \
781 $(srcdir)/Include/memoryobject.h \
782 $(srcdir)/Include/metagrammar.h \
783 $(srcdir)/Include/methodobject.h \
784 $(srcdir)/Include/modsupport.h \
785 $(srcdir)/Include/moduleobject.h \
Barry Warsaw409da152012-06-03 16:18:47 -0400786 $(srcdir)/Include/namespaceobject.h \
Victor Stinner69f55cc2011-10-12 22:09:40 +0200787 $(srcdir)/Include/node.h \
788 $(srcdir)/Include/object.h \
789 $(srcdir)/Include/objimpl.h \
790 $(srcdir)/Include/opcode.h \
791 $(srcdir)/Include/osdefs.h \
792 $(srcdir)/Include/patchlevel.h \
793 $(srcdir)/Include/pgen.h \
794 $(srcdir)/Include/pgenheaders.h \
795 $(srcdir)/Include/pyarena.h \
796 $(srcdir)/Include/pyatomic.h \
797 $(srcdir)/Include/pycapsule.h \
798 $(srcdir)/Include/pyctype.h \
799 $(srcdir)/Include/pydebug.h \
800 $(srcdir)/Include/pyerrors.h \
801 $(srcdir)/Include/pyfpe.h \
802 $(srcdir)/Include/pymath.h \
803 $(srcdir)/Include/pygetopt.h \
804 $(srcdir)/Include/pymacro.h \
805 $(srcdir)/Include/pymem.h \
806 $(srcdir)/Include/pyport.h \
807 $(srcdir)/Include/pystate.h \
808 $(srcdir)/Include/pystrcmp.h \
809 $(srcdir)/Include/pystrtod.h \
810 $(srcdir)/Include/pythonrun.h \
811 $(srcdir)/Include/pythread.h \
812 $(srcdir)/Include/pytime.h \
813 $(srcdir)/Include/rangeobject.h \
814 $(srcdir)/Include/setobject.h \
815 $(srcdir)/Include/sliceobject.h \
816 $(srcdir)/Include/structmember.h \
817 $(srcdir)/Include/structseq.h \
818 $(srcdir)/Include/symtable.h \
819 $(srcdir)/Include/sysmodule.h \
820 $(srcdir)/Include/traceback.h \
821 $(srcdir)/Include/tupleobject.h \
822 $(srcdir)/Include/ucnhash.h \
823 $(srcdir)/Include/unicodeobject.h \
824 $(srcdir)/Include/warnings.h \
825 $(srcdir)/Include/weakrefobject.h \
Georg Brandl86def6c2008-01-21 20:36:10 +0000826 pyconfig.h \
827 $(PARSER_HEADERS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000828
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000829$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000830
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000831
832######################################################################
833
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200834TESTOPTS= $(EXTRATESTOPTS)
835TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
836TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
837TESTTIMEOUT= 3600
838
Nadeem Vawdaecd3e382011-07-31 01:09:04 +0200839# Run a basic set of regression tests.
840# This excludes some tests that are particularly resource-intensive.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000841test: all platform
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200842 $(TESTRUNNER) $(TESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000843
Nadeem Vawdaecd3e382011-07-31 01:09:04 +0200844# Run the full test suite twice - once without .pyc files, and once with.
845# In the past, we've had problems where bugs in the marshalling or
846# elsewhere caused bytecode read from .pyc files to behave differently
847# than bytecode generated directly from a .py source file. Sometimes
848# the bytecode read from a .pyc file had the bug, sometimes the directly
849# generated bytecode. This is sometimes a very shy bug needing a lot of
850# sample data.
Skip Montanaro446ad712003-05-06 15:30:20 +0000851testall: all platform
852 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200853 $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
Christian Heimes905a9042007-11-21 02:51:50 +0000854 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200855 -$(TESTRUNNER) -u all $(TESTOPTS)
856 $(TESTRUNNER) -u all $(TESTOPTS)
Skip Montanaro446ad712003-05-06 15:30:20 +0000857
Nadeem Vawdaecd3e382011-07-31 01:09:04 +0200858# Run the test suite for both architectures in a Universal build on OSX.
859# Must be run on an Intel box.
Thomas Wouters477c8d52006-05-27 19:21:47 +0000860testuniversal: all platform
861 if [ `arch` != 'i386' ];then \
862 echo "This can only be used on OSX/i386" ;\
863 exit 1 ;\
864 fi
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200865 $(TESTRUNNER) -u all $(TESTOPTS)
866 $(RUNSHARED) /usr/libexec/oah/translate \
867 ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000868
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200869# Like testall, but with only one pass and without multiple processes.
Nadeem Vawdaecd3e382011-07-31 01:09:04 +0200870# Run an optional script to include information about the build environment.
Martin v. Löwisbfa8bd72006-03-13 10:59:32 +0000871buildbottest: all platform
Thomas Wouters89d996e2007-09-08 17:39:28 +0000872 -@if which pybuildbot.identify >/dev/null 2>&1; then \
873 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
874 fi
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200875 $(TESTRUNNER) -j 1 -u all -W --timeout=$(TESTTIMEOUT) $(TESTOPTS)
Martin v. Löwisbfa8bd72006-03-13 10:59:32 +0000876
Jeremy Hyltonfdd6dee2009-03-27 21:24:45 +0000877QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
878 test_multibytecodec test_urllib2_localnet test_itertools \
879 test_multiprocessing test_mailbox test_socket test_poll \
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200880 test_select test_zipfile test_concurrent_futures
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000881quicktest: all platform
Nadeem Vawda3c01d162011-08-01 23:48:26 +0200882 $(TESTRUNNER) $(QUICKTESTOPTS)
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000883
Barry Warsaw42119252001-03-03 04:14:21 +0000884
Benjamin Peterson932073a2009-05-23 16:14:33 +0000885install: altinstall bininstall
Guido van Rossumdc21db32008-04-07 18:37:41 +0000886
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000887altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
Benjamin Petersonf4841e22009-04-25 21:04:19 +0000888 sharedinstall oldsharedinstall maninstall @FRAMEWORKALTINSTALLLAST@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000889
890# Install shared libraries enabled by Setup
891DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
892
893oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
894 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000895 if test $$i != X; then \
896 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000897 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
Neil Schemenauerac959772001-02-06 14:50:27 +0000898 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000899 done
900
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000901$(DESTSHARED):
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000902 @for i in $(DESTDIRS); \
903 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000904 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000905 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000906 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000907 else true; \
908 fi; \
909 done
910
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000911# Install the interpreter with $(VERSION) affixed
912# This goes into $(exec_prefix)
Benjamin Peterson932073a2009-05-23 16:14:33 +0000913altbininstall: $(BUILDPYTHON)
Martin v. Löwisd8a20d22002-05-08 08:59:59 +0000914 @for i in $(BINDIR) $(LIBDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000915 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000916 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000917 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000918 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000919 else true; \
920 fi; \
921 done
Barry Warsaw14d98ac2010-11-24 19:43:47 +0000922 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE)
Barry Warsaw771d33e2010-12-13 18:04:23 +0000923 -if test "$(VERSION)" != "$(LDVERSION)"; then \
Nick Coghlan4fcad3c2012-02-17 23:17:34 +1000924 if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
Barry Warsaw771d33e2010-12-13 18:04:23 +0000925 then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
926 fi; \
927 (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
Barry Warsawad6f8772010-12-11 21:32:01 +0000928 fi
Georg Brandlb1441c72009-01-03 22:33:39 +0000929 if test -f $(LDLIBRARY); then \
Georg Brandl1f01deb2009-01-03 22:47:39 +0000930 if test -n "$(DLLLIBRARY)" ; then \
931 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000932 else \
Georg Brandlb1441c72009-01-03 22:33:39 +0000933 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
934 if test $(LDLIBRARY) != $(INSTSONAME); then \
935 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
Martin v. Löwise3be8602003-11-18 19:54:20 +0000936 fi \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000937 fi; \
Martin v. Löwisd1fc34d2010-12-30 14:55:47 +0000938 if test -n "$(PY3LIBRARY)"; then \
939 $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
940 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000941 else true; \
942 fi
Benjamin Peterson932073a2009-05-23 16:14:33 +0000943
944bininstall: altbininstall
Nick Coghlan4fcad3c2012-02-17 23:17:34 +1000945 -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \
946 then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \
Benjamin Petersonf4841e22009-04-25 21:04:19 +0000947 else true; \
948 fi
Nick Coghlan4fcad3c2012-02-17 23:17:34 +1000949 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE))
Barry Warsaw771d33e2010-12-13 18:04:23 +0000950 -if test "$(VERSION)" != "$(LDVERSION)"; then \
951 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
952 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
953 rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \
954 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \
955 fi
Benjamin Petersonf4841e22009-04-25 21:04:19 +0000956 -rm -f $(DESTDIR)$(BINDIR)/python3-config
957 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
Antoine Pitrou20327222009-05-24 20:39:11 +0000958 -rm -f $(DESTDIR)$(LIBPC)/python3.pc
959 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
Georg Brandlff52f762010-12-28 09:51:43 +0000960 -rm -f $(DESTDIR)$(BINDIR)/idle3
961 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
962 -rm -f $(DESTDIR)$(BINDIR)/pydoc3
963 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
964 -rm -f $(DESTDIR)$(BINDIR)/2to3
965 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
Vinay Sajip7ded1f02012-05-26 03:45:29 +0100966 -rm -f $(DESTDIR)$(BINDIR)/pyvenv
967 (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000968
969# Install the manual page
970maninstall:
971 @for i in $(MANDIR) $(MANDIR)/man1; \
972 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000973 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000974 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +0000975 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000976 else true; \
977 fi; \
978 done
979 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Benjamin Peterson1a6e0d02008-10-25 15:49:17 +0000980 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000981
982# Install the library
983PLATDIR= plat-$(MACHDEP)
Jack Jansen83f898c2002-12-30 22:23:40 +0000984EXTRAPLATDIR= @EXTRAPLATDIR@
985MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000986XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
Benjamin Petersoncb6dbe52010-03-18 21:36:06 +0000987LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
Victor Stinner5b326592011-05-25 01:15:59 +0200988 tkinter/test/test_ttk site-packages test \
Ned Deilye2d51902011-07-04 19:06:20 -0700989 test/capath test/data \
Barry Warsaw04fe64b2011-06-14 16:51:58 -0400990 test/cjkencodings test/decimaltestdata test/xmltestdata \
Vinay Sajip935b6292012-04-10 18:41:48 +0100991 test/subprocessdata test/sndhdrdata \
Alexander Belopolskye8f58322010-10-15 16:28:20 +0000992 test/tracedmodules test/encoded_modules \
Ned Deily7e18f432012-05-27 22:34:33 -0700993 test/namespace_pkgs \
994 test/namespace_pkgs/both_portions \
995 test/namespace_pkgs/both_portions/foo \
996 test/namespace_pkgs/not_a_namespace_pkg \
997 test/namespace_pkgs/not_a_namespace_pkg/foo \
998 test/namespace_pkgs/portion1 \
999 test/namespace_pkgs/portion1/foo \
1000 test/namespace_pkgs/portion2 \
1001 test/namespace_pkgs/portion2/foo \
1002 test/namespace_pkgs/project1 \
1003 test/namespace_pkgs/project1/parent \
1004 test/namespace_pkgs/project1/parent/child \
1005 test/namespace_pkgs/project2 \
1006 test/namespace_pkgs/project2/parent \
1007 test/namespace_pkgs/project2/parent/child \
1008 test/namespace_pkgs/project3 \
1009 test/namespace_pkgs/project3/parent \
1010 test/namespace_pkgs/project3/parent/child \
Eric V. Smith714370f2012-06-24 19:55:18 -04001011 test/namespace_pkgs/module_and_namespace_package \
1012 test/namespace_pkgs/module_and_namespace_package/a_test \
Georg Brandl53291232011-02-23 07:30:12 +00001013 collections concurrent concurrent/futures encodings \
R David Murray92cafb82011-06-17 11:41:49 -04001014 email email/mime test/test_email test/test_email/data \
Alexander Belopolskyff27ee02010-11-30 03:03:30 +00001015 html json test/json_tests http dbm xmlrpc \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001016 sqlite3 sqlite3/test \
Georg Brandl1158a332009-06-04 09:30:30 +00001017 logging csv wsgiref urllib \
Alexandre Vassalottie9f305f2008-05-16 04:39:54 +00001018 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
Barry Warsaw04fe64b2011-06-14 16:51:58 -04001019 lib2to3/tests/data lib2to3/tests/data/fixers \
1020 lib2to3/tests/data/fixers/myfixes \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001021 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
Fred Drakee612c8e2005-01-19 06:24:58 +00001022 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
Ned Deilycc409f42012-07-20 13:24:58 -07001023 importlib test/test_importlib test/test_importlib/builtin \
1024 test/test_importlib/extension test/test_importlib/frozen \
1025 test/test_importlib/import_ test/test_importlib/source \
Alexander Belopolskyea13d9d2010-11-01 17:39:37 +00001026 turtledemo \
Benjamin Peterson6bf2d6b2008-06-20 02:54:41 +00001027 multiprocessing multiprocessing/dummy \
Ned Deilye8b416e2012-03-22 13:34:11 -07001028 unittest unittest/test unittest/test/testmock \
Vinay Sajip7ded1f02012-05-26 03:45:29 +01001029 venv venv/scripts venv/scripts/posix \
Ronald Oussoren69026bb2009-05-19 19:07:43 +00001030 curses pydoc_data $(MACHDEPS)
Ned Deily58f27b22011-06-28 00:42:50 -07001031libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001032 @for i in $(SCRIPTDIR) $(LIBDEST); \
1033 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001034 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001035 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001036 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001037 else true; \
1038 fi; \
1039 done
1040 @for d in $(LIBSUBDIRS); \
1041 do \
1042 a=$(srcdir)/Lib/$$d; \
1043 if test ! -d $$a; then continue; else true; fi; \
1044 b=$(LIBDEST)/$$d; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001045 if test ! -d $(DESTDIR)$$b; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001046 echo "Creating directory $$b"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001047 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001048 else true; \
1049 fi; \
1050 done
Trent Nelsonc101bf32012-10-16 08:13:12 -04001051 @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001052 do \
1053 if test -x $$i; then \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001054 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +00001055 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001056 else \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001057 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001058 echo $(INSTALL_DATA) $$i $(LIBDEST); \
1059 fi; \
1060 done
1061 @for d in $(LIBSUBDIRS); \
1062 do \
1063 a=$(srcdir)/Lib/$$d; \
1064 if test ! -d $$a; then continue; else true; fi; \
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001065 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001066 b=$(LIBDEST)/$$d; \
1067 for i in $$a/*; \
1068 do \
1069 case $$i in \
1070 *CVS) ;; \
1071 *.py[co]) ;; \
1072 *.orig) ;; \
1073 *~) ;; \
1074 *) \
1075 if test -d $$i; then continue; fi; \
1076 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +00001077 echo $(INSTALL_SCRIPT) $$i $$b; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001078 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001079 else \
1080 echo $(INSTALL_DATA) $$i $$b; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001081 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001082 fi;; \
1083 esac; \
1084 done; \
1085 done
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001086 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
Ned Deily58f27b22011-06-28 00:42:50 -07001087 if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
1088 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
1089 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
1090 fi
Guido van Rossum827bfd02007-07-15 13:12:42 +00001091 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001092 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +00001093 -d $(LIBDEST) -f \
Benjamin Peterson89a545f2010-03-18 22:58:19 +00001094 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
Benjamin Petersonf47ed4a2009-04-11 20:45:40 +00001095 $(DESTDIR)$(LIBDEST)
Guido van Rossum827bfd02007-07-15 13:12:42 +00001096 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001097 $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +00001098 -d $(LIBDEST) -f \
Benjamin Peterson89a545f2010-03-18 22:58:19 +00001099 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
Benjamin Petersonf47ed4a2009-04-11 20:45:40 +00001100 $(DESTDIR)$(LIBDEST)
Hye-Shik Chang0e5e6c72004-03-18 07:51:27 +00001101 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001102 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +00001103 -d $(LIBDEST)/site-packages -f \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001104 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
Hye-Shik Chang0e5e6c72004-03-18 07:51:27 +00001105 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001106 $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
Martin v. Löwis975302d2003-06-21 13:26:28 +00001107 -d $(LIBDEST)/site-packages -f \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001108 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
Ned Deily4725b132012-09-08 19:04:47 -07001109 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1110 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
1111 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1112 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001113
1114# Create the PLATDIR source directory, if one wasn't distributed..
1115$(srcdir)/Lib/$(PLATDIR):
1116 mkdir $(srcdir)/Lib/$(PLATDIR)
1117 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
1118 export PATH; PATH="`pwd`:$$PATH"; \
1119 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001120 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
Jack Jansen0d153662001-12-19 09:24:40 +00001121 export EXE; EXE="$(BUILDEXE)"; \
Benjamin Petersonfce25a72008-12-30 18:05:46 +00001122 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001123
Collin Winterbf199072010-03-19 21:17:17 +00001124python-config: $(srcdir)/Misc/python-config.in
1125 # Substitution happens here, as the completely-expanded BINDIR
1126 # is not available in configure
Barry Warsaw14d98ac2010-11-24 19:43:47 +00001127 sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
Collin Winterbf199072010-03-19 21:17:17 +00001128
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001129# Install the include files
1130INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1131inclinstall:
1132 @for i in $(INCLDIRSTOMAKE); \
1133 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001134 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001135 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001136 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001137 else true; \
1138 fi; \
1139 done
1140 @for i in $(srcdir)/Include/*.h; \
1141 do \
1142 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001143 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001144 done
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001145 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001146
1147# Install the library and miscellaneous stuff needed for extending/embedding
1148# This goes into $(exec_prefix)
Barry Warsaw14d98ac2010-11-24 19:43:47 +00001149LIBPL= $(LIBDEST)/config-$(LDVERSION)
Antoine Pitrou20327222009-05-24 20:39:11 +00001150
1151# pkgconfig directory
1152LIBPC= $(LIBDIR)/pkgconfig
1153
Collin Winterbf199072010-03-19 21:17:17 +00001154libainstall: all python-config
Barry Warsaw14d98ac2010-11-24 19:43:47 +00001155 @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001156 do \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001157 if test ! -d $(DESTDIR)$$i; then \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001158 echo "Creating directory $$i"; \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001159 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001160 else true; \
1161 fi; \
1162 done
Martin v. Löwis1142de32002-03-29 16:28:31 +00001163 @if test -d $(LIBRARY); then :; else \
Jack Jansen127e56e2001-09-11 14:41:54 +00001164 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jason Tishlerc0f1e772002-07-29 16:18:23 +00001165 if test "$(SO)" = .dll; then \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001166 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
Jason Tishlerc0f1e772002-07-29 16:18:23 +00001167 else \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001168 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1169 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
Jason Tishlerc0f1e772002-07-29 16:18:23 +00001170 fi; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001171 else \
Martin v. Löwis1142de32002-03-29 16:28:31 +00001172 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001173 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001174 fi
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001175 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001176 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001177 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1178 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1179 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1180 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1181 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
Antoine Pitrou20327222009-05-24 20:39:11 +00001182 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001183 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1184 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
Barry Warsaw14d98ac2010-11-24 19:43:47 +00001185 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001186 rm python-config
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001187 @if [ -s Modules/python.exp -a \
1188 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1189 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1190 $(INSTALL_DATA) Modules/python.exp \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001191 $(DESTDIR)$(LIBPL)/python.exp; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001192 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +00001193 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001194 $(DESTDIR)$(LIBPL)/makexp_aix; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001195 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +00001196 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001197 $(DESTDIR)$(LIBPL)/ld_so_aix; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001198 echo "$(LIBPL)/ld_so_aix"; \
1199 echo; echo "See Misc/AIX-NOTES for details."; \
1200 else true; \
1201 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001202
1203# Install the dynamically loadable modules
1204# This goes into $(exec_prefix)
Benjamin Petersonbbda0c52010-07-17 20:39:23 +00001205sharedinstall: sharedmods
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001206 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
Martin v. Löwis1142de32002-03-29 16:28:31 +00001207 --prefix=$(prefix) \
Guido van Rossumb33e7892001-10-17 06:26:53 +00001208 --install-scripts=$(BINDIR) \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001209 --install-platlib=$(DESTSHARED) \
Thomas Wouters81638f12011-03-06 11:49:15 -08001210 --root=$(DESTDIR)/
Trent Nelsonc101bf32012-10-16 08:13:12 -04001211 -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py
1212 -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001213
Jack Jansencb4321e2002-08-09 00:18:21 +00001214# Here are a couple of targets for MacOSX again, to install a full
1215# framework-based Python. frameworkinstall installs everything, the
1216# subtargets install specific parts. Much of the actual work is offloaded to
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001217# the Makefile in Mac
Jack Jansencb4321e2002-08-09 00:18:21 +00001218#
Thomas Wouters477c8d52006-05-27 19:21:47 +00001219#
1220# This target is here for backward compatiblity, previous versions of Python
1221# hadn't integrated framework installation in the normal install process.
1222frameworkinstall: install
Guido van Rossumed2f7252002-08-09 19:18:25 +00001223
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001224# On install, we re-make the framework
1225# structure in the install location, /Library/Frameworks/ or the argument to
1226# --enable-framework. If --enable-framework has been specified then we have
1227# automatically set prefix to the location deep down in the framework, so we
1228# only have to cater for the structural bits of the framework.
1229
Jack Jansencb4321e2002-08-09 00:18:21 +00001230frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1231
1232frameworkinstallstructure: $(LDLIBRARY)
Jack Jansen127e56e2001-09-11 14:41:54 +00001233 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001234 echo Not configured with --enable-framework; \
Jack Jansen127e56e2001-09-11 14:41:54 +00001235 exit 1; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001236 else true; \
1237 fi
Jack Jansencb4321e2002-08-09 00:18:21 +00001238 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001239 if test ! -d $(DESTDIR)$$i; then \
Jack Jansen9592fe92003-05-25 22:01:32 +00001240 echo "Creating directory $(DESTDIR)$$i"; \
1241 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001242 else true; \
1243 fi; \
1244 done
Ronald Oussoren0499d0b2010-12-07 14:41:05 +00001245 $(LN) -fsn include/python$(LDVERSION) $(DESTDIR)$(prefix)/Headers
Benjamin Peterson4c29b472008-07-01 14:42:51 +00001246 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 +00001247 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
Christian Heimes81ee3ef2008-05-04 22:42:01 +00001248 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
Jack Jansen9592fe92003-05-25 22:01:32 +00001249 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1250 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
Jack Jansen4735b232003-06-20 20:36:53 +00001251 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00001252
Jack Jansencb4321e2002-08-09 00:18:21 +00001253# This installs Mac/Lib into the framework
Thomas Wouters0e3f5912006-08-11 14:57:12 +00001254# Install a number of symlinks to keep software that expects a normal unix
1255# install (which includes python-config) happy.
Jack Jansencb4321e2002-08-09 00:18:21 +00001256frameworkinstallmaclib:
Ned Deilyecd4e9d2012-07-24 03:31:48 -07001257 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).a"
1258 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).dylib"
Ronald Oussoren0499d0b2010-12-07 14:41:05 +00001259 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).a"
1260 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).dylib"
Ned Deilyecd4e9d2012-07-24 03:31:48 -07001261 ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib"
Ronald Oussoren0d2cceb2009-06-08 21:04:41 +00001262 ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
Jack Jansencb4321e2002-08-09 00:18:21 +00001263
1264# This installs the IDE, the Launcher and other apps into /Applications
1265frameworkinstallapps:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001266 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
Jack Jansencb4321e2002-08-09 00:18:21 +00001267
1268# This install the unix python and pythonw tools in /usr/local/bin
1269frameworkinstallunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00001270 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1271
1272frameworkaltinstallunixtools:
1273 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
Jack Jansen0b06be72002-06-21 14:48:38 +00001274
Georg Brandl59b44722010-12-30 22:12:40 +00001275# This installs the Tools into the applications directory.
Jack Jansena1b77582003-06-19 22:35:20 +00001276# It is not part of a normal frameworkinstall
1277frameworkinstallextras:
Mark Dickinson09027aa2008-12-18 19:49:35 +00001278 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
Jack Jansena1b77582003-06-19 22:35:20 +00001279
Skip Montanarodecc6a42003-01-01 20:07:49 +00001280# This installs a few of the useful scripts in Tools/scripts
1281scriptsinstall:
Martin v. Löwis01f43112003-01-03 20:39:29 +00001282 SRCDIR=$(srcdir) $(RUNSHARED) \
doko@ubuntu.com1abe1c52012-06-30 20:42:45 +02001283 $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
Skip Montanarodecc6a42003-01-01 20:07:49 +00001284 --prefix=$(prefix) \
Martin v. Löwis3b8ee082003-05-11 20:25:35 +00001285 --install-scripts=$(BINDIR) \
Thomas Wouters81638f12011-03-06 11:49:15 -08001286 --root=$(DESTDIR)/
Skip Montanarodecc6a42003-01-01 20:07:49 +00001287
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001288# Build the toplevel Makefile
Victor Stinner69f55cc2011-10-12 22:09:40 +02001289Makefile.pre: $(srcdir)/Makefile.pre.in config.status
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001290 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1291 $(MAKE) -f Makefile.pre Makefile
1292
Neil Schemenauer64b1b682001-03-22 00:32:32 +00001293# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001294config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +00001295 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001296
Jack Jansen1999ef42001-12-06 21:47:20 +00001297.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001298
1299# Some make's put the object file in the current directory
1300.c.o:
Jeffrey Yasskind4fcdb12010-07-09 16:30:58 +00001301 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001302
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001303# Run reindent on the library
1304reindent:
Christian Heimesfd66e512008-01-29 12:18:50 +00001305 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001306
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001307# Rerun configure with the same options as it was run last time,
1308# provided the config.status script exists
1309recheck:
1310 $(SHELL) config.status --recheck
1311 $(SHELL) config.status
1312
Matthias Klose0f4c16e2012-03-14 23:10:15 +01001313# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001314autoconf:
Matthias Klose80b09d42010-04-25 21:23:32 +00001315 (cd $(srcdir); autoconf -Wall)
1316 (cd $(srcdir); autoheader -Wall)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001317
1318# Create a tags file for vi
1319tags::
1320 cd $(srcdir); \
1321 ctags -w -t Include/*.h; \
1322 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1323 done; \
Guido van Rossumc9489662002-02-28 19:26:08 +00001324 sort -o tags tags
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001325
1326# Create a tags file for GNU Emacs
1327TAGS::
1328 cd $(srcdir); \
1329 etags Include/*.h; \
1330 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1331
Martin v. Loewiscfc1cc22012-04-27 16:10:21 +02001332# Touch generated files
1333touch:
1334 hg --config extensions.touch=Tools/hg/hgtouch.py touch -v
1335
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001336# Sanitation targets -- clean leaves libraries, executables and tags
Mark Dickinson067b38e2009-09-24 19:24:44 +00001337# files, which clobber removes as well
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001338pycremoval:
Petri Lehtinenbc74ee02011-11-05 21:04:24 +02001339 -find $(srcdir) -depth -name '__pycache__' -exec rm -rf {} ';'
Barry Warsaw5f2347d2010-04-26 16:02:14 +00001340 -find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001341
Guido van Rossum77b5e332007-08-29 23:24:02 +00001342rmtestturds:
1343 -rm -f *BAD *GOOD *SKIPPED
1344 -rm -rf OUT
1345 -rm -f *.TXT
1346 -rm -f *.txt
1347 -rm -f gb-18030-2000.xml
1348
Guido van Rossum8188e632007-08-29 23:48:29 +00001349docclean:
1350 -rm -rf Doc/build
1351 -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1352
Guido van Rossum5420bc32007-08-29 23:35:30 +00001353clean: pycremoval
Georg Brandl241bdab2010-07-31 22:05:54 +00001354 find . -name '*.[oa]' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +00001355 find . -name '*.s[ol]' -exec rm -f {} ';'
Georg Brandl241bdab2010-07-31 22:05:54 +00001356 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
Thomas Heller6ab91482009-04-24 18:27:10 +00001357 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
Trent Nelsonc101bf32012-10-16 08:13:12 -04001358 find build -name '*.py' -exec rm -f {} ';' || true
1359 find build -name '*.py[co]' -exec rm -f {} ';' || true
1360 -rm -f pybuilddir.txt
Ned Deily4725b132012-09-08 19:04:47 -07001361 -rm -f Lib/lib2to3/*Grammar*.pickle
Antoine Pitroue67f48c2012-06-19 22:29:35 +02001362 -rm -f Modules/_testembed Modules/_freeze_importlib
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001363
Christian Heimes33fe8092008-04-13 13:53:33 +00001364profile-removal:
1365 find . -name '*.gc??' -exec rm -f {} ';'
1366
1367clobber: clean profile-removal
Jack Jansen1999ef42001-12-06 21:47:20 +00001368 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Matthias Klose597e6b42012-04-04 13:20:55 +02001369 tags TAGS \
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00001370 config.cache config.log pyconfig.h Modules/config.c
Guido van Rossum1d88c592001-06-06 17:51:57 +00001371 -rm -rf build platform
Jack Jansenc6096892003-02-27 23:19:46 +00001372 -rm -rf $(PYTHONFRAMEWORKDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001373
1374# Make things extra clean, before making a distribution:
1375# remove all generated files, even Makefile[.pre]
Neal Norwitz1a196b52006-01-03 01:38:53 +00001376# Keep configure and Python-ast.[ch], it's possible they can't be generated
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001377distclean: clobber
Mark Dickinsonde802be2010-08-01 21:33:01 +00001378 for file in Lib/test/data/* ; do \
1379 if test "$$file" != "Lib/test/data/README"; then rm "$$file"; fi; \
1380 done
Martin v. Löwisdea59e52006-01-05 10:00:36 +00001381 -rm -f core Makefile Makefile.pre config.status \
Mark Dickinson9b3d5572009-08-31 14:52:10 +00001382 Modules/Setup Modules/Setup.local Modules/Setup.config \
Georg Brandl9a829be2011-02-15 15:44:51 +00001383 Modules/ld_so_aix Modules/python.exp Misc/python.pc
Benjamin Peterson6a6666a2010-04-11 21:49:28 +00001384 -rm -f python*-gdb.py
Neil Schemenauere0d43572001-02-03 17:16:29 +00001385 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1386 -o -name '[@,#]*' -o -name '*.old' \
1387 -o -name '*.orig' -o -name '*.rej' \
1388 -o -name '*.bak' ')' \
1389 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001390
1391# Check for smelly exported symbols (not starting with Py/_Py)
1392smelly: all
1393 nm -p $(LIBRARY) | \
1394 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1395
1396# Find files with funny names
1397funny:
Éric Araujo1c608e32011-08-10 02:01:32 +02001398 find $(SUBDIRS) $(SUBDIRSTOO) \
Éric Araujoe9715b92011-08-10 21:42:23 +02001399 -type d \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001400 -o -name '*.[chs]' \
1401 -o -name '*.py' \
Georg Brandl4c9aa452010-08-14 13:43:37 +00001402 -o -name '*.pyw' \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001403 -o -name '*.dat' \
1404 -o -name '*.el' \
1405 -o -name '*.fd' \
1406 -o -name '*.in' \
Guido van Rossum77b5e332007-08-29 23:24:02 +00001407 -o -name '*.gif' \
1408 -o -name '*.txt' \
1409 -o -name '*.xml' \
1410 -o -name '*.xbm' \
1411 -o -name '*.xpm' \
1412 -o -name '*.uue' \
1413 -o -name '*.decTest' \
Georg Brandl4c9aa452010-08-14 13:43:37 +00001414 -o -name '*.tmCommand' \
1415 -o -name '*.tmSnippet' \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001416 -o -name 'Setup' \
1417 -o -name 'Setup.*' \
Guido van Rossum77b5e332007-08-29 23:24:02 +00001418 -o -name regen \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001419 -o -name README \
Georg Brandl4c9aa452010-08-14 13:43:37 +00001420 -o -name NEWS \
1421 -o -name HISTORY \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001422 -o -name Makefile \
1423 -o -name ChangeLog \
Georg Brandl4c9aa452010-08-14 13:43:37 +00001424 -o -name .hgignore \
1425 -o -name .bzrignore \
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001426 -o -name MANIFEST \
Éric Araujob5da6e92011-08-16 19:05:56 +02001427 -o -print
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001428
Christian Heimesada8c3b2008-03-18 18:26:33 +00001429# Perform some verification checks on any modified files.
Brett Cannona741ebf2008-09-05 23:01:27 +00001430patchcheck:
Georg Brandlfcaf9102008-07-16 02:17:56 +00001431 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
Christian Heimesada8c3b2008-03-18 18:26:33 +00001432
Guido van Rossum9454ad72001-08-18 21:08:22 +00001433# Dependencies
1434
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00001435Python/thread.o: @THREADHEADERS@
Guido van Rossum9454ad72001-08-18 21:08:22 +00001436
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001437# Declare targets that aren't real files
Victor Stinnere0a669e2011-12-15 21:48:39 +01001438.PHONY: all build_all sharedmods oldsharedmods test quicktest
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001439.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1440.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1441.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1442.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
Victor Stinner4e314432010-10-07 21:45:39 +00001443.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
Martin v. Loewiscfc1cc22012-04-27 16:10:21 +02001444.PHONY: smelly funny patchcheck touch
Benjamin Peterson6a6666a2010-04-11 21:49:28 +00001445.PHONY: gdbhooks
Guido van Rossumd4f7da32002-10-10 15:04:04 +00001446
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001447# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
Barry Warsaw771d33e2010-12-13 18:04:23 +00001448# Local Variables:
1449# mode: makefile
1450# End: