source: python/trunk/Makefile.pre.in@ 391

Last change on this file since 391 was 391, checked in by dmik, 12 years ago

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 43.8 KB
RevLine 
[2]1# Top-level Makefile for Python
2#
3# As distributed, this file is called Makefile.pre.in; it is processed
4# into the real Makefile by running the script ./configure, which
5# replaces things like @spam@ with values appropriate for your system.
6# This means that if you edit Makefile, your changes get lost the next
7# time you run the configure script. Ideally, you can do:
8#
9# ./configure
10# make
11# make test
12# make install
13#
14# If you have a previous version of Python installed that you don't
15# want to overwrite, you can use "make altinstall" instead of "make
16# install". Refer to the "Installing" section in the README file for
17# additional details.
18#
19# See also the section "Build instructions" in the README file.
20
21# === Variables set by makesetup ===
22
23MODOBJS= _MODOBJS_
24MODLIBS= _MODLIBS_
25
26# === Variables set by configure
27VERSION= @VERSION@
28srcdir= @srcdir@
29VPATH= @srcdir@
[391]30abs_srcdir= @abs_srcdir@
31abs_builddir= @abs_builddir@
32build= @build@
33host= @host@
[2]34
35CC= @CC@
36CXX= @CXX@
37MAINCC= @MAINCC@
38LINKCC= @LINKCC@
39AR= @AR@
40RANLIB= @RANLIB@
41SVNVERSION= @SVNVERSION@
[391]42HGVERSION= @HGVERSION@
43HGTAG= @HGTAG@
44HGBRANCH= @HGBRANCH@
[2]45
[391]46GNULD= @GNULD@
47
[2]48# Shell used by make (some versions default to the login shell, which is bad)
[281]49SHELL= @SHELL@
[2]50
51# Use this to make a link between python$(VERSION) and python in $(BINDIR)
52LN= @LN@
53
54# Portable install script (configure doesn't always guess right)
55INSTALL= @INSTALL@
56INSTALL_PROGRAM=@INSTALL_PROGRAM@
57INSTALL_SCRIPT= @INSTALL_SCRIPT@
58INSTALL_DATA= @INSTALL_DATA@
59# Shared libraries must be installed with executable mode on some systems;
60# rather than figuring out exactly which, we always give them executable mode.
61# Also, making them read-only seems to be a good idea...
62INSTALL_SHARED= ${INSTALL} -m 555
63
[391]64MKDIR_P= @MKDIR_P@
65
[2]66MAKESETUP= $(srcdir)/Modules/makesetup
67
68# Compiler options
69OPT= @OPT@
70BASECFLAGS= @BASECFLAGS@
[391]71CFLAGS= $(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
[2]72# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
73# be able to build extension modules using the directories specified in the
74# environment variables
75CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
76LDFLAGS= @LDFLAGS@
77LDLAST= @LDLAST@
78SGI_ABI= @SGI_ABI@
79CCSHARED= @CCSHARED@
80LINKFORSHARED= @LINKFORSHARED@
[391]81ARFLAGS= @ARFLAGS@
[2]82# Extra C flags added for building the interpreter object files.
83CFLAGSFORSHARED=@CFLAGSFORSHARED@
84# C flags used for building the interpreter object files
85PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
86
87
88# Machine-dependent subdirectories
89MACHDEP= @MACHDEP@
90
[391]91# Multiarch directory (may be empty)
92MULTIARCH= @MULTIARCH@
93
[2]94# Install prefix for architecture-independent files
95prefix= @prefix@
96
97# Install prefix for architecture-dependent files
98exec_prefix= @exec_prefix@
99
100# Install prefix for data files
101datarootdir= @datarootdir@
102
103# Expanded directories
[391]104BINDIR= @bindir@
105LIBDIR= @libdir@
[2]106MANDIR= @mandir@
107INCLUDEDIR= @includedir@
108CONFINCLUDEDIR= $(exec_prefix)/include
109SCRIPTDIR= $(prefix)/lib
110
111# Detailed destination directories
112BINLIBDEST= $(LIBDIR)/python$(VERSION)
113LIBDEST= $(SCRIPTDIR)/python$(VERSION)
114INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
115CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
116LIBP= $(LIBDIR)/python$(VERSION)
117
118# Symbols used for using shared libraries
119SO= @SO@
[391]120LDSHARED= @LDSHARED@ $(LDFLAGS)
121BLDSHARED= @BLDSHARED@ $(LDFLAGS)
122LDCXXSHARED= @LDCXXSHARED@
[2]123DESTSHARED= $(BINLIBDEST)/lib-dynload
124
125# Executable suffix (.exe on Windows and Mac OS X)
126EXE= @EXEEXT@
127BUILDEXE= @BUILDEXEEXT@
128
129# Short name and location for Mac OS X Python framework
130UNIVERSALSDK=@UNIVERSALSDK@
131PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
132PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
133PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
134PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
135# Deployment target selected during configure, to be checked
136# by distutils. The export statement is needed to ensure that the
137# deployment target is active during build.
138MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
139@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
140
141# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
142OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
143
144# Environment to run shared python without installed libraries
145RUNSHARED= @RUNSHARED@
146
147# Modes for directories, executables and data files created by the
148# install process. Default to user-only-writable for all file types.
149DIRMODE= 755
150EXEMODE= 755
151FILEMODE= 644
152
153# configure script arguments
154CONFIG_ARGS= @CONFIG_ARGS@
155
156
157# Subdirectories with code
158SRCDIRS= @SRCDIRS@
159
160# Other subdirectories
161SUBDIRSTOO= Include Lib Misc Demo
162
163# Files and directories to be distributed
[391]164CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
[2]165DISTFILES= README ChangeLog $(CONFIGFILES)
166DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
167DIST= $(DISTFILES) $(DISTDIRS)
168
169
170LIBRARY= @LIBRARY@
171LDLIBRARY= @LDLIBRARY@
172BLDLIBRARY= @BLDLIBRARY@
173DLLLIBRARY= @DLLLIBRARY@
174LDLIBRARYDIR= @LDLIBRARYDIR@
175INSTSONAME= @INSTSONAME@
[10]176CONDENSED_VERSION= @CONDENSED_VERSION@
[2]177
178
179LIBS= @LIBS@
180LIBM= @LIBM@
181LIBC= @LIBC@
182SYSLIBS= $(LIBM) $(LIBC)
183SHLIBS= @SHLIBS@
184
185THREADOBJ= @THREADOBJ@
186DLINCLDIR= @DLINCLDIR@
187DYNLOADFILE= @DYNLOADFILE@
188MACHDEP_OBJS= @MACHDEP_OBJS@
189LIBOBJDIR= Python/
190LIBOBJS= @LIBOBJS@
191UNICODE_OBJS= @UNICODE_OBJS@
192
193PYTHON= python$(EXE)
194BUILDPYTHON= python$(BUILDEXE)
195
[391]196PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
197_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
198HOST_GNU_TYPE= @host@
199
200# Tcl and Tk config info from --with-tcltk-includes and -libs options
201TCLTK_INCLUDES= @TCLTK_INCLUDES@
202TCLTK_LIBS= @TCLTK_LIBS@
203
[2]204# The task to run while instrument when building the profile-opt target
205PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
206#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
207
208# === Definitions added by makesetup ===
209
210
211##########################################################################
212# Modules
213MODULE_OBJS= \
214 Modules/config.o \
215 Modules/getpath.o \
216 Modules/main.o \
217 Modules/gcmodule.o
218
219# Used of signalmodule.o is not available
220SIGNAL_OBJS= @SIGNAL_OBJS@
221
222
223##########################################################################
224# Grammar
[391]225GRAMMAR_H= Include/graminit.h
226GRAMMAR_C= Python/graminit.c
[2]227GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
228
229
[391]230LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
231
[2]232##########################################################################
233# Parser
234PGEN= Parser/pgen$(EXE)
235
[391]236PSRCS= \
237 Parser/acceler.c \
238 Parser/grammar1.c \
239 Parser/listnode.c \
240 Parser/node.c \
241 Parser/parser.c \
242 Parser/parsetok.c \
243 Parser/bitset.c \
244 Parser/metagrammar.c \
245 Parser/firstsets.c \
246 Parser/grammar.c \
247 Parser/pgen.c
248
[2]249POBJS= \
250 Parser/acceler.o \
251 Parser/grammar1.o \
252 Parser/listnode.o \
253 Parser/node.o \
254 Parser/parser.o \
255 Parser/parsetok.o \
256 Parser/bitset.o \
257 Parser/metagrammar.o \
258 Parser/firstsets.o \
259 Parser/grammar.o \
260 Parser/pgen.o
261
262PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
263
[391]264PGSRCS= \
265 Objects/obmalloc.c \
266 Python/mysnprintf.c \
267 Python/pyctype.c \
268 Parser/tokenizer_pgen.c \
269 Parser/printgrammar.c \
270 Parser/pgenmain.c
271
[2]272PGOBJS= \
273 Objects/obmalloc.o \
274 Python/mysnprintf.o \
[391]275 Python/pyctype.o \
[2]276 Parser/tokenizer_pgen.o \
277 Parser/printgrammar.o \
278 Parser/pgenmain.o
279
280PARSER_HEADERS= \
281 Parser/parser.h \
282 Parser/tokenizer.h
283
[391]284PGENSRCS= $(PSRCS) $(PGSRCS)
285PGENOBJS= $(POBJS) $(PGOBJS)
[2]286
287##########################################################################
288# AST
[391]289AST_H_DIR= Include
[2]290AST_H= $(AST_H_DIR)/Python-ast.h
[391]291AST_C_DIR= Python
[2]292AST_C= $(AST_C_DIR)/Python-ast.c
293AST_ASDL= $(srcdir)/Parser/Python.asdl
294
295ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
296# XXX Note that a build now requires Python exist before the build starts
297ASDLGEN= $(srcdir)/Parser/asdl_c.py
298
299##########################################################################
300# Python
301PYTHON_OBJS= \
302 Python/_warnings.o \
303 Python/Python-ast.o \
304 Python/asdl.o \
305 Python/ast.o \
306 Python/bltinmodule.o \
307 Python/ceval.o \
308 Python/compile.o \
309 Python/codecs.o \
310 Python/errors.o \
311 Python/frozen.o \
312 Python/frozenmain.o \
313 Python/future.o \
314 Python/getargs.o \
315 Python/getcompiler.o \
316 Python/getcopyright.o \
317 Python/getplatform.o \
318 Python/getversion.o \
319 Python/graminit.o \
320 Python/import.o \
321 Python/importdl.o \
322 Python/marshal.o \
323 Python/modsupport.o \
324 Python/mystrtoul.o \
325 Python/mysnprintf.o \
326 Python/peephole.o \
327 Python/pyarena.o \
[391]328 Python/pyctype.o \
[2]329 Python/pyfpe.o \
330 Python/pymath.o \
331 Python/pystate.o \
332 Python/pythonrun.o \
[391]333 Python/random.o \
[2]334 Python/structmember.o \
335 Python/symtable.o \
336 Python/sysmodule.o \
337 Python/traceback.o \
338 Python/getopt.o \
339 Python/pystrcmp.o \
340 Python/pystrtod.o \
[391]341 Python/dtoa.o \
[2]342 Python/formatter_unicode.o \
343 Python/formatter_string.o \
344 Python/$(DYNLOADFILE) \
345 $(LIBOBJS) \
346 $(MACHDEP_OBJS) \
347 $(THREADOBJ)
348
349
350##########################################################################
351# Objects
352OBJECT_OBJS= \
353 Objects/abstract.o \
354 Objects/boolobject.o \
355 Objects/bufferobject.o \
356 Objects/bytes_methods.o \
357 Objects/bytearrayobject.o \
[391]358 Objects/capsule.o \
[2]359 Objects/cellobject.o \
360 Objects/classobject.o \
361 Objects/cobject.o \
362 Objects/codeobject.o \
363 Objects/complexobject.o \
364 Objects/descrobject.o \
365 Objects/enumobject.o \
366 Objects/exceptions.o \
367 Objects/genobject.o \
368 Objects/fileobject.o \
369 Objects/floatobject.o \
370 Objects/frameobject.o \
371 Objects/funcobject.o \
372 Objects/intobject.o \
373 Objects/iterobject.o \
374 Objects/listobject.o \
375 Objects/longobject.o \
376 Objects/dictobject.o \
[391]377 Objects/memoryobject.o \
[2]378 Objects/methodobject.o \
379 Objects/moduleobject.o \
380 Objects/object.o \
381 Objects/obmalloc.o \
382 Objects/rangeobject.o \
383 Objects/setobject.o \
384 Objects/sliceobject.o \
385 Objects/stringobject.o \
386 Objects/structseq.o \
387 Objects/tupleobject.o \
388 Objects/typeobject.o \
389 Objects/weakrefobject.o \
390 $(UNICODE_OBJS)
391
392
393##########################################################################
394# objects that get linked into the Python library
395LIBRARY_OBJS= \
396 Modules/getbuildinfo.o \
397 $(PARSER_OBJS) \
398 $(OBJECT_OBJS) \
399 $(PYTHON_OBJS) \
400 $(MODULE_OBJS) \
401 $(SIGNAL_OBJS) \
402 $(MODOBJS)
403
404#########################################################################
405# Rules
406
407# Default target
408all: build_all
[391]409build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
[2]410
411# Compile a binary with gcc profile guided optimization.
412profile-opt:
413 @echo "Building with support for profile generation:"
414 $(MAKE) clean
415 $(MAKE) build_all_generate_profile
416 @echo "Running benchmark to generate profile data:"
417 $(MAKE) profile-removal
418 $(MAKE) run_profile_task
419 @echo "Rebuilding with profile guided optimizations:"
420 $(MAKE) clean
421 $(MAKE) build_all_use_profile
422
423build_all_generate_profile:
424 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
425
426run_profile_task:
[391]427 : # FIXME: can't run for a cross build
[2]428 ./$(BUILDPYTHON) $(PROFILE_TASK)
429
430build_all_use_profile:
431 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
432
433coverage:
434 @echo "Building with support for coverage checking:"
435 $(MAKE) clean
436 $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
437
438
439# Build the interpreter
440$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
441 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
442 Modules/python.o \
443 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
444
[391]445platform: $(BUILDPYTHON) pybuilddir.txt
446 $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
[2]447
[391]448# Create build directory and generate the sysconfig build-time data there.
449# pybuilddir.txt contains the name of the build dir and is used for
450# sys.path fixup -- see Modules/getpath.c.
451pybuilddir.txt: $(BUILDPYTHON)
452 $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
[2]453
454# Build the shared modules
[391]455# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
456# -s, --silent or --quiet is always the first char.
457# Under BSD make, MAKEFLAGS might be " -s -v x=y".
458sharedmods: $(BUILDPYTHON) pybuilddir.txt
459 @case "$$MAKEFLAGS" in \
460 *\ -s*|s*) quiet="-q";; \
461 *) quiet="";; \
462 esac; \
463 $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
464 _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
465 $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
[2]466
467# Build static library
468# avoid long command lines, same as LIBRARY_OBJS
469$(LIBRARY): $(LIBRARY_OBJS)
470 -rm -f $@
[391]471 $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
472 $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
473 $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
474 $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
475 $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
476 $(AR) $(ARFLAGS) $@ $(MODOBJS)
[2]477 $(RANLIB) $@
478
479libpython$(VERSION).so: $(LIBRARY_OBJS)
480 if test $(INSTSONAME) != $(LDLIBRARY); then \
[391]481 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
[2]482 $(LN) -f $(INSTSONAME) $@; \
483 else \
[391]484 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
[2]485 fi
486
487libpython$(VERSION).dylib: $(LIBRARY_OBJS)
488 $(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); \
489
[391]490
[2]491libpython$(VERSION).sl: $(LIBRARY_OBJS)
[391]492 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
[2]493
[391]494# Copy up the gdb python hooks into a position where they can be automatically
495# loaded by gdb during Lib/test/test_gdb.py
496#
497# Distributors are likely to want to install this somewhere else e.g. relative
498# to the stripped DWARF data for the shared library.
499gdbhooks: $(BUILDPYTHON)-gdb.py
500
501SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
502$(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
503 $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
504
[2]505# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
506# minimal framework (not including the Lib directory and such) in the current
507# directory.
508RESSRCDIR=Mac/Resources/framework
509$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
510 $(LIBRARY) \
511 $(RESSRCDIR)/Info.plist
512 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
[391]513 $(CC) -o $(LDLIBRARY) $(LDFLAGS) -dynamiclib \
514 -all_load $(LIBRARY) -Wl,-single_module \
515 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
516 -compatibility_version $(VERSION) \
517 -current_version $(VERSION);
[2]518 $(INSTALL) -d -m $(DIRMODE) \
519 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
520 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
521 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
522 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
523 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
524 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
525 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
526
[10]527ifneq ($(filter os2emx os2knix,$(MACHDEP)),) # bird hack!
528$(DLLLIBRARY) $(LDLIBRARY): $(LIBRARY_OBJS)
529 $(LDSHARED) -o $(DLLLIBRARY) $^ $(LIBS) $(MODLIBS) $(SYSLIBS)
530 emximp -o $(LDLIBRARY) $(DLLLIBRARY)
531
532else # CYGWIN
[2]533# This rule builds the Cygwin Python DLL and import library if configured
534# for a shared core library; otherwise, this rule is a noop.
535$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
536 if test -n "$(DLLLIBRARY)"; then \
[391]537 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
[2]538 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
539 else true; \
540 fi
[10]541endif # end bird hack!
[2]542
543
544oldsharedmods: $(SHAREDMODS)
545
546
547Makefile Modules/config.c: Makefile.pre \
548 $(srcdir)/Modules/config.c.in \
549 $(MAKESETUP) \
550 Modules/Setup.config \
551 Modules/Setup \
552 Modules/Setup.local
553 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
554 -s Modules \
555 Modules/Setup.config \
556 Modules/Setup.local \
557 Modules/Setup
558 @mv config.c Modules
559 @echo "The Makefile was updated, you may need to re-run make."
560
561
562Modules/Setup: $(srcdir)/Modules/Setup.dist
563 @if test -f Modules/Setup; then \
564 echo "-----------------------------------------------"; \
565 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
566 echo "check to make sure you have all the updates you"; \
567 echo "need in your Modules/Setup file."; \
568 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
569 echo "-----------------------------------------------"; \
570 fi
571
572############################################################################
573# Special rules for object files
574
575Modules/getbuildinfo.o: $(PARSER_OBJS) \
576 $(OBJECT_OBJS) \
577 $(PYTHON_OBJS) \
578 $(MODULE_OBJS) \
579 $(SIGNAL_OBJS) \
580 $(MODOBJS) \
581 $(srcdir)/Modules/getbuildinfo.c
[391]582 $(CC) -c $(PY_CFLAGS) \
583 -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \
584 -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
585 -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
586 -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
587 -o $@ $(srcdir)/Modules/getbuildinfo.c
[2]588
589Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
590 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
591 -DPREFIX='"$(prefix)"' \
592 -DEXEC_PREFIX='"$(exec_prefix)"' \
593 -DVERSION='"$(VERSION)"' \
594 -DVPATH='"$(VPATH)"' \
595 -o $@ $(srcdir)/Modules/getpath.c
596
597Modules/python.o: $(srcdir)/Modules/python.c
598 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
599
[391]600Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h
[2]601
[391]602Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h
[2]603
[391]604Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
605
606$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
607 @$(MKDIR_P) Include
608 $(MAKE) $(PGEN)
609 $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
610$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
611 $(MAKE) $(GRAMMAR_H)
612 touch $(GRAMMAR_C)
613
[2]614$(PGEN): $(PGENOBJS)
615 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
616
617Parser/grammar.o: $(srcdir)/Parser/grammar.c \
618 $(srcdir)/Include/token.h \
619 $(srcdir)/Include/grammar.h
620Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
621
622Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
623
624Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
625
626$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
[10]627ifndef BOOTSTRAPPING_PYTHON
[391]628 $(MKDIR_P) $(AST_H_DIR)
[2]629 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
[10]630endif
[2]631
632$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
[10]633ifndef BOOTSTRAPPING_PYTHON
[391]634 $(MKDIR_P) $(AST_C_DIR)
[2]635 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
[10]636endif
[2]637
[391]638Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
[2]639
640Python/getplatform.o: $(srcdir)/Python/getplatform.c
641 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
642
643Python/importdl.o: $(srcdir)/Python/importdl.c
644 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
645
646Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
647 $(srcdir)/Objects/unicodetype_db.h
648
649STRINGLIB_HEADERS= \
650 $(srcdir)/Include/bytes_methods.h \
651 $(srcdir)/Objects/stringlib/count.h \
652 $(srcdir)/Objects/stringlib/ctype.h \
653 $(srcdir)/Objects/stringlib/fastsearch.h \
654 $(srcdir)/Objects/stringlib/find.h \
655 $(srcdir)/Objects/stringlib/formatter.h \
656 $(srcdir)/Objects/stringlib/partition.h \
[391]657 $(srcdir)/Objects/stringlib/split.h \
[2]658 $(srcdir)/Objects/stringlib/stringdefs.h \
659 $(srcdir)/Objects/stringlib/string_format.h \
660 $(srcdir)/Objects/stringlib/transmogrify.h \
661 $(srcdir)/Objects/stringlib/unicodedefs.h \
662 $(srcdir)/Objects/stringlib/localeutil.h
663
664Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
665 $(STRINGLIB_HEADERS)
666
667Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
668 $(STRINGLIB_HEADERS)
669
670Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
671 $(STRINGLIB_HEADERS)
672
673Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
674 $(STRINGLIB_HEADERS)
675
676Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
677 $(STRINGLIB_HEADERS)
678
679############################################################################
680# Header files
681
682PYTHON_HEADERS= \
683 Include/Python-ast.h \
684 Include/Python.h \
685 Include/abstract.h \
686 Include/asdl.h \
687 Include/ast.h \
688 Include/bitset.h \
689 Include/boolobject.h \
690 Include/bytearrayobject.h \
691 Include/bytes_methods.h \
692 Include/bytesobject.h \
693 Include/bufferobject.h \
694 Include/cellobject.h \
695 Include/ceval.h \
696 Include/classobject.h \
697 Include/cobject.h \
698 Include/code.h \
699 Include/codecs.h \
700 Include/compile.h \
701 Include/complexobject.h \
702 Include/descrobject.h \
703 Include/dictobject.h \
[391]704 Include/dtoa.h \
[2]705 Include/enumobject.h \
706 Include/errcode.h \
707 Include/eval.h \
708 Include/fileobject.h \
709 Include/floatobject.h \
710 Include/frameobject.h \
711 Include/funcobject.h \
712 Include/genobject.h \
713 Include/import.h \
714 Include/intobject.h \
715 Include/intrcheck.h \
716 Include/iterobject.h \
717 Include/listobject.h \
718 Include/longintrepr.h \
719 Include/longobject.h \
720 Include/marshal.h \
[391]721 Include/memoryobject.h \
[2]722 Include/metagrammar.h \
723 Include/methodobject.h \
724 Include/modsupport.h \
725 Include/moduleobject.h \
726 Include/node.h \
727 Include/object.h \
728 Include/objimpl.h \
729 Include/opcode.h \
730 Include/osdefs.h \
731 Include/parsetok.h \
732 Include/patchlevel.h \
733 Include/pgen.h \
734 Include/pgenheaders.h \
735 Include/pyarena.h \
[391]736 Include/pycapsule.h \
737 Include/pyctype.h \
[2]738 Include/pydebug.h \
739 Include/pyerrors.h \
740 Include/pyfpe.h \
741 Include/pymath.h \
742 Include/pygetopt.h \
743 Include/pymem.h \
744 Include/pyport.h \
745 Include/pystate.h \
746 Include/pystrcmp.h \
747 Include/pystrtod.h \
748 Include/pythonrun.h \
749 Include/pythread.h \
750 Include/rangeobject.h \
751 Include/setobject.h \
752 Include/sliceobject.h \
753 Include/stringobject.h \
754 Include/structmember.h \
755 Include/structseq.h \
756 Include/symtable.h \
757 Include/sysmodule.h \
758 Include/traceback.h \
759 Include/tupleobject.h \
760 Include/ucnhash.h \
761 Include/unicodeobject.h \
762 Include/warnings.h \
763 Include/weakrefobject.h \
764 pyconfig.h \
765 $(PARSER_HEADERS)
766
767$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
768
769
770######################################################################
771
772# Test the interpreter (twice, once without .pyc files, once with)
773# In the past, we've had problems where bugs in the marshalling or
774# elsewhere caused bytecode read from .pyc files to behave differently
775# than bytecode generated directly from a .py source file. Sometimes
[391]776# the bytecode read from a .pyc file had the bug, sometimes the directly
[2]777# generated bytecode. This is sometimes a very shy bug needing a lot of
778# sample data.
779
780TESTOPTS= -l $(EXTRATESTOPTS)
781TESTPROG= $(srcdir)/Lib/test/regrtest.py
[391]782TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
[2]783test: all platform
784 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
785 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
786 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
787
788testall: all platform
789 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
790 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
791 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
[391]792 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
793 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
[2]794
795# Run the unitests for both architectures in a Universal build on OSX
796# Must be run on an Intel box.
797testuniversal: all platform
798 if [ `arch` != 'i386' ];then \
799 echo "This can only be used on OSX/i386" ;\
800 exit 1 ;\
801 fi
802 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
[391]803 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
804 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
805 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) -uall $(TESTOPTS)
[2]806
807
808# Like testall, but with a single pass only
809# run an optional script to include some information about the build environment
810buildbottest: all platform
811 -@if which pybuildbot.identify >/dev/null 2>&1; then \
812 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
813 fi
[391]814 $(TESTPYTHON) -R $(TESTPROG) -uall -rwW $(TESTOPTS)
[2]815
[391]816QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
817 test_multibytecodec test_urllib2_localnet test_itertools \
818 test_multiprocessing test_mailbox test_socket test_poll \
819 test_select test_zipfile
[2]820quicktest: all platform
821 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
822 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
823 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
824
825MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
826 test_longexp
827memtest: all platform
828 -rm -f $(srcdir)/Lib/test/*.py[co]
829 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
830 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
831
832# Install everything
833install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
834
835# Install almost everything without disturbing previous versions
[391]836altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall \
837 libainstall altmaninstall \
[2]838 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
839
840# Install shared libraries enabled by Setup
841DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
842
843oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
844 @for i in X $(SHAREDMODS); do \
845 if test $$i != X; then \
846 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
847 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
848 fi; \
849 done
850
851$(DESTSHARED):
852 @for i in $(DESTDIRS); \
853 do \
854 if test ! -d $(DESTDIR)$$i; then \
855 echo "Creating directory $$i"; \
856 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
857 else true; \
858 fi; \
859 done
860
861
[391]862# Install the interpreter by creating a symlink chain:
863# $(PYTHON) -> python2 -> python$(VERSION))
864# Also create equivalent chains for other installed files
[2]865bininstall: altbininstall
866 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
867 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
868 else true; \
869 fi
[391]870 (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
871 -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
872 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
873 -rm -f $(DESTDIR)$(BINDIR)/python2-config
874 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
[2]875 -rm -f $(DESTDIR)$(BINDIR)/python-config
[391]876 (cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
877 -test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
878 -rm -f $(DESTDIR)$(LIBPC)/python2.pc
879 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
880 -rm -f $(DESTDIR)$(LIBPC)/python.pc
881 (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
[10]882 rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
883 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/$(PYTHON); \
884 $(INSTALL_DATA) $(LDLIBRARY) $(DLLLIBRARY) $(DESTDIR)$(LIBDIR); \
[2]885
886# Install the interpreter with $(VERSION) affixed
887# This goes into $(exec_prefix)
888altbininstall: $(BUILDPYTHON)
889 @for i in $(BINDIR) $(LIBDIR); \
890 do \
891 if test ! -d $(DESTDIR)$$i; then \
892 echo "Creating directory $$i"; \
893 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
894 else true; \
895 fi; \
896 done
897 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
898 if test -f $(LDLIBRARY); then \
899 if test -n "$(DLLLIBRARY)" ; then \
900 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
901 else \
902 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
903 if test $(LDLIBRARY) != $(INSTSONAME); then \
904 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
905 fi \
906 fi; \
907 else true; \
908 fi
909
[391]910# Install the versioned manual page
911altmaninstall:
[2]912 @for i in $(MANDIR) $(MANDIR)/man1; \
913 do \
914 if test ! -d $(DESTDIR)$$i; then \
915 echo "Creating directory $$i"; \
916 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
917 else true; \
918 fi; \
919 done
920 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
[391]921 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
[2]922
[391]923# Install the unversioned manual pages
924maninstall: altmaninstall
925 -rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
926 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
927 -rm -f $(DESTDIR)$(MANDIR)/man1/python.1
928 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)
929
[2]930# Install the library
931PLATDIR= plat-$(MACHDEP)
932EXTRAPLATDIR= @EXTRAPLATDIR@
933EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
934MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
935XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
936PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
937 plat-mac/lib-scriptpackages/_builtinSuites \
938 plat-mac/lib-scriptpackages/CodeWarrior \
939 plat-mac/lib-scriptpackages/Explorer \
940 plat-mac/lib-scriptpackages/Finder \
941 plat-mac/lib-scriptpackages/Netscape \
942 plat-mac/lib-scriptpackages/StdSuites \
943 plat-mac/lib-scriptpackages/SystemEvents \
[391]944 plat-mac/lib-scriptpackages/Terminal
[2]945PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
[391]946LIBSUBDIRS= lib-tk lib-tk/test lib-tk/test/test_tkinter \
947 lib-tk/test/test_ttk site-packages test test/audiodata test/data \
948 test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \
949 test/tracedmodules \
[2]950 encodings compiler hotshot \
951 email email/mime email/test email/test/data \
952 json json/tests \
953 sqlite3 sqlite3/test \
[391]954 logging bsddb bsddb/test csv importlib wsgiref \
[2]955 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
[391]956 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
[2]957 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
958 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
959 multiprocessing multiprocessing/dummy \
[391]960 unittest unittest/test \
[2]961 lib-old \
[391]962 curses pydoc_data $(MACHDEPS)
963libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
[2]964 @for i in $(SCRIPTDIR) $(LIBDEST); \
965 do \
966 if test ! -d $(DESTDIR)$$i; then \
967 echo "Creating directory $$i"; \
968 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
969 else true; \
970 fi; \
971 done
972 @for d in $(LIBSUBDIRS); \
973 do \
974 a=$(srcdir)/Lib/$$d; \
975 if test ! -d $$a; then continue; else true; fi; \
976 b=$(LIBDEST)/$$d; \
977 if test ! -d $(DESTDIR)$$b; then \
978 echo "Creating directory $$b"; \
979 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
980 else true; \
981 fi; \
982 done
[391]983 @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
[2]984 do \
985 if test -x $$i; then \
986 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
987 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
988 else \
989 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
990 echo $(INSTALL_DATA) $$i $(LIBDEST); \
991 fi; \
992 done
993 @for d in $(LIBSUBDIRS); \
994 do \
995 a=$(srcdir)/Lib/$$d; \
996 if test ! -d $$a; then continue; else true; fi; \
997 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
998 b=$(LIBDEST)/$$d; \
999 for i in $$a/*; \
1000 do \
1001 case $$i in \
1002 *CVS) ;; \
1003 *.py[co]) ;; \
1004 *.orig) ;; \
1005 *~) ;; \
1006 *) \
1007 if test -d $$i; then continue; fi; \
1008 if test -x $$i; then \
1009 echo $(INSTALL_SCRIPT) $$i $$b; \
1010 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
1011 else \
1012 echo $(INSTALL_DATA) $$i $$b; \
1013 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
1014 fi;; \
1015 esac; \
1016 done; \
1017 done
1018 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
[391]1019 if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
1020 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
1021 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
1022 fi
[2]1023 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
[391]1024 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
[2]1025 -d $(LIBDEST) -f \
[391]1026 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1027 $(DESTDIR)$(LIBDEST)
[2]1028 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
[391]1029 $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
[2]1030 -d $(LIBDEST) -f \
[391]1031 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1032 $(DESTDIR)$(LIBDEST)
[2]1033 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
[391]1034 $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
[2]1035 -d $(LIBDEST)/site-packages -f \
1036 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1037 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
[391]1038 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
[2]1039 -d $(LIBDEST)/site-packages -f \
1040 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1041 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
[391]1042 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
1043 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1044 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
[2]1045
[10]1046ifneq ($(filter os2emx os2knix,$(MACHDEP)),) # bird hack!
1047PATH_SEPARATOR = ;
1048else
1049PATH_SEPARATOR = :
1050endif
1051
[2]1052# Create the PLATDIR source directory, if one wasn't distributed..
1053$(srcdir)/Lib/$(PLATDIR):
1054 mkdir $(srcdir)/Lib/$(PLATDIR)
1055 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
[10]1056 export PATH; PATH="`pwd`$(PATH_SEPARATOR)$$PATH"; \
[391]1057 export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \
[2]1058 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
1059 export EXE; EXE="$(BUILDEXE)"; \
[391]1060 if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
1061 export PYTHON_FOR_BUILD; \
1062 if [ "$(build)" = "$(host)" ]; then \
1063 PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
1064 else \
1065 PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
1066 fi; \
[2]1067 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
1068
[391]1069python-config: $(srcdir)/Misc/python-config.in
1070 # Substitution happens here, as the completely-expanded BINDIR
1071 # is not available in configure
1072 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1073
[2]1074# Install the include files
1075INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1076inclinstall:
1077 @for i in $(INCLDIRSTOMAKE); \
1078 do \
1079 if test ! -d $(DESTDIR)$$i; then \
1080 echo "Creating directory $$i"; \
1081 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1082 else true; \
1083 fi; \
1084 done
1085 @for i in $(srcdir)/Include/*.h; \
1086 do \
1087 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1088 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1089 done
1090 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1091
1092# Install the library and miscellaneous stuff needed for extending/embedding
1093# This goes into $(exec_prefix)
1094LIBPL= $(LIBP)/config
[391]1095
1096# pkgconfig directory
1097LIBPC= $(LIBDIR)/pkgconfig
1098
1099libainstall: all python-config
1100 @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
[2]1101 do \
1102 if test ! -d $(DESTDIR)$$i; then \
1103 echo "Creating directory $$i"; \
1104 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1105 else true; \
1106 fi; \
1107 done
1108 @if test -d $(LIBRARY); then :; else \
1109 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1110 if test "$(SO)" = .dll; then \
1111 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
1112 else \
1113 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1114 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1115 fi; \
1116 else \
1117 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
1118 fi; \
1119 fi
1120 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1121 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
1122 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1123 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1124 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1125 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1126 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
[391]1127 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
[2]1128 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1129 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1130 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1131 rm python-config
1132 @if [ -s Modules/python.exp -a \
1133 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1134 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1135 $(INSTALL_DATA) Modules/python.exp \
1136 $(DESTDIR)$(LIBPL)/python.exp; \
1137 echo; echo "$(LIBPL)/python.exp"; \
1138 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
1139 $(DESTDIR)$(LIBPL)/makexp_aix; \
1140 echo "$(LIBPL)/makexp_aix"; \
1141 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
1142 $(DESTDIR)$(LIBPL)/ld_so_aix; \
1143 echo "$(LIBPL)/ld_so_aix"; \
1144 echo; echo "See Misc/AIX-NOTES for details."; \
1145 else true; \
1146 fi
1147 @case "$(MACHDEP)" in beos*) \
1148 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
1149 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
1150 echo; echo "$(LIBPL)/README"; \
1151 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
1152 echo "$(LIBPL)/ar_beos"; \
1153 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
1154 echo "$(LIBPL)/ld_so_beos"; \
1155 echo; echo "See Misc/BeOS-NOTES for details."; \
1156 ;; \
1157 esac
1158
1159# Install the dynamically loadable modules
1160# This goes into $(exec_prefix)
[391]1161sharedinstall: sharedmods
1162 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
[2]1163 --prefix=$(prefix) \
1164 --install-scripts=$(BINDIR) \
1165 --install-platlib=$(DESTSHARED) \
[391]1166 --root=$(DESTDIR)/
1167 -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
[2]1168
1169# Here are a couple of targets for MacOSX again, to install a full
1170# framework-based Python. frameworkinstall installs everything, the
1171# subtargets install specific parts. Much of the actual work is offloaded to
1172# the Makefile in Mac
1173#
1174#
1175# This target is here for backward compatiblity, previous versions of Python
1176# hadn't integrated framework installation in the normal install process.
1177frameworkinstall: install
1178
1179# On install, we re-make the framework
1180# structure in the install location, /Library/Frameworks/ or the argument to
1181# --enable-framework. If --enable-framework has been specified then we have
1182# automatically set prefix to the location deep down in the framework, so we
1183# only have to cater for the structural bits of the framework.
1184
1185frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1186
1187frameworkinstallstructure: $(LDLIBRARY)
1188 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1189 echo Not configured with --enable-framework; \
1190 exit 1; \
1191 else true; \
1192 fi
1193 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1194 if test ! -d $(DESTDIR)$$i; then \
1195 echo "Creating directory $(DESTDIR)$$i"; \
1196 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1197 else true; \
1198 fi; \
1199 done
1200 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1201 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1202 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1203 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1204 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1205 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1206 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1207
1208# This installs Mac/Lib into the framework
1209# Install a number of symlinks to keep software that expects a normal unix
1210# install (which includes python-config) happy.
1211frameworkinstallmaclib:
1212 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1213 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
[391]1214 ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
[2]1215 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1216
1217# This installs the IDE, the Launcher and other apps into /Applications
1218frameworkinstallapps:
1219 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1220
1221# This install the unix python and pythonw tools in /usr/local/bin
1222frameworkinstallunixtools:
1223 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1224
1225frameworkaltinstallunixtools:
1226 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1227
1228# This installs the Demos and Tools into the applications directory.
1229# It is not part of a normal frameworkinstall
1230frameworkinstallextras:
1231 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1232
1233# This installs a few of the useful scripts in Tools/scripts
1234scriptsinstall:
1235 SRCDIR=$(srcdir) $(RUNSHARED) \
[391]1236 $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
[2]1237 --prefix=$(prefix) \
1238 --install-scripts=$(BINDIR) \
[391]1239 --root=$(DESTDIR)/
[2]1240
1241# Build the toplevel Makefile
1242Makefile.pre: Makefile.pre.in config.status
1243 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1244 $(MAKE) -f Makefile.pre Makefile
1245
1246# Run the configure script.
1247config.status: $(srcdir)/configure
1248 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1249
1250.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1251
1252# Some make's put the object file in the current directory
1253.c.o:
1254 $(CC) -c $(PY_CFLAGS) -o $@ $<
1255
1256# Run reindent on the library
1257reindent:
1258 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1259
1260# Rerun configure with the same options as it was run last time,
1261# provided the config.status script exists
1262recheck:
1263 $(SHELL) config.status --recheck
1264 $(SHELL) config.status
1265
[391]1266# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
[2]1267autoconf:
1268 (cd $(srcdir); autoconf)
1269 (cd $(srcdir); autoheader)
1270
1271# Create a tags file for vi
1272tags::
1273 cd $(srcdir); \
1274 ctags -w -t Include/*.h; \
1275 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1276 done; \
1277 sort -o tags tags
1278
1279# Create a tags file for GNU Emacs
1280TAGS::
1281 cd $(srcdir); \
1282 etags Include/*.h; \
1283 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1284
[391]1285# Touch generated files
1286touch:
1287 touch Include/Python-ast.h Python/Python-ast.c
1288
[2]1289# Sanitation targets -- clean leaves libraries, executables and tags
1290# files, which clobber removes as well
1291pycremoval:
1292 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1293
1294clean: pycremoval
[391]1295 find . -name '*.[oa]' -exec rm -f {} ';'
[2]1296 find . -name '*.s[ol]' -exec rm -f {} ';'
[391]1297 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
1298 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1299 find build -name 'fficonfig.py' -exec rm -f {} ';' || true
[2]1300 -rm -f Lib/lib2to3/*Grammar*.pickle
1301
1302profile-removal:
1303 find . -name '*.gc??' -exec rm -f {} ';'
1304
1305clobber: clean profile-removal
1306 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1307 tags TAGS \
1308 config.cache config.log pyconfig.h Modules/config.c
1309 -rm -rf build platform
1310 -rm -rf $(PYTHONFRAMEWORKDIR)
1311
1312# Make things extra clean, before making a distribution:
1313# remove all generated files, even Makefile[.pre]
1314# Keep configure and Python-ast.[ch], it's possible they can't be generated
1315distclean: clobber
[391]1316 for file in Lib/test/data/* ; do \
1317 if test "$$file" != "Lib/test/data/README"; then rm "$$file"; fi; \
1318 done
[2]1319 -rm -f core Makefile Makefile.pre config.status \
[391]1320 Modules/Setup Modules/Setup.local Modules/Setup.config \
1321 Modules/ld_so_aix Modules/python.exp Misc/python.pc
1322 -rm -f python*-gdb.py
1323 -rm -f pybuilddir.txt
1324 find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
1325 -o -name '[@,#]*' -o -name '*.old' \
1326 -o -name '*.orig' -o -name '*.rej' \
1327 -o -name '*.bak' ')' \
1328 -exec rm -f {} ';'
[2]1329
1330# Check for smelly exported symbols (not starting with Py/_Py)
1331smelly: all
1332 nm -p $(LIBRARY) | \
1333 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1334
1335# Find files with funny names
1336funny:
[391]1337 find $(SUBDIRS) $(SUBDIRSTOO) -type d \
[2]1338 -o -name '*.[chs]' \
1339 -o -name '*.py' \
1340 -o -name '*.doc' \
1341 -o -name '*.sty' \
1342 -o -name '*.bib' \
1343 -o -name '*.dat' \
1344 -o -name '*.el' \
1345 -o -name '*.fd' \
1346 -o -name '*.in' \
1347 -o -name '*.tex' \
1348 -o -name '*,[vpt]' \
1349 -o -name 'Setup' \
1350 -o -name 'Setup.*' \
1351 -o -name README \
1352 -o -name Makefile \
1353 -o -name ChangeLog \
1354 -o -name Repository \
1355 -o -name Root \
1356 -o -name Entries \
1357 -o -name Tag \
1358 -o -name tags \
1359 -o -name TAGS \
1360 -o -name .cvsignore \
1361 -o -name MANIFEST \
1362 -o -print
1363
1364# Perform some verification checks on any modified files.
1365patchcheck:
1366 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1367
1368# Dependencies
1369
1370Python/thread.o: @THREADHEADERS@
1371
1372# Declare targets that aren't real files
1373.PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1374.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1375.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1376.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1377.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
[391]1378.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1379.PHONY: smelly funny patchcheck touch altmaninstall
1380.PHONY: gdbhooks
[2]1381
1382# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
Note: See TracBrowser for help on using the repository browser.