source: python/vendor/Python-2.7.6/Makefile.pre.in@ 391

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

python: Update vendor to 2.7.6.

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