Merged revisions 81359-81361 via svnmerge from
[python/dscho.git] / Makefile.pre.in
blobc60d253f0676eaf970ad94d42c02c21aa9c96565
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 DESTSHARED=     $(BINLIBDEST)/lib-dynload
112 # Executable suffix (.exe on Windows and Mac OS X)
113 EXE=            @EXEEXT@
114 BUILDEXE=       @BUILDEXEEXT@
116 # Short name and location for Mac OS X Python framework
117 UNIVERSALSDK=@UNIVERSALSDK@
118 PYTHONFRAMEWORK=        @PYTHONFRAMEWORK@
119 PYTHONFRAMEWORKDIR=     @PYTHONFRAMEWORKDIR@
120 PYTHONFRAMEWORKPREFIX=  @PYTHONFRAMEWORKPREFIX@
121 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
122 # Deployment target selected during configure, to be checked
123 # by distutils. The export statement is needed to ensure that the
124 # deployment target is active during build.
125 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
126 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
128 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
129 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
131 # Environment to run shared python without installed libraries
132 RUNSHARED=       @RUNSHARED@
134 # Modes for directories, executables and data files created by the
135 # install process.  Default to user-only-writable for all file types.
136 DIRMODE=        755
137 EXEMODE=        755
138 FILEMODE=       644
140 # configure script arguments
141 CONFIG_ARGS=    @CONFIG_ARGS@
144 # Subdirectories with code
145 SRCDIRS=        @SRCDIRS@
147 # Other subdirectories
148 SUBDIRSTOO=     Include Lib Misc Demo
150 # Files and directories to be distributed
151 CONFIGFILES=    configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
152 DISTFILES=      README ChangeLog $(CONFIGFILES)
153 DISTDIRS=       $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
154 DIST=           $(DISTFILES) $(DISTDIRS)
157 LIBRARY=        @LIBRARY@
158 LDLIBRARY=      @LDLIBRARY@
159 BLDLIBRARY=     @BLDLIBRARY@
160 DLLLIBRARY=     @DLLLIBRARY@
161 LDLIBRARYDIR=   @LDLIBRARYDIR@
162 INSTSONAME=     @INSTSONAME@
165 LIBS=           @LIBS@
166 LIBM=           @LIBM@
167 LIBC=           @LIBC@
168 SYSLIBS=        $(LIBM) $(LIBC)
169 SHLIBS=         @SHLIBS@
171 THREADOBJ=      @THREADOBJ@
172 DLINCLDIR=      @DLINCLDIR@
173 DYNLOADFILE=    @DYNLOADFILE@
174 MACHDEP_OBJS=   @MACHDEP_OBJS@
175 LIBOBJDIR=      Python/
176 LIBOBJS=        @LIBOBJS@
178 PYTHON=         python$(EXE)
179 BUILDPYTHON=    python$(BUILDEXE)
181 # The task to run while instrument when building the profile-opt target
182 PROFILE_TASK=   $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
183 #PROFILE_TASK=  $(srcdir)/Lib/test/regrtest.py
185 # === Definitions added by makesetup ===
188 ##########################################################################
189 # Modules
190 MODULE_OBJS=    \
191                 Modules/config.o \
192                 Modules/getpath.o \
193                 Modules/main.o \
194                 Modules/gcmodule.o
196 # Used of signalmodule.o is not available
197 SIGNAL_OBJS=    @SIGNAL_OBJS@
199 IO_H=           Modules/_io/_iomodule.h
201 IO_OBJS=        \
202                 Modules/_io/_iomodule.o \
203                 Modules/_io/iobase.o \
204                 Modules/_io/fileio.o \
205                 Modules/_io/bufferedio.o \
206                 Modules/_io/textio.o \
207                 Modules/_io/bytesio.o \
208                 Modules/_io/stringio.o
210 ##########################################################################
211 # Grammar
212 GRAMMAR_H=      $(srcdir)/Include/graminit.h
213 GRAMMAR_C=      $(srcdir)/Python/graminit.c
214 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
217 ##########################################################################
218 # Parser
219 PGEN=           Parser/pgen$(EXE)
221 POBJS=          \
222                 Parser/acceler.o \
223                 Parser/grammar1.o \
224                 Parser/listnode.o \
225                 Parser/node.o \
226                 Parser/parser.o \
227                 Parser/parsetok.o \
228                 Parser/bitset.o \
229                 Parser/metagrammar.o \
230                 Parser/firstsets.o \
231                 Parser/grammar.o \
232                 Parser/pgen.o
234 PARSER_OBJS=    $(POBJS) Parser/myreadline.o Parser/tokenizer.o
236 PGOBJS=         \
237                 Objects/obmalloc.o \
238                 Python/mysnprintf.o \
239                 Parser/tokenizer_pgen.o \
240                 Parser/printgrammar.o \
241                 Parser/pgenmain.o
243 PARSER_HEADERS= \
244                 Parser/parser.h \
245                 Parser/tokenizer.h
247 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
249 ##########################################################################
250 # AST
251 AST_H_DIR=      $(srcdir)/Include
252 AST_H=          $(AST_H_DIR)/Python-ast.h
253 AST_C_DIR=      $(srcdir)/Python
254 AST_C=          $(AST_C_DIR)/Python-ast.c
255 AST_ASDL=       $(srcdir)/Parser/Python.asdl
257 ASDLGEN_FILES=  $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
258 # XXX Note that a build now requires Python exist before the build starts
259 ASDLGEN=        $(srcdir)/Parser/asdl_c.py
261 ##########################################################################
262 # Python
264 OPCODETARGETS_H= \
265                 $(srcdir)/Python/opcode_targets.h
267 OPCODETARGETGEN= \
268                 $(srcdir)/Python/makeopcodetargets.py
270 OPCODETARGETGEN_FILES= \
271                 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
273 PYTHON_OBJS=    \
274                 Python/_warnings.o \
275                 Python/Python-ast.o \
276                 Python/asdl.o \
277                 Python/ast.o \
278                 Python/bltinmodule.o \
279                 Python/ceval.o \
280                 Python/compile.o \
281                 Python/codecs.o \
282                 Python/errors.o \
283                 Python/frozen.o \
284                 Python/frozenmain.o \
285                 Python/future.o \
286                 Python/getargs.o \
287                 Python/getcompiler.o \
288                 Python/getcopyright.o \
289                 Python/getplatform.o \
290                 Python/getversion.o \
291                 Python/graminit.o \
292                 Python/import.o \
293                 Python/importdl.o \
294                 Python/marshal.o \
295                 Python/modsupport.o \
296                 Python/mystrtoul.o \
297                 Python/mysnprintf.o \
298                 Python/peephole.o \
299                 Python/pyarena.o \
300                 Python/pyctype.o \
301                 Python/pyfpe.o \
302                 Python/pymath.o \
303                 Python/pystate.o \
304                 Python/pythonrun.o \
305                 Python/structmember.o \
306                 Python/symtable.o \
307                 Python/sysmodule.o \
308                 Python/traceback.o \
309                 Python/getopt.o \
310                 Python/pystrcmp.o \
311                 Python/pystrtod.o \
312                 Python/dtoa.o \
313                 Python/formatter_unicode.o \
314                 Python/$(DYNLOADFILE) \
315                 $(LIBOBJS) \
316                 $(MACHDEP_OBJS) \
317                 $(THREADOBJ)
320 ##########################################################################
321 # Objects
322 OBJECT_OBJS=    \
323                 Objects/abstract.o \
324                 Objects/boolobject.o \
325                 Objects/bytes_methods.o \
326                 Objects/bytearrayobject.o \
327                 Objects/bytesobject.o \
328                 Objects/cellobject.o \
329                 Objects/classobject.o \
330                 Objects/cobject.o \
331                 Objects/codeobject.o \
332                 Objects/complexobject.o \
333                 Objects/descrobject.o \
334                 Objects/enumobject.o \
335                 Objects/exceptions.o \
336                 Objects/genobject.o \
337                 Objects/fileobject.o \
338                 Objects/floatobject.o \
339                 Objects/frameobject.o \
340                 Objects/funcobject.o \
341                 Objects/iterobject.o \
342                 Objects/listobject.o \
343                 Objects/longobject.o \
344                 Objects/dictobject.o \
345                 Objects/memoryobject.o \
346                 Objects/methodobject.o \
347                 Objects/moduleobject.o \
348                 Objects/object.o \
349                 Objects/obmalloc.o \
350                 Objects/capsule.o \
351                 Objects/rangeobject.o \
352                 Objects/setobject.o \
353                 Objects/sliceobject.o \
354                 Objects/structseq.o \
355                 Objects/tupleobject.o \
356                 Objects/typeobject.o \
357                 Objects/unicodeobject.o \
358                 Objects/unicodectype.o \
359                 Objects/weakrefobject.o
362 ##########################################################################
363 # objects that get linked into the Python library
364 LIBRARY_OBJS=   \
365                 Modules/getbuildinfo.o \
366                 $(PARSER_OBJS) \
367                 $(OBJECT_OBJS) \
368                 $(PYTHON_OBJS) \
369                 $(MODULE_OBJS) \
370                 $(SIGNAL_OBJS) \
371                 $(MODOBJS)
373 #########################################################################
374 # Rules
376 # Default target
377 all:            build_all
378 build_all:      $(BUILDPYTHON) oldsharedmods sharedmods
380 # Compile a binary with gcc profile guided optimization.
381 profile-opt:
382         @echo "Building with support for profile generation:"
383         $(MAKE) clean
384         $(MAKE) build_all_generate_profile
385         @echo "Running benchmark to generate profile data:"
386         $(MAKE) profile-removal
387         $(MAKE) run_profile_task
388         @echo "Rebuilding with profile guided optimizations:"
389         $(MAKE) clean
390         $(MAKE) build_all_use_profile
392 build_all_generate_profile:
393         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
395 run_profile_task:
396         ./$(BUILDPYTHON) $(PROFILE_TASK)
398 build_all_use_profile:
399         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
401 coverage:
402         @echo "Building with support for coverage checking:"
403         $(MAKE) clean
404         $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
407 # Build the interpreter
408 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
409                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
410                         Modules/python.o \
411                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
413 platform: $(BUILDPYTHON)
414         $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
417 # Build the shared modules
418 sharedmods: $(BUILDPYTHON)
419         @case $$MAKEFLAGS in \
420         *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
421         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
422         esac
424 # Build static library
425 # avoid long command lines, same as LIBRARY_OBJS
426 $(LIBRARY): $(LIBRARY_OBJS)
427         -rm -f $@
428         $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
429         $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
430         $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
431         $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
432         $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
433         $(AR) $(ARFLAGS) $@ $(MODOBJS)
434         $(RANLIB) $@
436 libpython$(VERSION).so: $(LIBRARY_OBJS)
437         if test $(INSTSONAME) != $(LDLIBRARY); then \
438                 $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
439                 $(LN) -f $(INSTSONAME) $@; \
440         else \
441                 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
442         fi
444 libpython$(VERSION).dylib: $(LIBRARY_OBJS)
445          $(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); \
446                  
448 libpython$(VERSION).sl: $(LIBRARY_OBJS)
449         $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
451 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
452 # minimal framework (not including the Lib directory and such) in the current
453 # directory.
454 RESSRCDIR=Mac/Resources/framework
455 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
456                 $(LIBRARY) \
457                 $(RESSRCDIR)/Info.plist
458         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
459         if test "${UNIVERSALSDK}"; then \
460                 $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
461                         -isysroot "${UNIVERSALSDK}" \
462                         -all_load $(LIBRARY) -Wl,-single_module \
463                         -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
464                         -compatibility_version $(VERSION) \
465                         -current_version $(VERSION) \
466                         -framework CoreFoundation $(LIBS); \
467         else \
468                 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
469                         @LIBTOOL_CRUFT@ -framework CoreFoundation $(LIBS);\
470         fi
471         $(INSTALL) -d -m $(DIRMODE)  \
472                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
473         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
474                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
475         $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
476         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
477         $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
478         $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
480 # This rule builds the Cygwin Python DLL and import library if configured
481 # for a shared core library; otherwise, this rule is a noop.
482 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
483         if test -n "$(DLLLIBRARY)"; then \
484                 $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
485                         $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
486         else true; \
487         fi
490 oldsharedmods: $(SHAREDMODS)
493 Makefile Modules/config.c: Makefile.pre \
494                                 $(srcdir)/Modules/config.c.in \
495                                 $(MAKESETUP) \
496                                 Modules/Setup.config \
497                                 Modules/Setup \
498                                 Modules/Setup.local
499         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
500                                 -s Modules \
501                                 Modules/Setup.config \
502                                 Modules/Setup.local \
503                                 Modules/Setup
504         @mv config.c Modules
505         @echo "The Makefile was updated, you may need to re-run make."
508 Modules/Setup: $(srcdir)/Modules/Setup.dist
509         @if test -f Modules/Setup; then \
510                 echo "-----------------------------------------------"; \
511                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
512                 echo "check to make sure you have all the updates you"; \
513                 echo "need in your Modules/Setup file."; \
514                 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
515                 echo "-----------------------------------------------"; \
516         fi
518 ############################################################################
519 # Special rules for object files
521 Modules/getbuildinfo.o: $(PARSER_OBJS) \
522                 $(OBJECT_OBJS) \
523                 $(PYTHON_OBJS) \
524                 $(MODULE_OBJS) \
525                 $(SIGNAL_OBJS) \
526                 $(MODOBJS) \
527                 $(srcdir)/Modules/getbuildinfo.c
528         $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
530 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
531         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
532                 -DPREFIX='"$(prefix)"' \
533                 -DEXEC_PREFIX='"$(exec_prefix)"' \
534                 -DVERSION='"$(VERSION)"' \
535                 -DVPATH='"$(VPATH)"' \
536                 -o $@ $(srcdir)/Modules/getpath.c
538 Modules/python.o: $(srcdir)/Modules/python.c
539         $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
541 $(IO_OBJS): $(IO_H)
543 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
544                 -@$(INSTALL) -d Include
545                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
547 $(PGEN):        $(PGENOBJS)
548                 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
550 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
551                                 $(srcdir)/Include/token.h \
552                                 $(srcdir)/Include/grammar.h
553 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
555 Parser/tokenizer_pgen.o:        $(srcdir)/Parser/tokenizer.c
557 Parser/pgenmain.o:      $(srcdir)/Include/parsetok.h
559 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
560         $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
562 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
563         $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
565 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
567 Python/getplatform.o: $(srcdir)/Python/getplatform.c
568                 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
570 Python/importdl.o: $(srcdir)/Python/importdl.c
571                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
573 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
574                                 $(srcdir)/Objects/unicodetype_db.h
576 BYTESTR_DEPS = \
577                 $(srcdir)/Include/bytes_methods.h \
578                 $(srcdir)/Objects/stringlib/count.h \
579                 $(srcdir)/Objects/stringlib/ctype.h \
580                 $(srcdir)/Objects/stringlib/eq.h \
581                 $(srcdir)/Objects/stringlib/fastsearch.h \
582                 $(srcdir)/Objects/stringlib/find.h \
583                 $(srcdir)/Objects/stringlib/partition.h \
584                 $(srcdir)/Objects/stringlib/stringdefs.h \
585                 $(srcdir)/Objects/stringlib/string_format.h \
586                 $(srcdir)/Objects/stringlib/transmogrify.h \
587                 $(srcdir)/Objects/stringlib/unicodedefs.h \
588                 $(srcdir)/Objects/stringlib/localeutil.h
590 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
592 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS) 
594 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
595                                 $(BYTESTR_DEPS)
597 $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
598         $(OPCODETARGETGEN) $(OPCODETARGETS_H)
600 Python/ceval.o: $(OPCODETARGETS_H)
602 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
603                                 $(BYTESTR_DEPS) \
604                                 $(srcdir)/Objects/stringlib/formatter.h
607 ############################################################################
608 # Header files
610 PYTHON_HEADERS= \
611                 Include/Python-ast.h \
612                 Include/Python.h \
613                 Include/abstract.h \
614                 Include/asdl.h \
615                 Include/ast.h \
616                 Include/bltinmodule.h \
617                 Include/bitset.h \
618                 Include/boolobject.h \
619                 Include/bytes_methods.h \
620                 Include/bytearrayobject.h \
621                 Include/bytesobject.h \
622                 Include/cellobject.h \
623                 Include/ceval.h \
624                 Include/classobject.h \
625                 Include/cobject.h \
626                 Include/code.h \
627                 Include/codecs.h \
628                 Include/compile.h \
629                 Include/complexobject.h \
630                 Include/descrobject.h \
631                 Include/dictobject.h \
632                 Include/dtoa.h \
633                 Include/enumobject.h \
634                 Include/errcode.h \
635                 Include/eval.h \
636                 Include/fileobject.h \
637                 Include/floatobject.h \
638                 Include/frameobject.h \
639                 Include/funcobject.h \
640                 Include/genobject.h \
641                 Include/import.h \
642                 Include/intrcheck.h \
643                 Include/iterobject.h \
644                 Include/listobject.h \
645                 Include/longintrepr.h \
646                 Include/longobject.h \
647                 Include/marshal.h \
648                 Include/memoryobject.h \
649                 Include/metagrammar.h \
650                 Include/methodobject.h \
651                 Include/modsupport.h \
652                 Include/moduleobject.h \
653                 Include/node.h \
654                 Include/object.h \
655                 Include/objimpl.h \
656                 Include/opcode.h \
657                 Include/osdefs.h \
658                 Include/parsetok.h \
659                 Include/patchlevel.h \
660                 Include/pgen.h \
661                 Include/pgenheaders.h \
662                 Include/pyarena.h \
663                 Include/pycapsule.h \
664                 Include/pyctype.h \
665                 Include/pydebug.h \
666                 Include/pyerrors.h \
667                 Include/pyfpe.h \
668                 Include/pymath.h \
669                 Include/pygetopt.h \
670                 Include/pymem.h \
671                 Include/pyport.h \
672                 Include/pystate.h \
673                 Include/pystrcmp.h \
674                 Include/pystrtod.h \
675                 Include/pythonrun.h \
676                 Include/pythread.h \
677                 Include/rangeobject.h \
678                 Include/setobject.h \
679                 Include/sliceobject.h \
680                 Include/structmember.h \
681                 Include/structseq.h \
682                 Include/symtable.h \
683                 Include/sysmodule.h \
684                 Include/traceback.h \
685                 Include/tupleobject.h \
686                 Include/ucnhash.h \
687                 Include/unicodeobject.h \
688                 Include/warnings.h \
689                 Include/weakrefobject.h \
690                 pyconfig.h \
691                 $(PARSER_HEADERS)
693 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
696 ######################################################################
698 # Test the interpreter (twice, once without .pyc files, once with)
699 # In the past, we've had problems where bugs in the marshalling or
700 # elsewhere caused bytecode read from .pyc files to behave differently
701 # than bytecode generated directly from a .py source file.  Sometimes
702 # the bytecode read from a .pyc file had the bug, somtimes the directly
703 # generated bytecode.  This is sometimes a very shy bug needing a lot of
704 # sample data.
706 TESTOPTS=       -l $(EXTRATESTOPTS)
707 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
708 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -bb
709 test:           all platform
710                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
711                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
712                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
714 testall:        all platform
715                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
716                 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
717                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
718                 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
719                 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
721 #  Run the unitests for both architectures in a Universal build on OSX
722 #  Must be run on an Intel box.
723 testuniversal:  all platform
724                 if [ `arch` != 'i386' ];then \
725                         echo "This can only be used on OSX/i386" ;\
726                         exit 1 ;\
727                 fi
728                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
729                 -$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
730                 $(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
731                 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) -uall $(TESTOPTS)
734 # Like testall, but with a single pass only
735 # run an optional script to include some information about the build environment
736 buildbottest:   all platform
737                 -@if which pybuildbot.identify >/dev/null 2>&1; then \
738                         pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
739                 fi
740                 $(TESTPYTHON) $(TESTPROG) -uall -rw $(TESTOPTS)
742 QUICKTESTOPTS=  $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
743                 test_multibytecodec test_urllib2_localnet test_itertools \
744                 test_multiprocessing test_mailbox test_socket test_poll \
745                 test_select test_zipfile
746 quicktest:      all platform
747                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
748                 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
749                 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
751 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
752                 test_longexp
753 memtest:        all platform
754                 -rm -f $(srcdir)/Lib/test/*.py[co]
755                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
756                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
758 install: altinstall bininstall
760 altinstall:     @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
761                 sharedinstall oldsharedinstall maninstall @FRAMEWORKALTINSTALLLAST@
763 # Install shared libraries enabled by Setup
764 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
766 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
767                 @for i in X $(SHAREDMODS); do \
768                   if test $$i != X; then \
769                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
770                     $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
771                   fi; \
772                 done
774 $(DESTSHARED):
775                 @for i in $(DESTDIRS); \
776                 do \
777                         if test ! -d $(DESTDIR)$$i; then \
778                                 echo "Creating directory $$i"; \
779                                 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
780                         else    true; \
781                         fi; \
782                 done
784 # Install the interpreter with $(VERSION) affixed
785 # This goes into $(exec_prefix)
786 altbininstall: $(BUILDPYTHON)
787         @for i in $(BINDIR) $(LIBDIR); \
788         do \
789                 if test ! -d $(DESTDIR)$$i; then \
790                         echo "Creating directory $$i"; \
791                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
792                 else    true; \
793                 fi; \
794         done
795         $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
796         if test -f $(LDLIBRARY); then \
797                 if test -n "$(DLLLIBRARY)" ; then \
798                         $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
799                 else \
800                         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
801                         if test $(LDLIBRARY) != $(INSTSONAME); then \
802                                 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
803                         fi \
804                 fi; \
805         else    true; \
806         fi
808 bininstall: altbininstall
809         -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \
810         then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \
811         else true; \
812         fi
813         (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE))
814         -rm -f $(DESTDIR)$(BINDIR)/python3-config
815         (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
816         -rm -f $(DESTDIR)$(LIBPC)/python3.pc
817         (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
819 # Install the manual page
820 maninstall:
821         @for i in $(MANDIR) $(MANDIR)/man1; \
822         do \
823                 if test ! -d $(DESTDIR)$$i; then \
824                         echo "Creating directory $$i"; \
825                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
826                 else    true; \
827                 fi; \
828         done
829         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
830                 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
832 # Install the library
833 PLATDIR=        plat-$(MACHDEP)
834 EXTRAPLATDIR= @EXTRAPLATDIR@
835 MACHDEPS=       $(PLATDIR) $(EXTRAPLATDIR)
836 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
837 LIBSUBDIRS=     tkinter tkinter/test tkinter/test/test_tkinter \
838                 tkinter/test/test_ttk site-packages test test/data \
839                 test/decimaltestdata \
840                 encodings \
841                 email email/mime email/test email/test/data \
842                 html json json/tests http dbm xmlrpc \
843                 sqlite3 sqlite3/test \
844                 logging csv wsgiref urllib \
845                 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
846                 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
847                 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
848                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
849                 importlib importlib/test importlib/test/builtin \
850                 importlib/test/extension importlib/test/frozen \
851                 importlib/test/import_ importlib/test/source \
852                 setuptools setuptools/command setuptools/tests setuptools.egg-info \
853                 multiprocessing multiprocessing/dummy \
854                 curses pydoc_data $(MACHDEPS)
855 libinstall:     build_all $(srcdir)/Lib/$(PLATDIR)
856         @for i in $(SCRIPTDIR) $(LIBDEST); \
857         do \
858                 if test ! -d $(DESTDIR)$$i; then \
859                         echo "Creating directory $$i"; \
860                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
861                 else    true; \
862                 fi; \
863         done
864         @for d in $(LIBSUBDIRS); \
865         do \
866                 a=$(srcdir)/Lib/$$d; \
867                 if test ! -d $$a; then continue; else true; fi; \
868                 b=$(LIBDEST)/$$d; \
869                 if test ! -d $(DESTDIR)$$b; then \
870                         echo "Creating directory $$b"; \
871                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
872                 else    true; \
873                 fi; \
874         done
875         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
876         do \
877                 if test -x $$i; then \
878                         $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
879                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
880                 else \
881                         $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
882                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
883                 fi; \
884         done
885         @for d in $(LIBSUBDIRS); \
886         do \
887                 a=$(srcdir)/Lib/$$d; \
888                 if test ! -d $$a; then continue; else true; fi; \
889                 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
890                 b=$(LIBDEST)/$$d; \
891                 for i in $$a/*; \
892                 do \
893                         case $$i in \
894                         *CVS) ;; \
895                         *.py[co]) ;; \
896                         *.orig) ;; \
897                         *~) ;; \
898                         *) \
899                                 if test -d $$i; then continue; fi; \
900                                 if test -x $$i; then \
901                                     echo $(INSTALL_SCRIPT) $$i $$b; \
902                                     $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
903                                 else \
904                                     echo $(INSTALL_DATA) $$i $$b; \
905                                     $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
906                                 fi;; \
907                         esac; \
908                 done; \
909         done
910         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
911         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
912                 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
913                 -d $(LIBDEST) -f \
914                 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
915                 $(DESTDIR)$(LIBDEST)
916         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
917                 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
918                 -d $(LIBDEST) -f \
919                 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
920                 $(DESTDIR)$(LIBDEST)
921         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
922                 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
923                 -d $(LIBDEST)/site-packages -f \
924                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
925         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
926                 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
927                 -d $(LIBDEST)/site-packages -f \
928                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
929         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
930                 ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
932 # Create the PLATDIR source directory, if one wasn't distributed..
933 $(srcdir)/Lib/$(PLATDIR):
934         mkdir $(srcdir)/Lib/$(PLATDIR)
935         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
936         export PATH; PATH="`pwd`:$$PATH"; \
937         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
938         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
939         export EXE; EXE="$(BUILDEXE)"; \
940         cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
942 # Install the include files
943 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
944 inclinstall:
945         @for i in $(INCLDIRSTOMAKE); \
946         do \
947                 if test ! -d $(DESTDIR)$$i; then \
948                         echo "Creating directory $$i"; \
949                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
950                 else    true; \
951                 fi; \
952         done
953         @for i in $(srcdir)/Include/*.h; \
954         do \
955                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
956                 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
957         done
958         $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
960 # Install the library and miscellaneous stuff needed for extending/embedding
961 # This goes into $(exec_prefix)
962 LIBPL=          $(LIBP)/config
964 # pkgconfig directory
965 LIBPC=          $(LIBDIR)/pkgconfig
967 libainstall:    all
968         @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
969         do \
970                 if test ! -d $(DESTDIR)$$i; then \
971                         echo "Creating directory $$i"; \
972                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
973                 else    true; \
974                 fi; \
975         done
976         @if test -d $(LIBRARY); then :; else \
977                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
978                         if test "$(SO)" = .dll; then \
979                                 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
980                         else \
981                                 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
982                                 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
983                         fi; \
984                 else \
985                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
986                 fi; \
987         fi
988         $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
989         $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
990         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
991         $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
992         $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
993         $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
994         $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
995         $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
996         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
997         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
998         # Substitution happens here, as the completely-expanded BINDIR
999         # is not available in configure
1000         sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1001         $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1002         rm python-config
1003         @if [ -s Modules/python.exp -a \
1004                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1005                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1006                 $(INSTALL_DATA) Modules/python.exp              \
1007                                 $(DESTDIR)$(LIBPL)/python.exp;          \
1008                 echo; echo "$(LIBPL)/python.exp";               \
1009                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
1010                                 $(DESTDIR)$(LIBPL)/makexp_aix;          \
1011                 echo "$(LIBPL)/makexp_aix";                     \
1012                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
1013                                 $(DESTDIR)$(LIBPL)/ld_so_aix;           \
1014                 echo "$(LIBPL)/ld_so_aix";                      \
1015                 echo; echo "See Misc/AIX-NOTES for details.";   \
1016         else true; \
1017         fi
1019 # Install the dynamically loadable modules
1020 # This goes into $(exec_prefix)
1021 sharedinstall:
1022         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1023                 --prefix=$(prefix) \
1024                 --install-scripts=$(BINDIR) \
1025                 --install-platlib=$(DESTSHARED) \
1026                 --root=/$(DESTDIR)
1028 # Here are a couple of targets for MacOSX again, to install a full
1029 # framework-based Python. frameworkinstall installs everything, the
1030 # subtargets install specific parts. Much of the actual work is offloaded to
1031 # the Makefile in Mac
1034 # This target is here for backward compatiblity, previous versions of Python
1035 # hadn't integrated framework installation in the normal install process.
1036 frameworkinstall: install
1038 # On install, we re-make the framework
1039 # structure in the install location, /Library/Frameworks/ or the argument to
1040 # --enable-framework. If --enable-framework has been specified then we have
1041 # automatically set prefix to the location deep down in the framework, so we
1042 # only have to cater for the structural bits of the framework.
1044 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1046 frameworkinstallstructure:      $(LDLIBRARY)
1047         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1048                 echo Not configured with --enable-framework; \
1049                 exit 1; \
1050         else true; \
1051         fi
1052         @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1053                 if test ! -d $(DESTDIR)$$i; then \
1054                         echo "Creating directory $(DESTDIR)$$i"; \
1055                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1056                 else    true; \
1057                 fi; \
1058         done
1059         $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1060         sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1061         $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1062         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1063         $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1064         $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1065         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1067 # This installs Mac/Lib into the framework
1068 # Install a number of symlinks to keep software that expects a normal unix
1069 # install (which includes python-config) happy.
1070 frameworkinstallmaclib:
1071         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1072         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
1073         ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1075 # This installs the IDE, the Launcher and other apps into /Applications
1076 frameworkinstallapps:
1077         cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1079 frameworkinstallapps4way:
1080         cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
1082 # This install the unix python and pythonw tools in /usr/local/bin
1083 frameworkinstallunixtools:
1084         cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1086 frameworkinstallunixtools4way:
1087         cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
1089 frameworkaltinstallunixtools:
1090         cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1092 frameworkaltinstallunixtools4way:
1093         cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
1095 # This installs the Demos and Tools into the applications directory.
1096 # It is not part of a normal frameworkinstall
1097 frameworkinstallextras:
1098         cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1100 # This installs a few of the useful scripts in Tools/scripts
1101 scriptsinstall:
1102         SRCDIR=$(srcdir) $(RUNSHARED) \
1103         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1104         --prefix=$(prefix) \
1105         --install-scripts=$(BINDIR) \
1106         --root=/$(DESTDIR)
1108 # Build the toplevel Makefile
1109 Makefile.pre: Makefile.pre.in config.status
1110         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1111         $(MAKE) -f Makefile.pre Makefile
1113 # Run the configure script.
1114 config.status:  $(srcdir)/configure
1115         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1117 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1119 # Some make's put the object file in the current directory
1120 .c.o:
1121         $(CC) -c $(PY_CFLAGS) -o $@ $<
1123 # Run reindent on the library
1124 reindent:
1125         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1127 # Rerun configure with the same options as it was run last time,
1128 # provided the config.status script exists
1129 recheck:
1130         $(SHELL) config.status --recheck
1131         $(SHELL) config.status
1133 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1134 autoconf:
1135         (cd $(srcdir); autoconf)
1136         (cd $(srcdir); autoheader)
1138 # Create a tags file for vi
1139 tags::
1140         cd $(srcdir); \
1141         ctags -w -t Include/*.h; \
1142         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1143         done; \
1144         sort -o tags tags
1146 # Create a tags file for GNU Emacs
1147 TAGS::
1148         cd $(srcdir); \
1149         etags Include/*.h; \
1150         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1152 # Sanitation targets -- clean leaves libraries, executables and tags
1153 # files, which clobber removes as well
1154 pycremoval:
1155         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1157 rmtestturds:
1158         -rm -f *BAD *GOOD *SKIPPED
1159         -rm -rf OUT
1160         -rm -f *.TXT
1161         -rm -f *.txt
1162         -rm -f gb-18030-2000.xml
1164 docclean:
1165         -rm -rf Doc/build
1166         -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1168 clean: pycremoval
1169         find . -name '*.o' -exec rm -f {} ';'
1170         find . -name '*.s[ol]' -exec rm -f {} ';'
1171         find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1172         find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1173         -rm -f Lib/lib2to3/*Grammar*.pickle
1175 profile-removal:
1176         find . -name '*.gc??' -exec rm -f {} ';'
1178 clobber: clean profile-removal
1179         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1180                 tags TAGS \
1181                 config.cache config.log pyconfig.h Modules/config.c
1182         -rm -rf build platform
1183         -rm -rf $(PYTHONFRAMEWORKDIR)
1185 # Make things extra clean, before making a distribution:
1186 # remove all generated files, even Makefile[.pre]
1187 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1188 distclean: clobber
1189         -rm -f core Makefile Makefile.pre config.status \
1190                 Modules/Setup Modules/Setup.local Modules/Setup.config \
1191                 Misc/python.pc
1192         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1193                            -o -name '[@,#]*' -o -name '*.old' \
1194                            -o -name '*.orig' -o -name '*.rej' \
1195                            -o -name '*.bak' ')' \
1196                            -exec rm -f {} ';'
1198 # Check for smelly exported symbols (not starting with Py/_Py)
1199 smelly: all
1200         nm -p $(LIBRARY) | \
1201                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1203 # Find files with funny names
1204 funny:
1205         find $(DISTDIRS) \
1206                 -name .svn -prune \
1207                 -o -type d \
1208                 -o -name '*.[chs]' \
1209                 -o -name '*.py' \
1210                 -o -name '*.doc' \
1211                 -o -name '*.dat' \
1212                 -o -name '*.el' \
1213                 -o -name '*.fd' \
1214                 -o -name '*.in' \
1215                 -o -name '*.gif' \
1216                 -o -name '*.txt' \
1217                 -o -name '*.xml' \
1218                 -o -name '*.xbm' \
1219                 -o -name '*.xpm' \
1220                 -o -name '*.uue' \
1221                 -o -name '*.decTest' \
1222                 -o -name '*,[vpt]' \
1223                 -o -name 'Setup' \
1224                 -o -name 'Setup.*' \
1225                 -o -name regen \
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
1256 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY