Home | History | Annotate | Download | only in cpython2
      1 # Top-level Makefile for Python
      2 #
      3 # As distributed, this file is called Makefile.pre.in; it is processed
      4 # into the real Makefile by running the script ./configure, which
      5 # replaces things like @spam@ with values appropriate for your system.
      6 # This means that if you edit Makefile, your changes get lost the next
      7 # time you run the configure script.  Ideally, you can do:
      8 #
      9 #	./configure
     10 #	make
     11 #	make test
     12 #	make install
     13 #
     14 # If you have a previous version of Python installed that you don't
     15 # want to overwrite, you can use "make altinstall" instead of "make
     16 # install".  Refer to the "Installing" section in the README file for
     17 # additional details.
     18 #
     19 # See also the section "Build instructions" in the README file.
     20 
     21 # === Variables set by makesetup ===
     22 
     23 MODOBJS=        _MODOBJS_
     24 MODLIBS=        _MODLIBS_
     25 
     26 # === Variables set by configure
     27 VERSION=	@VERSION@
     28 srcdir=		@srcdir@
     29 VPATH=		@srcdir@
     30 abs_srcdir=	@abs_srcdir@
     31 abs_builddir=	@abs_builddir@
     32 build=		@build@
     33 host=		@host@
     34 
     35 CC=		@CC@
     36 CXX=		@CXX@
     37 MAINCC=		@MAINCC@
     38 LINKCC=		@LINKCC@
     39 AR=		@AR@
     40 RANLIB=		@RANLIB@
     41 SVNVERSION=	@SVNVERSION@
     42 HGVERSION=	@HGVERSION@
     43 HGTAG=		@HGTAG@
     44 HGBRANCH=	@HGBRANCH@
     45 PGO_PROF_GEN_FLAG=@PGO_PROF_GEN_FLAG@
     46 PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@
     47 LLVM_PROF_MERGER=@LLVM_PROF_MERGER@
     48 LLVM_PROF_FILE=@LLVM_PROF_FILE@
     49 LLVM_PROF_ERR=@LLVM_PROF_ERR@
     50 
     51 GNULD=          @GNULD@
     52 
     53 # Shell used by make (some versions default to the login shell, which is bad)
     54 SHELL=		/bin/sh
     55 
     56 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
     57 LN=		@LN@
     58 
     59 # Portable install script (configure doesn't always guess right)
     60 INSTALL=	@INSTALL@
     61 INSTALL_PROGRAM=@INSTALL_PROGRAM@
     62 INSTALL_SCRIPT= @INSTALL_SCRIPT@
     63 INSTALL_DATA=	@INSTALL_DATA@
     64 # Shared libraries must be installed with executable mode on some systems;
     65 # rather than figuring out exactly which, we always give them executable mode.
     66 # Also, making them read-only seems to be a good idea...
     67 INSTALL_SHARED= ${INSTALL} -m 555
     68 
     69 MKDIR_P=	@MKDIR_P@
     70 
     71 MAKESETUP=      $(srcdir)/Modules/makesetup
     72 
     73 # Compiler options
     74 OPT=		@OPT@
     75 BASECFLAGS=	@BASECFLAGS@
     76 CFLAGS=		$(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
     77 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
     78 # be able to build extension modules using the directories specified in the
     79 # environment variables
     80 CPPFLAGS=	-I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
     81 LDFLAGS=	@LDFLAGS@
     82 LDLAST=		@LDLAST@
     83 SGI_ABI=	@SGI_ABI@
     84 CCSHARED=	@CCSHARED@
     85 LINKFORSHARED=	@LINKFORSHARED@
     86 ARFLAGS=	@ARFLAGS@
     87 # Extra C flags added for building the interpreter object files.
     88 CFLAGSFORSHARED=@CFLAGSFORSHARED@
     89 # C flags used for building the interpreter object files
     90 PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
     91 
     92 
     93 # Machine-dependent subdirectories
     94 MACHDEP=	@MACHDEP@
     95 
     96 # Multiarch directory (may be empty)
     97 MULTIARCH=	@MULTIARCH@
     98 
     99 # Install prefix for architecture-independent files
    100 prefix=		@prefix@
    101 
    102 # Install prefix for architecture-dependent files
    103 exec_prefix=	@exec_prefix@
    104 
    105 # Install prefix for data files
    106 datarootdir=    @datarootdir@
    107 
    108 # Expanded directories
    109 BINDIR=		@bindir@
    110 LIBDIR=		@libdir@
    111 MANDIR=		@mandir@
    112 INCLUDEDIR=	@includedir@
    113 CONFINCLUDEDIR=	$(exec_prefix)/include
    114 SCRIPTDIR=	$(prefix)/lib
    115 
    116 # Detailed destination directories
    117 BINLIBDEST=	$(LIBDIR)/python$(VERSION)
    118 LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
    119 INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
    120 CONFINCLUDEPY=	$(CONFINCLUDEDIR)/python$(VERSION)
    121 LIBP=		$(LIBDIR)/python$(VERSION)
    122 
    123 # Symbols used for using shared libraries
    124 SO=		@SO@
    125 LDSHARED=	@LDSHARED@ $(LDFLAGS)
    126 BLDSHARED=	@BLDSHARED@ $(LDFLAGS)
    127 LDCXXSHARED=	@LDCXXSHARED@
    128 DESTSHARED=	$(BINLIBDEST)/lib-dynload
    129 
    130 # Executable suffix (.exe on Windows and Mac OS X)
    131 EXE=		@EXEEXT@
    132 BUILDEXE=	@BUILDEXEEXT@
    133 
    134 # Short name and location for Mac OS X Python framework
    135 UNIVERSALSDK=@UNIVERSALSDK@
    136 PYTHONFRAMEWORK=	@PYTHONFRAMEWORK@
    137 PYTHONFRAMEWORKDIR=	@PYTHONFRAMEWORKDIR@
    138 PYTHONFRAMEWORKPREFIX=	@PYTHONFRAMEWORKPREFIX@
    139 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
    140 # Deployment target selected during configure, to be checked
    141 # by distutils. The export statement is needed to ensure that the
    142 # deployment target is active during build.
    143 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
    144 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
    145 
    146 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
    147 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
    148 
    149 # Environment to run shared python without installed libraries
    150 RUNSHARED=       @RUNSHARED@
    151 
    152 # ensurepip options
    153 ENSUREPIP=      @ENSUREPIP@
    154 
    155 # Modes for directories, executables and data files created by the
    156 # install process.  Default to user-only-writable for all file types.
    157 DIRMODE=	755
    158 EXEMODE=	755
    159 FILEMODE=	644
    160 
    161 # configure script arguments
    162 CONFIG_ARGS=	@CONFIG_ARGS@
    163 
    164 
    165 # Subdirectories with code
    166 SRCDIRS= 	@SRCDIRS@
    167 
    168 # Other subdirectories
    169 SUBDIRSTOO=	Include Lib Misc Demo
    170 
    171 # Files and directories to be distributed
    172 CONFIGFILES=	configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
    173 DISTFILES=	README ChangeLog $(CONFIGFILES)
    174 DISTDIRS=	$(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
    175 DIST=		$(DISTFILES) $(DISTDIRS)
    176 
    177 
    178 LIBRARY=	@LIBRARY@
    179 LDLIBRARY=      @LDLIBRARY@
    180 BLDLIBRARY=     @BLDLIBRARY@
    181 DLLLIBRARY=	@DLLLIBRARY@
    182 LDLIBRARYDIR=   @LDLIBRARYDIR@
    183 INSTSONAME=	@INSTSONAME@
    184 
    185 
    186 LIBS=		@LIBS@
    187 LIBM=		@LIBM@
    188 LIBC=		@LIBC@
    189 SYSLIBS=	$(LIBM) $(LIBC)
    190 SHLIBS=		@SHLIBS@
    191 
    192 THREADOBJ=	@THREADOBJ@
    193 DLINCLDIR=	@DLINCLDIR@
    194 DYNLOADFILE=	@DYNLOADFILE@
    195 MACHDEP_OBJS=	@MACHDEP_OBJS@
    196 LIBOBJDIR=	Python/
    197 LIBOBJS=	@LIBOBJS@
    198 UNICODE_OBJS=   @UNICODE_OBJS@
    199 
    200 PYTHON=		python$(EXE)
    201 BUILDPYTHON=	python$(BUILDEXE)
    202 
    203 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
    204 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
    205 HOST_GNU_TYPE=  @host@
    206 
    207 # Tcl and Tk config info from --with-tcltk-includes and -libs options
    208 TCLTK_INCLUDES=	@TCLTK_INCLUDES@
    209 TCLTK_LIBS=	@TCLTK_LIBS@
    210 
    211 # The task to run while instrument when building the profile-opt target
    212 # We exclude unittests with -x that take a rediculious amount of time to
    213 # run in the instrumented training build or do not provide much value.
    214 PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess
    215 
    216 # report files for gcov / lcov coverage report
    217 COVERAGE_INFO=	$(abs_builddir)/coverage.info
    218 COVERAGE_REPORT=$(abs_builddir)/lcov-report
    219 COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
    220 
    221 # === Definitions added by makesetup ===
    222 
    223 
    224 ##########################################################################
    225 # Modules
    226 MODULE_OBJS=	\
    227 		Modules/config.o \
    228 		Modules/getpath.o \
    229 		Modules/main.o \
    230 		Modules/gcmodule.o
    231 
    232 # Used of signalmodule.o is not available
    233 SIGNAL_OBJS=	@SIGNAL_OBJS@
    234 
    235 
    236 ##########################################################################
    237 # Grammar
    238 GRAMMAR_H=	Include/graminit.h
    239 GRAMMAR_C=	Python/graminit.c
    240 GRAMMAR_INPUT=	$(srcdir)/Grammar/Grammar
    241 
    242 
    243 LIBFFI_INCLUDEDIR=	@LIBFFI_INCLUDEDIR@
    244 
    245 ##########################################################################
    246 # Parser
    247 PGEN=		Parser/pgen$(EXE)
    248 
    249 PSRCS=		\
    250 		Parser/acceler.c \
    251 		Parser/grammar1.c \
    252 		Parser/listnode.c \
    253 		Parser/node.c \
    254 		Parser/parser.c \
    255 		Parser/parsetok.c \
    256 		Parser/bitset.c \
    257 		Parser/metagrammar.c \
    258 		Parser/firstsets.c \
    259 		Parser/grammar.c \
    260 		Parser/pgen.c
    261 
    262 POBJS=		\
    263 		Parser/acceler.o \
    264 		Parser/grammar1.o \
    265 		Parser/listnode.o \
    266 		Parser/node.o \
    267 		Parser/parser.o \
    268 		Parser/parsetok.o \
    269 		Parser/bitset.o \
    270 		Parser/metagrammar.o \
    271 		Parser/firstsets.o \
    272 		Parser/grammar.o \
    273 		Parser/pgen.o
    274 
    275 PARSER_OBJS=	$(POBJS) Parser/myreadline.o Parser/tokenizer.o
    276 
    277 PGSRCS=		\
    278 		Objects/obmalloc.c \
    279 		Python/mysnprintf.c \
    280 		Python/pyctype.c \
    281 		Parser/tokenizer_pgen.c \
    282 		Parser/printgrammar.c \
    283 		Parser/pgenmain.c
    284 
    285 PGOBJS=		\
    286 		Objects/obmalloc.o \
    287 		Python/mysnprintf.o \
    288 		Python/pyctype.o \
    289 		Parser/tokenizer_pgen.o \
    290 		Parser/printgrammar.o \
    291 		Parser/pgenmain.o
    292 
    293 PARSER_HEADERS= \
    294 		Parser/parser.h \
    295 		Parser/tokenizer.h
    296 
    297 PGENSRCS=	$(PSRCS) $(PGSRCS)
    298 PGENOBJS=	$(POBJS) $(PGOBJS)
    299 
    300 ##########################################################################
    301 # AST
    302 AST_H_DIR=	Include
    303 AST_H=		$(AST_H_DIR)/Python-ast.h
    304 AST_C_DIR=	Python
    305 AST_C=		$(AST_C_DIR)/Python-ast.c
    306 AST_ASDL=	$(srcdir)/Parser/Python.asdl
    307 
    308 ASDLGEN_FILES=	$(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
    309 # XXX Note that a build now requires Python exist before the build starts
    310 ASDLGEN=	$(srcdir)/Parser/asdl_c.py
    311 
    312 ##########################################################################
    313 # Python
    314 
    315 OPCODETARGETS_H= \
    316 		$(srcdir)/Python/opcode_targets.h
    317 		
    318 OPCODETARGETGEN= \
    319 		$(srcdir)/Python/makeopcodetargets.py
    320 
    321 OPCODETARGETGEN_FILES= \
    322 		$(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
    323 
    324 PYTHON_OBJS=	\
    325 		Python/_warnings.o \
    326 		Python/Python-ast.o \
    327 		Python/asdl.o \
    328 		Python/ast.o \
    329 		Python/bltinmodule.o \
    330 		Python/ceval.o \
    331 		Python/compile.o \
    332 		Python/codecs.o \
    333 		Python/errors.o \
    334 		Python/frozen.o \
    335 		Python/frozenmain.o \
    336 		Python/future.o \
    337 		Python/getargs.o \
    338 		Python/getcompiler.o \
    339 		Python/getcopyright.o \
    340 		Python/getplatform.o \
    341 		Python/getversion.o \
    342 		Python/graminit.o \
    343 		Python/import.o \
    344 		Python/importdl.o \
    345 		Python/marshal.o \
    346 		Python/modsupport.o \
    347 		Python/mystrtoul.o \
    348 		Python/mysnprintf.o \
    349 		Python/peephole.o \
    350 		Python/pyarena.o \
    351 		Python/pyctype.o \
    352 		Python/pyfpe.o \
    353 		Python/pymath.o \
    354 		Python/pystate.o \
    355 		Python/pythonrun.o \
    356                 Python/random.o \
    357 		Python/structmember.o \
    358 		Python/symtable.o \
    359 		Python/sysmodule.o \
    360 		Python/traceback.o \
    361 		Python/getopt.o \
    362 		Python/pystrcmp.o \
    363 		Python/pystrtod.o \
    364 		Python/dtoa.o \
    365 		Python/formatter_unicode.o \
    366 		Python/formatter_string.o \
    367 		Python/$(DYNLOADFILE) \
    368 		$(LIBOBJS) \
    369 		$(MACHDEP_OBJS) \
    370 		$(THREADOBJ)
    371 
    372 
    373 ##########################################################################
    374 # Objects
    375 OBJECT_OBJS=	\
    376 		Objects/abstract.o \
    377 		Objects/boolobject.o \
    378 		Objects/bufferobject.o \
    379 		Objects/bytes_methods.o \
    380 		Objects/bytearrayobject.o \
    381 		Objects/capsule.o \
    382 		Objects/cellobject.o \
    383 		Objects/classobject.o \
    384 		Objects/cobject.o \
    385 		Objects/codeobject.o \
    386 		Objects/complexobject.o \
    387 		Objects/descrobject.o \
    388 		Objects/enumobject.o \
    389 		Objects/exceptions.o \
    390 		Objects/genobject.o \
    391 		Objects/fileobject.o \
    392 		Objects/floatobject.o \
    393 		Objects/frameobject.o \
    394 		Objects/funcobject.o \
    395 		Objects/intobject.o \
    396 		Objects/iterobject.o \
    397 		Objects/listobject.o \
    398 		Objects/longobject.o \
    399 		Objects/dictobject.o \
    400 		Objects/memoryobject.o \
    401 		Objects/methodobject.o \
    402 		Objects/moduleobject.o \
    403 		Objects/object.o \
    404 		Objects/obmalloc.o \
    405 		Objects/rangeobject.o \
    406 		Objects/setobject.o \
    407 		Objects/sliceobject.o \
    408 		Objects/stringobject.o \
    409 		Objects/structseq.o \
    410 		Objects/tupleobject.o \
    411 		Objects/typeobject.o \
    412 		Objects/weakrefobject.o \
    413 		$(UNICODE_OBJS)
    414 
    415 
    416 ##########################################################################
    417 # objects that get linked into the Python library
    418 LIBRARY_OBJS=	\
    419 		Modules/getbuildinfo.o \
    420 		$(PARSER_OBJS) \
    421 		$(OBJECT_OBJS) \
    422 		$(PYTHON_OBJS) \
    423 		$(MODULE_OBJS) \
    424 		$(SIGNAL_OBJS) \
    425 		$(MODOBJS)
    426 
    427 #########################################################################
    428 # Rules
    429 
    430 # Default target
    431 all:		@DEF_MAKE_ALL_RULE@
    432 build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
    433 
    434 # Compile a binary with profile guided optimization.
    435 profile-opt:
    436 	@if [ $(LLVM_PROF_ERR) = yes ]; then \
    437 		echo "Error: Cannot perform PGO build because llvm-profdata was not found in PATH" ;\
    438 		echo "Please add it to PATH and run ./configure again" ;\
    439 		exit 1;\
    440 	fi
    441 	@echo "Building with support for profile generation:"
    442 	$(MAKE) clean
    443 	$(MAKE) profile-removal
    444 	$(MAKE) build_all_generate_profile
    445 	$(MAKE) profile-removal
    446 	@echo "Running code to generate profile data (this can take a while):"
    447 	$(MAKE) run_profile_task
    448 	$(MAKE) build_all_merge_profile
    449 	@echo "Rebuilding with profile guided optimizations:"
    450 	$(MAKE) clean
    451 	$(MAKE) build_all_use_profile
    452 	$(MAKE) profile-removal
    453 
    454 build_all_generate_profile:
    455 	$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
    456 
    457 run_profile_task:
    458 	: # FIXME: can't run for a cross build
    459 	$(LLVM_PROF_FILE) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
    460 
    461 build_all_merge_profile:
    462 	$(LLVM_PROF_MERGER)
    463 
    464 build_all_use_profile:
    465 	$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
    466 
    467 # Compile and run with gcov
    468 .PHONY=coverage coverage-lcov coverage-report
    469 coverage:
    470 	@echo "Building with support for coverage checking:"
    471 	$(MAKE) clean profile-removal
    472 	$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
    473 
    474 coverage-lcov:
    475 	@echo "Creating Coverage HTML report with LCOV:"
    476 	@rm -f $(COVERAGE_INFO)
    477 	@rm -rf $(COVERAGE_REPORT)
    478 	@lcov --capture --directory $(abs_builddir) \
    479 	    --base-directory $(realpath $(abs_builddir)) \
    480 	    --path $(realpath $(abs_srcdir)) \
    481 	    --output-file $(COVERAGE_INFO)
    482 	: # remove 3rd party modules and system headers
    483 	@lcov --remove $(COVERAGE_INFO) \
    484 	    '*/Modules/_ctypes/libffi*/*' \
    485 	    '*/Modules/expat/*' \
    486 	    '*/Modules/zlib/*' \
    487 	    '*/Include/*' \
    488 	    '/usr/include/*' \
    489 	    '/usr/local/include/*' \
    490 	    --output-file $(COVERAGE_INFO)
    491 	@genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \
    492 	    $(COVERAGE_REPORT_OPTIONS)
    493 	@echo
    494 	@echo "lcov report at $(COVERAGE_REPORT)/index.html"
    495 	@echo
    496 
    497 coverage-report:
    498 	: # force rebuilding of parser
    499 	@touch $(GRAMMAR_INPUT)
    500 	: # build with coverage info
    501 	$(MAKE) coverage
    502 	: # run tests, ignore failures
    503 	$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) || true
    504 	: # build lcov report
    505 	$(MAKE) coverage-lcov
    506 
    507 
    508 # Build the interpreter
    509 $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
    510 		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
    511 			Modules/python.o \
    512 			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
    513 
    514 platform: $(BUILDPYTHON) pybuilddir.txt
    515 	$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
    516 
    517 # Create build directory and generate the sysconfig build-time data there.
    518 # pybuilddir.txt contains the name of the build dir and is used for
    519 # sys.path fixup -- see Modules/getpath.c.
    520 # Since this step runs before shared modules are built, try to avoid bootstrap
    521 # problems by creating a dummy pybuilddir.txt just to allow interpreter
    522 # initialization to succeed.  It will be overwritten by generate-posix-vars
    523 # or removed in case of failure.
    524 pybuilddir.txt: $(BUILDPYTHON)
    525 	@echo "none" > ./pybuilddir.txt
    526 	$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
    527 	if test $$? -ne 0 ; then \
    528 		echo "generate-posix-vars failed" ; \
    529 		rm -f ./pybuilddir.txt ; \
    530 		exit 1 ; \
    531 	fi
    532 
    533 # This is shared by the math and cmath modules
    534 Modules/_math.o: Modules/_math.c Modules/_math.h
    535 	$(CC) -c $(CCSHARED) $(PY_CFLAGS) -o $@ $<
    536 
    537 # Build the shared modules
    538 # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
    539 # -s, --silent or --quiet is always the first char.
    540 # Under BSD make, MAKEFLAGS might be " -s -v x=y".
    541 sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
    542 	@case "$$MAKEFLAGS" in \
    543 	    *\ -s*|s*) quiet="-q";; \
    544 	    *) quiet="";; \
    545 	esac; \
    546 	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
    547 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
    548 		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
    549 
    550 # Build static library
    551 # avoid long command lines, same as LIBRARY_OBJS
    552 $(LIBRARY): $(LIBRARY_OBJS)
    553 	-rm -f $@
    554 	$(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
    555 	$(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
    556 	$(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
    557 	$(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
    558 	$(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
    559 	$(AR) $(ARFLAGS) $@ $(MODOBJS)
    560 	$(RANLIB) $@
    561 
    562 libpython$(VERSION).so: $(LIBRARY_OBJS)
    563 	if test $(INSTSONAME) != $(LDLIBRARY); then \
    564 		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
    565 		$(LN) -f $(INSTSONAME) $@; \
    566 	else \
    567 		$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
    568 	fi
    569 
    570 libpython$(VERSION).dylib: $(LIBRARY_OBJS)
    571 	 $(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); \
    572 
    573 
    574 libpython$(VERSION).sl: $(LIBRARY_OBJS)
    575 	$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
    576 
    577 # Copy up the gdb python hooks into a position where they can be automatically
    578 # loaded by gdb during Lib/test/test_gdb.py
    579 #
    580 # Distributors are likely to want to install this somewhere else e.g. relative
    581 # to the stripped DWARF data for the shared library.
    582 gdbhooks: $(BUILDPYTHON)-gdb.py
    583 
    584 SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
    585 $(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
    586 	$(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
    587 
    588 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
    589 # minimal framework (not including the Lib directory and such) in the current
    590 # directory.
    591 RESSRCDIR=Mac/Resources/framework
    592 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
    593 		$(LIBRARY) \
    594 		$(RESSRCDIR)/Info.plist
    595 	$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
    596 	$(CC) -o $(LDLIBRARY) $(LDFLAGS)  -dynamiclib \
    597 		-all_load $(LIBRARY) -Wl,-single_module \
    598 		-install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
    599 		-compatibility_version $(VERSION) \
    600 		-current_version $(VERSION);
    601 	$(INSTALL) -d -m $(DIRMODE)  \
    602 		$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
    603 	$(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
    604 		$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
    605 	$(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
    606 	$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
    607 	$(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
    608 	$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
    609 
    610 # This rule builds the Cygwin Python DLL and import library if configured
    611 # for a shared core library; otherwise, this rule is a noop.
    612 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
    613 	if test -n "$(DLLLIBRARY)"; then \
    614 		$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
    615 			$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
    616 	else true; \
    617 	fi
    618 
    619 
    620 oldsharedmods: $(SHAREDMODS)
    621 
    622 
    623 Makefile Modules/config.c: Makefile.pre \
    624 				$(srcdir)/Modules/config.c.in \
    625 				$(MAKESETUP) \
    626 				Modules/Setup.config \
    627 				Modules/Setup \
    628 				Modules/Setup.local
    629 	$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
    630 				-s Modules \
    631 				Modules/Setup.config \
    632 				Modules/Setup.local \
    633 				Modules/Setup
    634 	@mv config.c Modules
    635 	@echo "The Makefile was updated, you may need to re-run make."
    636 
    637 
    638 Modules/Setup: $(srcdir)/Modules/Setup.dist
    639 	@if test -f Modules/Setup; then \
    640 		echo "-----------------------------------------------"; \
    641 		echo "Modules/Setup.dist is newer than Modules/Setup;"; \
    642 		echo "check to make sure you have all the updates you"; \
    643 		echo "need in your Modules/Setup file."; \
    644 		echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
    645 		echo "-----------------------------------------------"; \
    646 	fi
    647 
    648 ############################################################################
    649 # Special rules for object files
    650 
    651 Modules/getbuildinfo.o: $(PARSER_OBJS) \
    652 		$(OBJECT_OBJS) \
    653 		$(PYTHON_OBJS) \
    654 		$(MODULE_OBJS) \
    655 		$(SIGNAL_OBJS) \
    656 		$(MODOBJS) \
    657 		$(srcdir)/Modules/getbuildinfo.c
    658 	$(CC) -c $(PY_CFLAGS) \
    659 	      -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \
    660 	      -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
    661 	      -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
    662 	      -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
    663 	      -o $@ $(srcdir)/Modules/getbuildinfo.c
    664 
    665 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
    666 	$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
    667 		-DPREFIX='"$(prefix)"' \
    668 		-DEXEC_PREFIX='"$(exec_prefix)"' \
    669 		-DVERSION='"$(VERSION)"' \
    670 		-DVPATH='"$(VPATH)"' \
    671 		-o $@ $(srcdir)/Modules/getpath.c
    672 
    673 Modules/python.o: $(srcdir)/Modules/python.c
    674 	$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
    675 
    676 Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h
    677 
    678 Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h
    679 
    680 Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
    681 
    682 $(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
    683 	@$(MKDIR_P) Include
    684 	$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
    685 $(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
    686 	touch $(GRAMMAR_C)
    687 
    688 $(PGEN):	$(PGENOBJS)
    689 		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
    690 
    691 Parser/grammar.o:	$(srcdir)/Parser/grammar.c \
    692 				$(srcdir)/Include/token.h \
    693 				$(srcdir)/Include/grammar.h
    694 Parser/metagrammar.o:	$(srcdir)/Parser/metagrammar.c
    695 
    696 Parser/tokenizer_pgen.o:	$(srcdir)/Parser/tokenizer.c
    697 
    698 Parser/pgenmain.o:	$(srcdir)/Include/parsetok.h
    699 
    700 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
    701 	$(MKDIR_P) $(AST_H_DIR)
    702 	$(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
    703 
    704 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
    705 	$(MKDIR_P) $(AST_C_DIR)
    706 	$(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
    707 
    708 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
    709 
    710 Python/getplatform.o: $(srcdir)/Python/getplatform.c
    711 		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
    712 
    713 Python/importdl.o: $(srcdir)/Python/importdl.c
    714 		$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
    715 
    716 Objects/unicodectype.o:	$(srcdir)/Objects/unicodectype.c \
    717 				$(srcdir)/Objects/unicodetype_db.h
    718 
    719 STRINGLIB_HEADERS= \
    720 		$(srcdir)/Include/bytes_methods.h \
    721 		$(srcdir)/Objects/stringlib/count.h \
    722 		$(srcdir)/Objects/stringlib/ctype.h \
    723 		$(srcdir)/Objects/stringlib/fastsearch.h \
    724 		$(srcdir)/Objects/stringlib/find.h \
    725 		$(srcdir)/Objects/stringlib/formatter.h \
    726 		$(srcdir)/Objects/stringlib/partition.h \
    727 		$(srcdir)/Objects/stringlib/split.h \
    728 		$(srcdir)/Objects/stringlib/stringdefs.h \
    729 		$(srcdir)/Objects/stringlib/string_format.h \
    730 		$(srcdir)/Objects/stringlib/transmogrify.h \
    731 		$(srcdir)/Objects/stringlib/unicodedefs.h \
    732 		$(srcdir)/Objects/stringlib/localeutil.h
    733 
    734 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
    735 				$(STRINGLIB_HEADERS)
    736 
    737 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
    738 				$(STRINGLIB_HEADERS)
    739 
    740 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
    741 				$(STRINGLIB_HEADERS)
    742 
    743 $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
    744 	$(OPCODETARGETGEN) $(OPCODETARGETS_H)
    745 
    746 Python/ceval.o: $(OPCODETARGETS_H)
    747 
    748 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
    749 				$(STRINGLIB_HEADERS)
    750 
    751 Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
    752 				$(STRINGLIB_HEADERS)
    753 
    754 ############################################################################
    755 # Header files
    756 
    757 PYTHON_HEADERS= \
    758 		Include/Python-ast.h \
    759 		Include/Python.h \
    760 		Include/abstract.h \
    761 		Include/asdl.h \
    762 		Include/ast.h \
    763 		Include/bitset.h \
    764 		Include/boolobject.h \
    765 		Include/bytearrayobject.h \
    766 		Include/bytes_methods.h \
    767 		Include/bytesobject.h \
    768 		Include/bufferobject.h \
    769 		Include/cellobject.h \
    770 		Include/ceval.h \
    771 		Include/classobject.h \
    772 		Include/cobject.h \
    773 		Include/code.h \
    774 		Include/codecs.h \
    775 		Include/compile.h \
    776 		Include/complexobject.h \
    777 		Include/descrobject.h \
    778 		Include/dictobject.h \
    779 		Include/dtoa.h \
    780 		Include/enumobject.h \
    781 		Include/errcode.h \
    782 		Include/eval.h \
    783 		Include/fileobject.h \
    784 		Include/floatobject.h \
    785 		Include/frameobject.h \
    786 		Include/funcobject.h \
    787 		Include/genobject.h \
    788 		Include/import.h \
    789 		Include/intobject.h \
    790 		Include/intrcheck.h \
    791 		Include/iterobject.h \
    792 		Include/listobject.h \
    793 		Include/longintrepr.h \
    794 		Include/longobject.h \
    795 		Include/marshal.h \
    796 		Include/memoryobject.h \
    797 		Include/metagrammar.h \
    798 		Include/methodobject.h \
    799 		Include/modsupport.h \
    800 		Include/moduleobject.h \
    801 		Include/node.h \
    802 		Include/object.h \
    803 		Include/objimpl.h \
    804 		Include/opcode.h \
    805 		Include/osdefs.h \
    806 		Include/parsetok.h \
    807 		Include/patchlevel.h \
    808 		Include/pgen.h \
    809 		Include/pgenheaders.h \
    810 		Include/pyarena.h \
    811 		Include/pycapsule.h \
    812 		Include/pyctype.h \
    813 		Include/pydebug.h \
    814 		Include/pyerrors.h \
    815 		Include/pyfpe.h \
    816 		Include/pymath.h \
    817 		Include/pygetopt.h \
    818 		Include/pymem.h \
    819 		Include/pyport.h \
    820 		Include/pystate.h \
    821 		Include/pystrcmp.h \
    822 		Include/pystrtod.h \
    823 		Include/pythonrun.h \
    824 		Include/pythread.h \
    825 		Include/rangeobject.h \
    826 		Include/setobject.h \
    827 		Include/sliceobject.h \
    828 		Include/stringobject.h \
    829 		Include/structmember.h \
    830 		Include/structseq.h \
    831 		Include/symtable.h \
    832 		Include/sysmodule.h \
    833 		Include/traceback.h \
    834 		Include/tupleobject.h \
    835 		Include/ucnhash.h \
    836 		Include/unicodeobject.h \
    837 		Include/warnings.h \
    838 		Include/weakrefobject.h \
    839 		pyconfig.h \
    840 		$(PARSER_HEADERS) \
    841 		$(AST_H)
    842 
    843 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
    844 
    845 
    846 ######################################################################
    847 
    848 # Test the interpreter (twice, once without .pyc files, once with)
    849 # In the past, we've had problems where bugs in the marshalling or
    850 # elsewhere caused bytecode read from .pyc files to behave differently
    851 # than bytecode generated directly from a .py source file.  Sometimes
    852 # the bytecode read from a .pyc file had the bug, sometimes the directly
    853 # generated bytecode.  This is sometimes a very shy bug needing a lot of
    854 # sample data.
    855 
    856 TESTOPTS=	-l $(EXTRATESTOPTS)
    857 TESTPROG=	$(srcdir)/Lib/test/regrtest.py
    858 TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
    859 test:		all platform
    860 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
    861 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
    862 		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
    863 
    864 testall:	all platform
    865 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
    866 		$(TESTPYTHON) $(srcdir)/Lib/compileall.py
    867 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
    868 		-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
    869 		$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
    870 
    871 #  Run the unitests for both architectures in a Universal build on OSX
    872 #  Must be run on an Intel box.
    873 testuniversal:	all platform
    874 		if [ `arch` != 'i386' ];then \
    875 			echo "This can only be used on OSX/i386" ;\
    876 			exit 1 ;\
    877 		fi
    878 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
    879 		-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
    880 		$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
    881 		$(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) -uall $(TESTOPTS)
    882 
    883 
    884 # Like testall, but with a single pass only
    885 # run an optional script to include some information about the build environment
    886 buildbottest:	build_all platform
    887 		-@if which pybuildbot.identify >/dev/null 2>&1; then \
    888 			pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
    889 		fi
    890 		$(TESTPYTHON) -R $(TESTPROG) -uall -rwW $(TESTOPTS)
    891 
    892 QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
    893 		test_multibytecodec test_urllib2_localnet test_itertools \
    894 		test_multiprocessing test_mailbox test_socket test_poll \
    895 		test_select test_zipfile
    896 quicktest:	all platform
    897 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
    898 		-$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
    899 		$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
    900 
    901 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
    902 		test_longexp
    903 memtest:	all platform
    904 		-rm -f $(srcdir)/Lib/test/*.py[co]
    905 		-$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
    906 		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
    907 
    908 # Install everything
    909 install:	@FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
    910 	if test "x$(ENSUREPIP)" != "xno"  ; then \
    911 		case $(ENSUREPIP) in \
    912 			upgrade) ensurepip="--upgrade" ;; \
    913 			install|*) ensurepip="" ;; \
    914 		esac; \
    915 		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
    916 			$$ensurepip --root=$(DESTDIR)/ ; \
    917 	fi
    918 
    919 # Install almost everything without disturbing previous versions
    920 altinstall:	commoninstall
    921 	if test "x$(ENSUREPIP)" != "xno"  ; then \
    922 		case $(ENSUREPIP) in \
    923 			upgrade) ensurepip="--altinstall --upgrade --no-default-pip" ;; \
    924 			install|*) ensurepip="--altinstall --no-default-pip" ;; \
    925 		esac; \
    926 		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
    927 			$$ensurepip --root=$(DESTDIR)/ ; \
    928 	fi
    929 
    930 commoninstall:	@FRAMEWORKALTINSTALLFIRST@ \
    931 		altbininstall libinstall inclinstall libainstall \
    932 		sharedinstall oldsharedinstall altmaninstall \
    933 		@FRAMEWORKALTINSTALLLAST@
    934 
    935 # Install shared libraries enabled by Setup
    936 DESTDIRS=	$(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
    937 
    938 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
    939 		@for i in X $(SHAREDMODS); do \
    940 		  if test $$i != X; then \
    941 		    echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
    942 		    $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
    943 		  fi; \
    944 		done
    945 
    946 $(DESTSHARED):
    947 		@for i in $(DESTDIRS); \
    948 		do \
    949 			if test ! -d $(DESTDIR)$$i; then \
    950 				echo "Creating directory $$i"; \
    951 				$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
    952 			else    true; \
    953 			fi; \
    954 		done
    955 
    956 
    957 # Install the interpreter by creating a symlink chain:
    958 #  $(PYTHON) -> python2 -> python$(VERSION))
    959 # Also create equivalent chains for other installed files
    960 bininstall:	altbininstall
    961 	if test ! -d $(DESTDIR)$(LIBPC); then \
    962 		echo "Creating directory $(LIBPC)"; \
    963 		$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \
    964 	fi
    965 	-if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
    966 	then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
    967 	else true; \
    968 	fi
    969 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
    970 	-rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
    971 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
    972 	-rm -f $(DESTDIR)$(BINDIR)/python2-config
    973 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
    974 	-rm -f $(DESTDIR)$(BINDIR)/python-config
    975 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
    976 	-test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
    977 	-rm -f $(DESTDIR)$(LIBPC)/python2.pc
    978 	(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
    979 	-rm -f $(DESTDIR)$(LIBPC)/python.pc
    980 	(cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
    981 
    982 # Install the interpreter with $(VERSION) affixed
    983 # This goes into $(exec_prefix)
    984 altbininstall:	$(BUILDPYTHON)
    985 	@for i in $(BINDIR) $(LIBDIR); \
    986 	do \
    987 		if test ! -d $(DESTDIR)$$i; then \
    988 			echo "Creating directory $$i"; \
    989 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
    990 		else	true; \
    991 		fi; \
    992 	done
    993 	$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
    994 	if test -f $(LDLIBRARY); then \
    995 		if test -n "$(DLLLIBRARY)" ; then \
    996 			$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
    997 		else \
    998 			$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
    999 			if test $(LDLIBRARY) != $(INSTSONAME); then \
   1000 				(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
   1001 			fi \
   1002 		fi; \
   1003 	else	true; \
   1004 	fi
   1005 
   1006 # Install the versioned manual page
   1007 altmaninstall:
   1008 	@for i in $(MANDIR) $(MANDIR)/man1; \
   1009 	do \
   1010 		if test ! -d $(DESTDIR)$$i; then \
   1011 			echo "Creating directory $$i"; \
   1012 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
   1013 		else	true; \
   1014 		fi; \
   1015 	done
   1016 	$(INSTALL_DATA) $(srcdir)/Misc/python.man \
   1017 		$(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
   1018 
   1019 # Install the unversioned manual pages
   1020 maninstall:	altmaninstall
   1021 	-rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
   1022 	(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
   1023 	-rm -f $(DESTDIR)$(MANDIR)/man1/python.1
   1024 	(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)
   1025 
   1026 # Install the library
   1027 PLATDIR=	@PLATDIR@
   1028 EXTRAPLATDIR= @EXTRAPLATDIR@
   1029 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
   1030 MACHDEPS=	$(PLATDIR) $(EXTRAPLATDIR)
   1031 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
   1032 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
   1033 	plat-mac/lib-scriptpackages/_builtinSuites \
   1034 	plat-mac/lib-scriptpackages/CodeWarrior \
   1035 	plat-mac/lib-scriptpackages/Explorer \
   1036 	plat-mac/lib-scriptpackages/Finder \
   1037 	plat-mac/lib-scriptpackages/Netscape \
   1038 	plat-mac/lib-scriptpackages/StdSuites \
   1039 	plat-mac/lib-scriptpackages/SystemEvents \
   1040 	plat-mac/lib-scriptpackages/Terminal
   1041 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
   1042 LIBSUBDIRS=	lib-tk lib-tk/test lib-tk/test/test_tkinter \
   1043 		lib-tk/test/test_ttk site-packages test test/audiodata test/capath \
   1044 		test/data test/cjkencodings test/decimaltestdata test/xmltestdata \
   1045 		test/imghdrdata \
   1046 		test/subprocessdata \
   1047 		test/tracedmodules \
   1048 		encodings compiler hotshot \
   1049 		email email/mime email/test email/test/data \
   1050 		ensurepip ensurepip/_bundled \
   1051 		json json/tests \
   1052 		sqlite3 sqlite3/test \
   1053 		logging bsddb bsddb/test csv importlib wsgiref \
   1054 		lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
   1055 		lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
   1056 		ctypes ctypes/test ctypes/macholib \
   1057 		idlelib idlelib/Icons idlelib/idle_test \
   1058 		distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
   1059 		multiprocessing multiprocessing/dummy \
   1060 		unittest unittest/test \
   1061 		lib-old \
   1062 		curses pydoc_data $(MACHDEPS)
   1063 libinstall:	build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
   1064 	@for i in $(SCRIPTDIR) $(LIBDEST); \
   1065 	do \
   1066 		if test ! -d $(DESTDIR)$$i; then \
   1067 			echo "Creating directory $$i"; \
   1068 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
   1069 		else	true; \
   1070 		fi; \
   1071 	done
   1072 	@for d in $(LIBSUBDIRS); \
   1073 	do \
   1074 		a=$(srcdir)/Lib/$$d; \
   1075 		if test ! -d $$a; then continue; else true; fi; \
   1076 		b=$(LIBDEST)/$$d; \
   1077 		if test ! -d $(DESTDIR)$$b; then \
   1078 			echo "Creating directory $$b"; \
   1079 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
   1080 		else	true; \
   1081 		fi; \
   1082 	done
   1083 	@for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
   1084 	do \
   1085 		if test -x $$i; then \
   1086 			$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
   1087 			echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
   1088 		else \
   1089 			$(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
   1090 			echo $(INSTALL_DATA) $$i $(LIBDEST); \
   1091 		fi; \
   1092 	done
   1093 	@for d in $(LIBSUBDIRS); \
   1094 	do \
   1095 		a=$(srcdir)/Lib/$$d; \
   1096 		if test ! -d $$a; then continue; else true; fi; \
   1097 		if test `ls $$a | wc -l` -lt 1; then continue; fi; \
   1098 		b=$(LIBDEST)/$$d; \
   1099 		for i in $$a/*; \
   1100 		do \
   1101 			case $$i in \
   1102 			*CVS) ;; \
   1103 			*.py[co]) ;; \
   1104 			*.orig) ;; \
   1105 			*~) ;; \
   1106 			*) \
   1107 				if test -d $$i; then continue; fi; \
   1108 				if test -x $$i; then \
   1109 				    echo $(INSTALL_SCRIPT) $$i $$b; \
   1110 				    $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
   1111 				else \
   1112 				    echo $(INSTALL_DATA) $$i $$b; \
   1113 				    $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
   1114 				fi;; \
   1115 			esac; \
   1116 		done; \
   1117 	done
   1118 	$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
   1119 	if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
   1120 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
   1121 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
   1122 	fi
   1123 	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
   1124 		$(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
   1125 		-d $(LIBDEST) -f \
   1126 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
   1127 		$(DESTDIR)$(LIBDEST)
   1128 	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   1129 		$(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
   1130 		-d $(LIBDEST) -f \
   1131 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
   1132 		$(DESTDIR)$(LIBDEST)
   1133 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
   1134 		$(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
   1135 		-d $(LIBDEST)/site-packages -f \
   1136 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
   1137 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   1138 		$(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
   1139 		-d $(LIBDEST)/site-packages -f \
   1140 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
   1141 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   1142 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
   1143 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   1144 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
   1145 
   1146 # Create the PLATDIR source directory, if one wasn't distributed..
   1147 $(srcdir)/Lib/$(PLATDIR):
   1148 	mkdir $(srcdir)/Lib/$(PLATDIR)
   1149 	cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
   1150 	export PATH; PATH="`pwd`:$$PATH"; \
   1151 	export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \
   1152 	export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
   1153 	export EXE; EXE="$(BUILDEXE)"; \
   1154 	if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
   1155 	export PYTHON_FOR_BUILD; \
   1156 	if [ "$(build)" = "$(host)" ]; then \
   1157 	  PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
   1158 	else \
   1159 	  PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
   1160 	fi; \
   1161 	cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
   1162 
   1163 python-config: $(srcdir)/Misc/python-config.in
   1164 	# Substitution happens here, as the completely-expanded BINDIR
   1165 	# is not available in configure
   1166 	sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
   1167 
   1168 # Install the include files
   1169 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
   1170 inclinstall:
   1171 	@for i in $(INCLDIRSTOMAKE); \
   1172 	do \
   1173 		if test ! -d $(DESTDIR)$$i; then \
   1174 			echo "Creating directory $$i"; \
   1175 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
   1176 		else	true; \
   1177 		fi; \
   1178 	done
   1179 	@for i in $(srcdir)/Include/*.h; \
   1180 	do \
   1181 		echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
   1182 		$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
   1183 	done
   1184 	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
   1185 
   1186 # Install the library and miscellaneous stuff needed for extending/embedding
   1187 # This goes into $(exec_prefix)
   1188 LIBPL=		$(LIBP)/config
   1189 
   1190 # pkgconfig directory
   1191 LIBPC=		$(LIBDIR)/pkgconfig
   1192 
   1193 libainstall:	all python-config
   1194 	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
   1195 	do \
   1196 		if test ! -d $(DESTDIR)$$i; then \
   1197 			echo "Creating directory $$i"; \
   1198 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
   1199 		else	true; \
   1200 		fi; \
   1201 	done
   1202 	@if test -d $(LIBRARY); then :; else \
   1203 		if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
   1204 			if test "$(SO)" = .dll; then \
   1205 				$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
   1206 			else \
   1207 				$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
   1208 				$(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
   1209 			fi; \
   1210 		else \
   1211 			echo Skip install of $(LIBRARY) - use make frameworkinstall; \
   1212 		fi; \
   1213 	fi
   1214 	$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
   1215 	$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
   1216 	$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
   1217 	$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
   1218 	$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
   1219 	$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
   1220 	$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
   1221 	$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
   1222 	$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
   1223 	$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
   1224 	$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
   1225 	rm python-config
   1226 	@if [ -s Modules/python.exp -a \
   1227 		"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
   1228 		echo; echo "Installing support files for building shared extension modules on AIX:"; \
   1229 		$(INSTALL_DATA) Modules/python.exp		\
   1230 				$(DESTDIR)$(LIBPL)/python.exp;		\
   1231 		echo; echo "$(LIBPL)/python.exp";		\
   1232 		$(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix	\
   1233 				$(DESTDIR)$(LIBPL)/makexp_aix;		\
   1234 		echo "$(LIBPL)/makexp_aix";			\
   1235 		$(INSTALL_SCRIPT) Modules/ld_so_aix	\
   1236 				$(DESTDIR)$(LIBPL)/ld_so_aix;		\
   1237 		echo "$(LIBPL)/ld_so_aix";			\
   1238 		echo; echo "See Misc/AIX-NOTES for details.";	\
   1239 	else true; \
   1240 	fi
   1241 	@case "$(MACHDEP)" in beos*) \
   1242 		echo; echo "Installing support files for building shared extension modules on BeOS:"; \
   1243 		$(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;	\
   1244 		echo; echo "$(LIBPL)/README";			\
   1245 		$(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
   1246 		echo "$(LIBPL)/ar_beos";			\
   1247 		$(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
   1248 		echo "$(LIBPL)/ld_so_beos";			\
   1249 		echo; echo "See Misc/BeOS-NOTES for details.";	\
   1250 		;; \
   1251 	esac
   1252 
   1253 # Install the dynamically loadable modules
   1254 # This goes into $(exec_prefix)
   1255 sharedinstall: sharedmods
   1256 	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
   1257 	   	--prefix=$(prefix) \
   1258 		--install-scripts=$(BINDIR) \
   1259 		--install-platlib=$(DESTSHARED) \
   1260 		--root=$(DESTDIR)/
   1261 	-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py*
   1262 
   1263 # Here are a couple of targets for MacOSX again, to install a full
   1264 # framework-based Python. frameworkinstall installs everything, the
   1265 # subtargets install specific parts. Much of the actual work is offloaded to
   1266 # the Makefile in Mac
   1267 #
   1268 #
   1269 # This target is here for backward compatibility, previous versions of Python
   1270 # hadn't integrated framework installation in the normal install process.
   1271 frameworkinstall: install
   1272 
   1273 # On install, we re-make the framework
   1274 # structure in the install location, /Library/Frameworks/ or the argument to
   1275 # --enable-framework. If --enable-framework has been specified then we have
   1276 # automatically set prefix to the location deep down in the framework, so we
   1277 # only have to cater for the structural bits of the framework.
   1278 
   1279 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
   1280 
   1281 frameworkinstallstructure:	$(LDLIBRARY)
   1282 	@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
   1283 		echo Not configured with --enable-framework; \
   1284 		exit 1; \
   1285 	else true; \
   1286 	fi
   1287 	@for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
   1288 		if test ! -d $(DESTDIR)$$i; then \
   1289 			echo "Creating directory $(DESTDIR)$$i"; \
   1290 			$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
   1291 		else	true; \
   1292 		fi; \
   1293 	done
   1294 	$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
   1295 	sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
   1296 	$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
   1297 	$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
   1298 	$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
   1299 	$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
   1300 	$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
   1301 
   1302 # This installs Mac/Lib into the framework
   1303 # Install a number of symlinks to keep software that expects a normal unix
   1304 # install (which includes python-config) happy.
   1305 frameworkinstallmaclib:
   1306 	ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
   1307 	ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
   1308 	ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
   1309 	cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
   1310 
   1311 # This installs the IDE, the Launcher and other apps into /Applications
   1312 frameworkinstallapps:
   1313 	cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
   1314 
   1315 # This install the unix python and pythonw tools in /usr/local/bin
   1316 frameworkinstallunixtools:
   1317 	cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
   1318 
   1319 frameworkaltinstallunixtools:
   1320 	cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
   1321 
   1322 # This installs the Demos and Tools into the applications directory.
   1323 # It is not part of a normal frameworkinstall
   1324 frameworkinstallextras:
   1325 	cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
   1326 
   1327 # This installs a few of the useful scripts in Tools/scripts
   1328 scriptsinstall:
   1329 	SRCDIR=$(srcdir) $(RUNSHARED) \
   1330 	$(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
   1331 	--prefix=$(prefix) \
   1332 	--install-scripts=$(BINDIR) \
   1333 	--root=$(DESTDIR)/
   1334 
   1335 # Build the toplevel Makefile
   1336 Makefile.pre: Makefile.pre.in config.status
   1337 	CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
   1338 	$(MAKE) -f Makefile.pre Makefile
   1339 
   1340 # Run the configure script.
   1341 config.status:	$(srcdir)/configure
   1342 	$(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
   1343 
   1344 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
   1345 
   1346 # Some make's put the object file in the current directory
   1347 .c.o:
   1348 	$(CC) -c $(PY_CFLAGS) -o $@ $<
   1349 
   1350 # Run reindent on the library
   1351 reindent:
   1352 	./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
   1353 
   1354 # Rerun configure with the same options as it was run last time,
   1355 # provided the config.status script exists
   1356 recheck:
   1357 	$(SHELL) config.status --recheck
   1358 	$(SHELL) config.status
   1359 
   1360 # Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
   1361 autoconf:
   1362 	(cd $(srcdir); autoconf)
   1363 	(cd $(srcdir); autoheader)
   1364 
   1365 # Create a tags file for vi
   1366 tags::
   1367 	cd $(srcdir); \
   1368 	ctags -w -t Include/*.h; \
   1369 	for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
   1370 	done; \
   1371 	sort -o tags tags
   1372 
   1373 # Create a tags file for GNU Emacs
   1374 TAGS::
   1375 	cd $(srcdir); \
   1376 	etags Include/*.h; \
   1377 	for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
   1378 
   1379 # Touch generated files
   1380 touch:
   1381 	cd $(srcdir); \
   1382 	touch Include/Python-ast.h Python/Python-ast.c
   1383 
   1384 # Sanitation targets -- clean leaves libraries, executables and tags
   1385 # files, which clobber removes as well
   1386 pycremoval:
   1387 	find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
   1388 
   1389 clean: pycremoval
   1390 	find . -name '*.[oa]' -exec rm -f {} ';'
   1391 	find . -name '*.s[ol]' -exec rm -f {} ';'
   1392 	find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
   1393 	find build -name 'fficonfig.h' -exec rm -f {} ';' || true
   1394 	find build -name 'fficonfig.py' -exec rm -f {} ';' || true
   1395 	-rm -f Lib/lib2to3/*Grammar*.pickle
   1396 	-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
   1397 
   1398 profile-removal:
   1399 	find . -name '*.gc??' -exec rm -f {} ';'
   1400 	find . -name '*.profclang?' -exec rm -f {} ';'
   1401 	find . -name '*.dyn' -exec rm -f {} ';'
   1402 
   1403 clobber: clean profile-removal
   1404 	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
   1405 		tags TAGS \
   1406 		config.cache config.log pyconfig.h Modules/config.c
   1407 	-rm -rf build platform
   1408 	-rm -rf $(PYTHONFRAMEWORKDIR)
   1409 
   1410 # Make things extra clean, before making a distribution:
   1411 # remove all generated files, even Makefile[.pre]
   1412 # Keep configure and Python-ast.[ch], it's possible they can't be generated
   1413 distclean: clobber
   1414 	for file in Lib/test/data/* ; do \
   1415 	    if test "$$file" != "Lib/test/data/README"; then rm "$$file"; fi; \
   1416 	done
   1417 	-rm -f core Makefile Makefile.pre config.status \
   1418 		Modules/Setup Modules/Setup.local Modules/Setup.config \
   1419 		Modules/ld_so_aix Modules/python.exp Misc/python.pc
   1420 	-rm -f python*-gdb.py
   1421 	-rm -f pybuilddir.txt
   1422 	# Issue #28258: set LC_ALL to avoid issues with Estonian locale.
   1423 	# Expansion is performed here by shell (spawned by make) itself before
   1424 	# arguments are passed to find. So LC_ALL=C must be set as a separate
   1425 	# command.
   1426 	LC_ALL=C; find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
   1427 				     -o -name '[@,#]*' -o -name '*.old' \
   1428 				     -o -name '*.orig' -o -name '*.rej' \
   1429 				     -o -name '*.bak' ')' \
   1430 				     -exec rm -f {} ';'
   1431 
   1432 # Check for smelly exported symbols (not starting with Py/_Py)
   1433 smelly: all
   1434 	nm -p $(LIBRARY) | \
   1435 		sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
   1436 
   1437 # Find files with funny names
   1438 funny:
   1439 	find $(SUBDIRS) $(SUBDIRSTOO) -type d \
   1440 		-o -name '*.[chs]' \
   1441 		-o -name '*.py' \
   1442 		-o -name '*.doc' \
   1443 		-o -name '*.sty' \
   1444 		-o -name '*.bib' \
   1445 		-o -name '*.dat' \
   1446 		-o -name '*.el' \
   1447 		-o -name '*.fd' \
   1448 		-o -name '*.in' \
   1449 		-o -name '*.tex' \
   1450 		-o -name '*,[vpt]' \
   1451 		-o -name 'Setup' \
   1452 		-o -name 'Setup.*' \
   1453 		-o -name README \
   1454 		-o -name Makefile \
   1455 		-o -name ChangeLog \
   1456 		-o -name Repository \
   1457 		-o -name Root \
   1458 		-o -name Entries \
   1459 		-o -name Tag \
   1460 		-o -name tags \
   1461 		-o -name TAGS \
   1462 		-o -name .cvsignore \
   1463 		-o -name MANIFEST \
   1464 		-o -print
   1465 
   1466 # Perform some verification checks on any modified files.
   1467 patchcheck:
   1468 	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
   1469 
   1470 # Dependencies
   1471 
   1472 Python/thread.o: @THREADHEADERS@
   1473 
   1474 # Declare targets that aren't real files
   1475 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
   1476 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
   1477 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
   1478 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
   1479 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
   1480 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
   1481 .PHONY: smelly funny patchcheck touch altmaninstall commoninstall
   1482 .PHONY: gdbhooks
   1483 
   1484 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
   1485