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

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

python: Fix typo in r397.

  • Property svn:eol-style set to native
File size: 43.8 KB
Line 
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@
30abs_srcdir= @abs_srcdir@
31abs_builddir= @abs_builddir@
32build= @build@
33host= @host@
34
35CC= @CC@
36CXX= @CXX@
37MAINCC= @MAINCC@
38LINKCC= @LINKCC@
39AR= @AR@
40RANLIB= @RANLIB@
41SVNVERSION= @SVNVERSION@
42HGVERSION= @HGVERSION@
43HGTAG= @HGTAG@
44HGBRANCH= @HGBRANCH@
45
46GNULD= @GNULD@
47
48# Shell used by make (some versions default to the login shell, which is bad)
49SHELL= @SHELL@
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
64MKDIR_P= @MKDIR_P@
65
66MAKESETUP= $(srcdir)/Modules/makesetup
67
68# Compiler options
69OPT= @OPT@
70BASECFLAGS= @BASECFLAGS@
71CFLAGS= $(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
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@
81ARFLAGS= @ARFLAGS@
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
91# Multiarch directory (may be empty)
92MULTIARCH= @MULTIARCH@
93
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
104BINDIR= @bindir@
105LIBDIR= @libdir@
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@
120LDSHARED= @LDSHARED@ $(LDFLAGS)
121BLDSHARED= @BLDSHARED@ $(LDFLAGS)
122LDCXXSHARED= @LDCXXSHARED@
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
164CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
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@
176CONDENSED_VERSION= @CONDENSED_VERSION@
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
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
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
225GRAMMAR_H= Include/graminit.h
226GRAMMAR_C= Python/graminit.c
227GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
228
229
230LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
231
232##########################################################################
233# Parser
234PGEN= Parser/pgen$(EXE)
235
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
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
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
272PGOBJS= \
273 Objects/obmalloc.o \
274 Python/mysnprintf.o \
275 Python/pyctype.o \
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
284PGENSRCS= $(PSRCS) $(PGSRCS)
285PGENOBJS= $(POBJS) $(PGOBJS)
286
287##########################################################################
288# AST
289AST_H_DIR= Include
290AST_H= $(AST_H_DIR)/Python-ast.h
291AST_C_DIR= Python
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 \
328 Python/pyctype.o \
329 Python/pyfpe.o \
330 Python/pymath.o \
331 Python/pystate.o \
332 Python/pythonrun.o \
333 Python/random.o \
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 \
341 Python/dtoa.o \
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 \
358 Objects/capsule.o \
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 \
377 Objects/memoryobject.o \
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
409build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
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:
427 : # FIXME: can't run for a cross build
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
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
447
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
453
454# Build the shared modules
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
466
467# Build static library
468# avoid long command lines, same as LIBRARY_OBJS
469$(LIBRARY): $(LIBRARY_OBJS)
470 -rm -f $@
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)
477 $(RANLIB) $@
478
479libpython$(VERSION).so: $(LIBRARY_OBJS)
480 if test $(INSTSONAME) != $(LDLIBRARY); then \
481 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
482 $(LN) -f $(INSTSONAME) $@; \
483 else \
484 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
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
490
491libpython$(VERSION).sl: $(LIBRARY_OBJS)
492 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
493
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
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)
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);
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
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
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 \
537 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
538 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
539 else true; \
540 fi
541endif # end bird hack!
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
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
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
600Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h
601
602Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h
603
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
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)
627 $(MKDIR_P) $(AST_H_DIR)
628 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
629
630$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
631 $(MKDIR_P) $(AST_C_DIR)
632 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
633
634Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
635
636Python/getplatform.o: $(srcdir)/Python/getplatform.c
637 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
638
639Python/importdl.o: $(srcdir)/Python/importdl.c
640 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
641
642Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
643 $(srcdir)/Objects/unicodetype_db.h
644
645STRINGLIB_HEADERS= \
646 $(srcdir)/Include/bytes_methods.h \
647 $(srcdir)/Objects/stringlib/count.h \
648 $(srcdir)/Objects/stringlib/ctype.h \
649 $(srcdir)/Objects/stringlib/fastsearch.h \
650 $(srcdir)/Objects/stringlib/find.h \
651 $(srcdir)/Objects/stringlib/formatter.h \
652 $(srcdir)/Objects/stringlib/partition.h \
653 $(srcdir)/Objects/stringlib/split.h \
654 $(srcdir)/Objects/stringlib/stringdefs.h \
655 $(srcdir)/Objects/stringlib/string_format.h \
656 $(srcdir)/Objects/stringlib/transmogrify.h \
657 $(srcdir)/Objects/stringlib/unicodedefs.h \
658 $(srcdir)/Objects/stringlib/localeutil.h
659
660Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
661 $(STRINGLIB_HEADERS)
662
663Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
664 $(STRINGLIB_HEADERS)
665
666Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
667 $(STRINGLIB_HEADERS)
668
669Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
670 $(STRINGLIB_HEADERS)
671
672Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
673 $(STRINGLIB_HEADERS)
674
675############################################################################
676# Header files
677
678PYTHON_HEADERS= \
679 Include/Python-ast.h \
680 Include/Python.h \
681 Include/abstract.h \
682 Include/asdl.h \
683 Include/ast.h \
684 Include/bitset.h \
685 Include/boolobject.h \
686 Include/bytearrayobject.h \
687 Include/bytes_methods.h \
688 Include/bytesobject.h \
689 Include/bufferobject.h \
690 Include/cellobject.h \
691 Include/ceval.h \
692 Include/classobject.h \
693 Include/cobject.h \
694 Include/code.h \
695 Include/codecs.h \
696 Include/compile.h \
697 Include/complexobject.h \
698 Include/descrobject.h \
699 Include/dictobject.h \
700 Include/dtoa.h \
701 Include/enumobject.h \
702 Include/errcode.h \
703 Include/eval.h \
704 Include/fileobject.h \
705 Include/floatobject.h \
706 Include/frameobject.h \
707 Include/funcobject.h \
708 Include/genobject.h \
709 Include/import.h \
710 Include/intobject.h \
711 Include/intrcheck.h \
712 Include/iterobject.h \
713 Include/listobject.h \
714 Include/longintrepr.h \
715 Include/longobject.h \
716 Include/marshal.h \
717 Include/memoryobject.h \
718 Include/metagrammar.h \
719 Include/methodobject.h \
720 Include/modsupport.h \
721 Include/moduleobject.h \
722 Include/node.h \
723 Include/object.h \
724 Include/objimpl.h \
725 Include/opcode.h \
726 Include/osdefs.h \
727 Include/parsetok.h \
728 Include/patchlevel.h \
729 Include/pgen.h \
730 Include/pgenheaders.h \
731 Include/pyarena.h \
732 Include/pycapsule.h \
733 Include/pyctype.h \
734 Include/pydebug.h \
735 Include/pyerrors.h \
736 Include/pyfpe.h \
737 Include/pymath.h \
738 Include/pygetopt.h \
739 Include/pymem.h \
740 Include/pyport.h \
741 Include/pystate.h \
742 Include/pystrcmp.h \
743 Include/pystrtod.h \
744 Include/pythonrun.h \
745 Include/pythread.h \
746 Include/rangeobject.h \
747 Include/setobject.h \
748 Include/sliceobject.h \
749 Include/stringobject.h \
750 Include/structmember.h \
751 Include/structseq.h \
752 Include/symtable.h \
753 Include/sysmodule.h \
754 Include/traceback.h \
755 Include/tupleobject.h \
756 Include/ucnhash.h \
757 Include/unicodeobject.h \
758 Include/warnings.h \
759 Include/weakrefobject.h \
760 pyconfig.h \
761 $(PARSER_HEADERS)
762
763$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
764
765
766######################################################################
767
768# Test the interpreter (twice, once without .pyc files, once with)
769# In the past, we've had problems where bugs in the marshalling or
770# elsewhere caused bytecode read from .pyc files to behave differently
771# than bytecode generated directly from a .py source file. Sometimes
772# the bytecode read from a .pyc file had the bug, sometimes the directly
773# generated bytecode. This is sometimes a very shy bug needing a lot of
774# sample data.
775
776TESTOPTS= -l $(EXTRATESTOPTS)
777TESTPROG= $(srcdir)/Lib/test/regrtest.py
778TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
779test: all platform
780 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
781 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
782 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
783
784testall: all platform
785 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
786 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
787 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
788 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
789 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
790
791# Run the unitests for both architectures in a Universal build on OSX
792# Must be run on an Intel box.
793testuniversal: all platform
794 if [ `arch` != 'i386' ];then \
795 echo "This can only be used on OSX/i386" ;\
796 exit 1 ;\
797 fi
798 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
799 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
800 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
801 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) -uall $(TESTOPTS)
802
803
804# Like testall, but with a single pass only
805# run an optional script to include some information about the build environment
806buildbottest: all platform
807 -@if which pybuildbot.identify >/dev/null 2>&1; then \
808 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
809 fi
810 $(TESTPYTHON) -R $(TESTPROG) -uall -rwW $(TESTOPTS)
811
812QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
813 test_multibytecodec test_urllib2_localnet test_itertools \
814 test_multiprocessing test_mailbox test_socket test_poll \
815 test_select test_zipfile
816quicktest: all platform
817 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
818 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
819 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
820
821MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
822 test_longexp
823memtest: all platform
824 -rm -f $(srcdir)/Lib/test/*.py[co]
825 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
826 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
827
828# Install everything
829install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
830
831# Install almost everything without disturbing previous versions
832altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall \
833 libainstall altmaninstall \
834 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
835
836# Install shared libraries enabled by Setup
837DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
838
839oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
840 @for i in X $(SHAREDMODS); do \
841 if test $$i != X; then \
842 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
843 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
844 fi; \
845 done
846
847$(DESTSHARED):
848 @for i in $(DESTDIRS); \
849 do \
850 if test ! -d $(DESTDIR)$$i; then \
851 echo "Creating directory $$i"; \
852 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
853 else true; \
854 fi; \
855 done
856
857
858# Install the interpreter by creating a symlink chain:
859# $(PYTHON) -> python2 -> python$(VERSION))
860# Also create equivalent chains for other installed files
861bininstall: altbininstall
862 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
863 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
864 else true; \
865 fi
866 (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
867 -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
868 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
869 -rm -f $(DESTDIR)$(BINDIR)/python2-config
870 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
871 -rm -f $(DESTDIR)$(BINDIR)/python-config
872 (cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
873 -test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
874 -rm -f $(DESTDIR)$(LIBPC)/python2.pc
875 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
876 -rm -f $(DESTDIR)$(LIBPC)/python.pc
877 (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
878ifneq ($(filter os2emx os2knix,$(MACHDEP)),) # bird-like hack!
879 rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
880 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/$(PYTHON); \
881 $(INSTALL_DATA) $(LDLIBRARY) $(DLLLIBRARY) $(DESTDIR)$(LIBDIR)
882endif
883
884# Install the interpreter with $(VERSION) affixed
885# This goes into $(exec_prefix)
886altbininstall: $(BUILDPYTHON)
887 @for i in $(BINDIR) $(LIBDIR); \
888 do \
889 if test ! -d $(DESTDIR)$$i; then \
890 echo "Creating directory $$i"; \
891 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
892 else true; \
893 fi; \
894 done
895 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
896 if test -f $(LDLIBRARY); then \
897 if test -n "$(DLLLIBRARY)" ; then \
898 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
899 else \
900 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
901 if test $(LDLIBRARY) != $(INSTSONAME); then \
902 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
903 fi \
904 fi; \
905 else true; \
906 fi
907
908# Install the versioned manual page
909altmaninstall:
910 @for i in $(MANDIR) $(MANDIR)/man1; \
911 do \
912 if test ! -d $(DESTDIR)$$i; then \
913 echo "Creating directory $$i"; \
914 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
915 else true; \
916 fi; \
917 done
918 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
919 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
920
921# Install the unversioned manual pages
922maninstall: altmaninstall
923 -rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
924 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
925 -rm -f $(DESTDIR)$(MANDIR)/man1/python.1
926 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)
927
928# Install the library
929PLATDIR= plat-$(MACHDEP)
930EXTRAPLATDIR= @EXTRAPLATDIR@
931EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
932MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
933XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
934PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
935 plat-mac/lib-scriptpackages/_builtinSuites \
936 plat-mac/lib-scriptpackages/CodeWarrior \
937 plat-mac/lib-scriptpackages/Explorer \
938 plat-mac/lib-scriptpackages/Finder \
939 plat-mac/lib-scriptpackages/Netscape \
940 plat-mac/lib-scriptpackages/StdSuites \
941 plat-mac/lib-scriptpackages/SystemEvents \
942 plat-mac/lib-scriptpackages/Terminal
943PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
944LIBSUBDIRS= lib-tk lib-tk/test lib-tk/test/test_tkinter \
945 lib-tk/test/test_ttk site-packages test test/audiodata test/data \
946 test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \
947 test/tracedmodules \
948 encodings compiler hotshot \
949 email email/mime email/test email/test/data \
950 json json/tests \
951 sqlite3 sqlite3/test \
952 logging bsddb bsddb/test csv importlib wsgiref \
953 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
954 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
955 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
956 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
957 multiprocessing multiprocessing/dummy \
958 unittest unittest/test \
959 lib-old \
960 curses pydoc_data $(MACHDEPS)
961libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
962 @for i in $(SCRIPTDIR) $(LIBDEST); \
963 do \
964 if test ! -d $(DESTDIR)$$i; then \
965 echo "Creating directory $$i"; \
966 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
967 else true; \
968 fi; \
969 done
970 @for d in $(LIBSUBDIRS); \
971 do \
972 a=$(srcdir)/Lib/$$d; \
973 if test ! -d $$a; then continue; else true; fi; \
974 b=$(LIBDEST)/$$d; \
975 if test ! -d $(DESTDIR)$$b; then \
976 echo "Creating directory $$b"; \
977 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
978 else true; \
979 fi; \
980 done
981 @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
982 do \
983 if test -x $$i; then \
984 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
985 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
986 else \
987 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
988 echo $(INSTALL_DATA) $$i $(LIBDEST); \
989 fi; \
990 done
991 @for d in $(LIBSUBDIRS); \
992 do \
993 a=$(srcdir)/Lib/$$d; \
994 if test ! -d $$a; then continue; else true; fi; \
995 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
996 b=$(LIBDEST)/$$d; \
997 for i in $$a/*; \
998 do \
999 case $$i in \
1000 *CVS) ;; \
1001 *.py[co]) ;; \
1002 *.orig) ;; \
1003 *~) ;; \
1004 *) \
1005 if test -d $$i; then continue; fi; \
1006 if test -x $$i; then \
1007 echo $(INSTALL_SCRIPT) $$i $$b; \
1008 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
1009 else \
1010 echo $(INSTALL_DATA) $$i $$b; \
1011 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
1012 fi;; \
1013 esac; \
1014 done; \
1015 done
1016 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
1017 if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
1018 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
1019 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
1020 fi
1021 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1022 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
1023 -d $(LIBDEST) -f \
1024 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1025 $(DESTDIR)$(LIBDEST)
1026 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1027 $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
1028 -d $(LIBDEST) -f \
1029 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1030 $(DESTDIR)$(LIBDEST)
1031 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1032 $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
1033 -d $(LIBDEST)/site-packages -f \
1034 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1035 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1036 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
1037 -d $(LIBDEST)/site-packages -f \
1038 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1039 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1040 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
1041 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1042 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
1043
1044ifneq ($(filter os2emx os2knix,$(MACHDEP)),) # bird hack!
1045PATH_SEPARATOR = ;
1046else
1047PATH_SEPARATOR = :
1048endif
1049
1050# Create the PLATDIR source directory, if one wasn't distributed..
1051$(srcdir)/Lib/$(PLATDIR):
1052 mkdir $(srcdir)/Lib/$(PLATDIR)
1053 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
1054 export PATH; PATH="`pwd`$(PATH_SEPARATOR)$$PATH"; \
1055 export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \
1056 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
1057 export EXE; EXE="$(BUILDEXE)"; \
1058 if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
1059 export PYTHON_FOR_BUILD; \
1060 if [ "$(build)" = "$(host)" ]; then \
1061 PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
1062 else \
1063 PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
1064 fi; \
1065 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
1066
1067python-config: $(srcdir)/Misc/python-config.in
1068 # Substitution happens here, as the completely-expanded BINDIR
1069 # is not available in configure
1070 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1071
1072# Install the include files
1073INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1074inclinstall:
1075 @for i in $(INCLDIRSTOMAKE); \
1076 do \
1077 if test ! -d $(DESTDIR)$$i; then \
1078 echo "Creating directory $$i"; \
1079 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1080 else true; \
1081 fi; \
1082 done
1083 @for i in $(srcdir)/Include/*.h; \
1084 do \
1085 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1086 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1087 done
1088 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1089
1090# Install the library and miscellaneous stuff needed for extending/embedding
1091# This goes into $(exec_prefix)
1092LIBPL= $(LIBP)/config
1093
1094# pkgconfig directory
1095LIBPC= $(LIBDIR)/pkgconfig
1096
1097libainstall: all python-config
1098 @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
1099 do \
1100 if test ! -d $(DESTDIR)$$i; then \
1101 echo "Creating directory $$i"; \
1102 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1103 else true; \
1104 fi; \
1105 done
1106 @if test -d $(LIBRARY); then :; else \
1107 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1108 if test "$(SO)" = .dll; then \
1109 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
1110 else \
1111 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1112 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1113 fi; \
1114 else \
1115 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
1116 fi; \
1117 fi
1118 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1119 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
1120 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1121 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1122 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1123 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1124 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
1125 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
1126 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1127 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1128 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1129 rm python-config
1130 @if [ -s Modules/python.exp -a \
1131 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1132 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1133 $(INSTALL_DATA) Modules/python.exp \
1134 $(DESTDIR)$(LIBPL)/python.exp; \
1135 echo; echo "$(LIBPL)/python.exp"; \
1136 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
1137 $(DESTDIR)$(LIBPL)/makexp_aix; \
1138 echo "$(LIBPL)/makexp_aix"; \
1139 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
1140 $(DESTDIR)$(LIBPL)/ld_so_aix; \
1141 echo "$(LIBPL)/ld_so_aix"; \
1142 echo; echo "See Misc/AIX-NOTES for details."; \
1143 else true; \
1144 fi
1145 @case "$(MACHDEP)" in beos*) \
1146 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
1147 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
1148 echo; echo "$(LIBPL)/README"; \
1149 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
1150 echo "$(LIBPL)/ar_beos"; \
1151 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
1152 echo "$(LIBPL)/ld_so_beos"; \
1153 echo; echo "See Misc/BeOS-NOTES for details."; \
1154 ;; \
1155 esac
1156
1157# Install the dynamically loadable modules
1158# This goes into $(exec_prefix)
1159sharedinstall: sharedmods
1160 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
1161 --prefix=$(prefix) \
1162 --install-scripts=$(BINDIR) \
1163 --install-platlib=$(DESTSHARED) \
1164 --root=$(DESTDIR)/
1165 -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
1166
1167# Here are a couple of targets for MacOSX again, to install a full
1168# framework-based Python. frameworkinstall installs everything, the
1169# subtargets install specific parts. Much of the actual work is offloaded to
1170# the Makefile in Mac
1171#
1172#
1173# This target is here for backward compatiblity, previous versions of Python
1174# hadn't integrated framework installation in the normal install process.
1175frameworkinstall: install
1176
1177# On install, we re-make the framework
1178# structure in the install location, /Library/Frameworks/ or the argument to
1179# --enable-framework. If --enable-framework has been specified then we have
1180# automatically set prefix to the location deep down in the framework, so we
1181# only have to cater for the structural bits of the framework.
1182
1183frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1184
1185frameworkinstallstructure: $(LDLIBRARY)
1186 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1187 echo Not configured with --enable-framework; \
1188 exit 1; \
1189 else true; \
1190 fi
1191 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1192 if test ! -d $(DESTDIR)$$i; then \
1193 echo "Creating directory $(DESTDIR)$$i"; \
1194 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1195 else true; \
1196 fi; \
1197 done
1198 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1199 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1200 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1201 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1202 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1203 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1204 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1205
1206# This installs Mac/Lib into the framework
1207# Install a number of symlinks to keep software that expects a normal unix
1208# install (which includes python-config) happy.
1209frameworkinstallmaclib:
1210 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1211 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
1212 ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1213 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1214
1215# This installs the IDE, the Launcher and other apps into /Applications
1216frameworkinstallapps:
1217 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1218
1219# This install the unix python and pythonw tools in /usr/local/bin
1220frameworkinstallunixtools:
1221 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1222
1223frameworkaltinstallunixtools:
1224 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1225
1226# This installs the Demos and Tools into the applications directory.
1227# It is not part of a normal frameworkinstall
1228frameworkinstallextras:
1229 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1230
1231# This installs a few of the useful scripts in Tools/scripts
1232scriptsinstall:
1233 SRCDIR=$(srcdir) $(RUNSHARED) \
1234 $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
1235 --prefix=$(prefix) \
1236 --install-scripts=$(BINDIR) \
1237 --root=$(DESTDIR)/
1238
1239# Build the toplevel Makefile
1240Makefile.pre: Makefile.pre.in config.status
1241 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1242 $(MAKE) -f Makefile.pre Makefile
1243
1244# Run the configure script.
1245config.status: $(srcdir)/configure
1246 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1247
1248.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1249
1250# Some make's put the object file in the current directory
1251.c.o:
1252 $(CC) -c $(PY_CFLAGS) -o $@ $<
1253
1254# Run reindent on the library
1255reindent:
1256 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1257
1258# Rerun configure with the same options as it was run last time,
1259# provided the config.status script exists
1260recheck:
1261 $(SHELL) config.status --recheck
1262 $(SHELL) config.status
1263
1264# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
1265autoconf:
1266 (cd $(srcdir); autoconf)
1267 (cd $(srcdir); autoheader)
1268
1269# Create a tags file for vi
1270tags::
1271 cd $(srcdir); \
1272 ctags -w -t Include/*.h; \
1273 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1274 done; \
1275 sort -o tags tags
1276
1277# Create a tags file for GNU Emacs
1278TAGS::
1279 cd $(srcdir); \
1280 etags Include/*.h; \
1281 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1282
1283# Touch generated files
1284touch:
1285 touch Include/Python-ast.h Python/Python-ast.c
1286
1287# Sanitation targets -- clean leaves libraries, executables and tags
1288# files, which clobber removes as well
1289pycremoval:
1290 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1291
1292clean: pycremoval
1293 find . -name '*.[oa]' -exec rm -f {} ';'
1294 find . -name '*.s[ol]' -exec rm -f {} ';'
1295 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
1296 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1297 find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1298 -rm -f Lib/lib2to3/*Grammar*.pickle
1299
1300profile-removal:
1301 find . -name '*.gc??' -exec rm -f {} ';'
1302
1303clobber: clean profile-removal
1304 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1305 tags TAGS \
1306 config.cache config.log pyconfig.h Modules/config.c
1307 -rm -rf build platform
1308 -rm -rf $(PYTHONFRAMEWORKDIR)
1309
1310# Make things extra clean, before making a distribution:
1311# remove all generated files, even Makefile[.pre]
1312# Keep configure and Python-ast.[ch], it's possible they can't be generated
1313distclean: clobber
1314 for file in Lib/test/data/* ; do \
1315 if test "$$file" != "Lib/test/data/README"; then rm "$$file"; fi; \
1316 done
1317 -rm -f core Makefile Makefile.pre config.status \
1318 Modules/Setup Modules/Setup.local Modules/Setup.config \
1319 Modules/ld_so_aix Modules/python.exp Misc/python.pc
1320 -rm -f python*-gdb.py
1321 -rm -f pybuilddir.txt
1322 find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
1323 -o -name '[@,#]*' -o -name '*.old' \
1324 -o -name '*.orig' -o -name '*.rej' \
1325 -o -name '*.bak' ')' \
1326 -exec rm -f {} ';'
1327
1328# Check for smelly exported symbols (not starting with Py/_Py)
1329smelly: all
1330 nm -p $(LIBRARY) | \
1331 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1332
1333# Find files with funny names
1334funny:
1335 find $(SUBDIRS) $(SUBDIRSTOO) -type d \
1336 -o -name '*.[chs]' \
1337 -o -name '*.py' \
1338 -o -name '*.doc' \
1339 -o -name '*.sty' \
1340 -o -name '*.bib' \
1341 -o -name '*.dat' \
1342 -o -name '*.el' \
1343 -o -name '*.fd' \
1344 -o -name '*.in' \
1345 -o -name '*.tex' \
1346 -o -name '*,[vpt]' \
1347 -o -name 'Setup' \
1348 -o -name 'Setup.*' \
1349 -o -name README \
1350 -o -name Makefile \
1351 -o -name ChangeLog \
1352 -o -name Repository \
1353 -o -name Root \
1354 -o -name Entries \
1355 -o -name Tag \
1356 -o -name tags \
1357 -o -name TAGS \
1358 -o -name .cvsignore \
1359 -o -name MANIFEST \
1360 -o -print
1361
1362# Perform some verification checks on any modified files.
1363patchcheck:
1364 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1365
1366# Dependencies
1367
1368Python/thread.o: @THREADHEADERS@
1369
1370# Declare targets that aren't real files
1371.PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1372.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1373.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1374.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1375.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1376.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1377.PHONY: smelly funny patchcheck touch altmaninstall
1378.PHONY: gdbhooks
1379
1380# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
Note: See TracBrowser for help on using the repository browser.