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