Merged revisions 74356-74357 via svnmerge from
[python/dscho.git] / Makefile.pre.in
blob41fc51eddc62eb6cb1b3a02205a8807f8d55502f
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) $(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=         $(exec_prefix)/bin
93 LIBDIR=         $(exec_prefix)/lib
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)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
421         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' 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) $(TESTOPTS) -uall
719                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
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) $(TESTOPTS) -uall
730                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
731                 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
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) $(TESTOPTS) -uall -rw
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 site-packages test test/output test/data \
838                 test/decimaltestdata \
839                 encodings \
840                 email email/mime email/test email/test/data \
841                 html json json/tests http dbm xmlrpc \
842                 sqlite3 sqlite3/test \
843                 logging csv wsgiref urllib \
844                 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
845                 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
846                 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
847                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
848                 importlib importlib/test importlib/test/builtin \
849                 importlib/test/extension importlib/test/frozen \
850                 importlib/test/import_ importlib/test/source \
851                 setuptools setuptools/command setuptools/tests setuptools.egg-info \
852                 multiprocessing multiprocessing/dummy \
853                 curses pydoc_data $(MACHDEPS)
854 libinstall:     build_all $(srcdir)/Lib/$(PLATDIR)
855         @for i in $(SCRIPTDIR) $(LIBDEST); \
856         do \
857                 if test ! -d $(DESTDIR)$$i; then \
858                         echo "Creating directory $$i"; \
859                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
860                 else    true; \
861                 fi; \
862         done
863         @for d in $(LIBSUBDIRS); \
864         do \
865                 a=$(srcdir)/Lib/$$d; \
866                 if test ! -d $$a; then continue; else true; fi; \
867                 b=$(LIBDEST)/$$d; \
868                 if test ! -d $(DESTDIR)$$b; then \
869                         echo "Creating directory $$b"; \
870                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
871                 else    true; \
872                 fi; \
873         done
874         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
875         do \
876                 if test -x $$i; then \
877                         $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
878                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
879                 else \
880                         $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
881                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
882                 fi; \
883         done
884         @for d in $(LIBSUBDIRS); \
885         do \
886                 a=$(srcdir)/Lib/$$d; \
887                 if test ! -d $$a; then continue; else true; fi; \
888                 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
889                 b=$(LIBDEST)/$$d; \
890                 for i in $$a/*; \
891                 do \
892                         case $$i in \
893                         *CVS) ;; \
894                         *.py[co]) ;; \
895                         *.orig) ;; \
896                         *~) ;; \
897                         *) \
898                                 if test -d $$i; then continue; fi; \
899                                 if test -x $$i; then \
900                                     echo $(INSTALL_SCRIPT) $$i $$b; \
901                                     $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
902                                 else \
903                                     echo $(INSTALL_DATA) $$i $$b; \
904                                     $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
905                                 fi;; \
906                         esac; \
907                 done; \
908         done
909         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
910         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
911                 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
912                 -d $(LIBDEST) -f \
913                 -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding' \
914                 $(DESTDIR)$(LIBDEST)
915         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
916                 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
917                 -d $(LIBDEST) -f \
918                 -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding' \
919                 $(DESTDIR)$(LIBDEST)
920         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
921                 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
922                 -d $(LIBDEST)/site-packages -f \
923                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
924         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
925                 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
926                 -d $(LIBDEST)/site-packages -f \
927                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
928         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
929                 ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
931 # Create the PLATDIR source directory, if one wasn't distributed..
932 $(srcdir)/Lib/$(PLATDIR):
933         mkdir $(srcdir)/Lib/$(PLATDIR)
934         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
935         export PATH; PATH="`pwd`:$$PATH"; \
936         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
937         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
938         export EXE; EXE="$(BUILDEXE)"; \
939         cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
941 # Install the include files
942 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
943 inclinstall:
944         @for i in $(INCLDIRSTOMAKE); \
945         do \
946                 if test ! -d $(DESTDIR)$$i; then \
947                         echo "Creating directory $$i"; \
948                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
949                 else    true; \
950                 fi; \
951         done
952         @for i in $(srcdir)/Include/*.h; \
953         do \
954                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
955                 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
956         done
957         $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
959 # Install the library and miscellaneous stuff needed for extending/embedding
960 # This goes into $(exec_prefix)
961 LIBPL=          $(LIBP)/config
963 # pkgconfig directory
964 LIBPC=          $(LIBDIR)/pkgconfig
966 libainstall:    all
967         @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
968         do \
969                 if test ! -d $(DESTDIR)$$i; then \
970                         echo "Creating directory $$i"; \
971                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
972                 else    true; \
973                 fi; \
974         done
975         @if test -d $(LIBRARY); then :; else \
976                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
977                         if test "$(SO)" = .dll; then \
978                                 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
979                         else \
980                                 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
981                                 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
982                         fi; \
983                 else \
984                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
985                 fi; \
986         fi
987         $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
988         $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
989         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
990         $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
991         $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
992         $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
993         $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
994         $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
995         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
996         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
997         # Substitution happens here, as the completely-expanded BINDIR
998         # is not available in configure
999         sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1000         $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1001         rm python-config
1002         @if [ -s Modules/python.exp -a \
1003                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1004                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1005                 $(INSTALL_DATA) Modules/python.exp              \
1006                                 $(DESTDIR)$(LIBPL)/python.exp;          \
1007                 echo; echo "$(LIBPL)/python.exp";               \
1008                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
1009                                 $(DESTDIR)$(LIBPL)/makexp_aix;          \
1010                 echo "$(LIBPL)/makexp_aix";                     \
1011                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
1012                                 $(DESTDIR)$(LIBPL)/ld_so_aix;           \
1013                 echo "$(LIBPL)/ld_so_aix";                      \
1014                 echo; echo "See Misc/AIX-NOTES for details.";   \
1015         else true; \
1016         fi
1018 # Install the dynamically loadable modules
1019 # This goes into $(exec_prefix)
1020 sharedinstall:
1021         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1022                 --prefix=$(prefix) \
1023                 --install-scripts=$(BINDIR) \
1024                 --install-platlib=$(DESTSHARED) \
1025                 --root=/$(DESTDIR)
1027 # Here are a couple of targets for MacOSX again, to install a full
1028 # framework-based Python. frameworkinstall installs everything, the
1029 # subtargets install specific parts. Much of the actual work is offloaded to
1030 # the Makefile in Mac
1033 # This target is here for backward compatiblity, previous versions of Python
1034 # hadn't integrated framework installation in the normal install process.
1035 frameworkinstall: install
1037 # On install, we re-make the framework
1038 # structure in the install location, /Library/Frameworks/ or the argument to
1039 # --enable-framework. If --enable-framework has been specified then we have
1040 # automatically set prefix to the location deep down in the framework, so we
1041 # only have to cater for the structural bits of the framework.
1043 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1045 frameworkinstallstructure:      $(LDLIBRARY)
1046         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1047                 echo Not configured with --enable-framework; \
1048                 exit 1; \
1049         else true; \
1050         fi
1051         @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1052                 if test ! -d $(DESTDIR)$$i; then \
1053                         echo "Creating directory $(DESTDIR)$$i"; \
1054                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1055                 else    true; \
1056                 fi; \
1057         done
1058         $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1059         sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1060         $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1061         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1062         $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1063         $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1064         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1066 # This installs Mac/Lib into the framework
1067 # Install a number of symlinks to keep software that expects a normal unix
1068 # install (which includes python-config) happy.
1069 frameworkinstallmaclib:
1070         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1071         ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1073 # This installs the IDE, the Launcher and other apps into /Applications
1074 frameworkinstallapps:
1075         cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1077 frameworkinstallapps4way:
1078         cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
1080 # This install the unix python and pythonw tools in /usr/local/bin
1081 frameworkinstallunixtools:
1082         cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1084 frameworkinstallunixtools4way:
1085         cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
1087 frameworkaltinstallunixtools:
1088         cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1090 frameworkaltinstallunixtools4way:
1091         cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
1093 # This installs the Demos and Tools into the applications directory.
1094 # It is not part of a normal frameworkinstall
1095 frameworkinstallextras:
1096         cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1098 # This installs a few of the useful scripts in Tools/scripts
1099 scriptsinstall:
1100         SRCDIR=$(srcdir) $(RUNSHARED) \
1101         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1102         --prefix=$(prefix) \
1103         --install-scripts=$(BINDIR) \
1104         --root=/$(DESTDIR)
1106 # Build the toplevel Makefile
1107 Makefile.pre: Makefile.pre.in config.status
1108         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1109         $(MAKE) -f Makefile.pre Makefile
1111 # Run the configure script.
1112 config.status:  $(srcdir)/configure
1113         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1115 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1117 # Some make's put the object file in the current directory
1118 .c.o:
1119         $(CC) -c $(PY_CFLAGS) -o $@ $<
1121 # Run reindent on the library
1122 reindent:
1123         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1125 # Rerun configure with the same options as it was run last time,
1126 # provided the config.status script exists
1127 recheck:
1128         $(SHELL) config.status --recheck
1129         $(SHELL) config.status
1131 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1132 autoconf:
1133         (cd $(srcdir); autoconf)
1134         (cd $(srcdir); autoheader)
1136 # Create a tags file for vi
1137 tags::
1138         cd $(srcdir); \
1139         ctags -w -t Include/*.h; \
1140         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1141         done; \
1142         sort -o tags tags
1144 # Create a tags file for GNU Emacs
1145 TAGS::
1146         cd $(srcdir); \
1147         etags Include/*.h; \
1148         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1150 # Sanitation targets -- clean leaves libraries, executables and tags
1151 # files, which clobber removes those as well
1152 pycremoval:
1153         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1155 rmtestturds:
1156         -rm -f *BAD *GOOD *SKIPPED
1157         -rm -rf OUT
1158         -rm -f *.TXT
1159         -rm -f *.txt
1160         -rm -f gb-18030-2000.xml
1162 docclean:
1163         -rm -rf Doc/build
1164         -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1166 clean: pycremoval
1167         find . -name '*.o' -exec rm -f {} ';'
1168         find . -name '*.s[ol]' -exec rm -f {} ';'
1169         find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1170         find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1172 profile-removal:
1173         find . -name '*.gc??' -exec rm -f {} ';'
1175 clobber: clean profile-removal
1176         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1177                 tags TAGS \
1178                 config.cache config.log pyconfig.h Modules/config.c
1179         -rm -rf build platform
1180         -rm -rf $(PYTHONFRAMEWORKDIR)
1182 # Make things extra clean, before making a distribution:
1183 # remove all generated files, even Makefile[.pre]
1184 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1185 distclean: clobber
1186         -rm -f core Makefile Makefile.pre config.status \
1187                 Modules/Setup Modules/Setup.local Modules/Setup.config
1188         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1189                            -o -name '[@,#]*' -o -name '*.old' \
1190                            -o -name '*.orig' -o -name '*.rej' \
1191                            -o -name '*.bak' ')' \
1192                            -exec rm -f {} ';'
1194 # Check for smelly exported symbols (not starting with Py/_Py)
1195 smelly: all
1196         nm -p $(LIBRARY) | \
1197                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1199 # Find files with funny names
1200 funny:
1201         find $(DISTDIRS) \
1202                 -name .svn -prune \
1203                 -o -type d \
1204                 -o -name '*.[chs]' \
1205                 -o -name '*.py' \
1206                 -o -name '*.doc' \
1207                 -o -name '*.dat' \
1208                 -o -name '*.el' \
1209                 -o -name '*.fd' \
1210                 -o -name '*.in' \
1211                 -o -name '*.gif' \
1212                 -o -name '*.txt' \
1213                 -o -name '*.xml' \
1214                 -o -name '*.xbm' \
1215                 -o -name '*.xpm' \
1216                 -o -name '*.uue' \
1217                 -o -name '*.decTest' \
1218                 -o -name '*,[vpt]' \
1219                 -o -name 'Setup' \
1220                 -o -name 'Setup.*' \
1221                 -o -name regen \
1222                 -o -name README \
1223                 -o -name Makefile \
1224                 -o -name ChangeLog \
1225                 -o -name Repository \
1226                 -o -name Root \
1227                 -o -name Entries \
1228                 -o -name Tag \
1229                 -o -name tags \
1230                 -o -name TAGS \
1231                 -o -name .cvsignore \
1232                 -o -name MANIFEST \
1233                 -o -print
1235 # Perform some verification checks on any modified files.
1236 patchcheck:
1237         $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1239 # Dependencies
1241 Python/thread.o: @THREADHEADERS@
1243 # Declare targets that aren't real files
1244 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1245 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1246 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1247 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1248 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1249 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
1250 .PHONY: smelly funny patchcheck
1252 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY