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 MODNAMES= _MODNAMES_ 24 MODOBJS= _MODOBJS_ 25 MODLIBS= _MODLIBS_ 26 27 # === Variables set by configure 28 VERSION= @VERSION@ 29 srcdir= @srcdir@ 30 VPATH= @srcdir@ 31 abs_srcdir= @abs_srcdir@ 32 abs_builddir= @abs_builddir@ 33 34 35 CC= @CC@ 36 CXX= @CXX@ 37 MAINCC= @MAINCC@ 38 LINKCC= @LINKCC@ 39 AR= @AR@ 40 RANLIB= @RANLIB@ 41 READELF= @READELF@ 42 SOABI= @SOABI@ 43 LDVERSION= @LDVERSION@ 44 GITVERSION= @GITVERSION@ 45 GITTAG= @GITTAG@ 46 GITBRANCH= @GITBRANCH@ 47 PGO_PROF_GEN_FLAG=@PGO_PROF_GEN_FLAG@ 48 PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@ 49 LLVM_PROF_MERGER=@LLVM_PROF_MERGER@ 50 LLVM_PROF_FILE=@LLVM_PROF_FILE@ 51 LLVM_PROF_ERR=@LLVM_PROF_ERR@ 52 DTRACE= @DTRACE@ 53 DFLAGS= @DFLAGS@ 54 DTRACE_HEADERS= @DTRACE_HEADERS@ 55 DTRACE_OBJS= @DTRACE_OBJS@ 56 57 GNULD= @GNULD@ 58 59 # Shell used by make (some versions default to the login shell, which is bad) 60 SHELL= /bin/sh 61 62 # Use this to make a link between python$(VERSION) and python in $(BINDIR) 63 LN= @LN@ 64 65 # Portable install script (configure doesn't always guess right) 66 INSTALL= @INSTALL@ 67 INSTALL_PROGRAM=@INSTALL_PROGRAM@ 68 INSTALL_SCRIPT= @INSTALL_SCRIPT@ 69 INSTALL_DATA= @INSTALL_DATA@ 70 # Shared libraries must be installed with executable mode on some systems; 71 # rather than figuring out exactly which, we always give them executable mode. 72 # Also, making them read-only seems to be a good idea... 73 INSTALL_SHARED= ${INSTALL} -m 555 74 75 MKDIR_P= @MKDIR_P@ 76 77 MAKESETUP= $(srcdir)/Modules/makesetup 78 79 # Compiler options 80 OPT= @OPT@ 81 BASECFLAGS= @BASECFLAGS@ 82 BASECPPFLAGS= @BASECPPFLAGS@ 83 CONFIGURE_CFLAGS= @CFLAGS@ 84 # CFLAGS_NODIST is used for building the interpreter and stdlib C extensions. 85 # Use it when a compiler flag should _not_ be part of the distutils CFLAGS 86 # once Python is installed (Issue #21121). 87 CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@ 88 CONFIGURE_CPPFLAGS= @CPPFLAGS@ 89 CONFIGURE_LDFLAGS= @LDFLAGS@ 90 # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the 91 # command line to append to these values without stomping the pre-set 92 # values. 93 PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) 94 PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) 95 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to 96 # be able to build extension modules using the directories specified in the 97 # environment variables 98 PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS) 99 PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS) 100 NO_AS_NEEDED= @NO_AS_NEEDED@ 101 LDLAST= @LDLAST@ 102 SGI_ABI= @SGI_ABI@ 103 CCSHARED= @CCSHARED@ 104 LINKFORSHARED= @LINKFORSHARED@ 105 ARFLAGS= @ARFLAGS@ 106 # Extra C flags added for building the interpreter object files. 107 CFLAGSFORSHARED=@CFLAGSFORSHARED@ 108 # C flags used for building the interpreter object files 109 PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE 110 111 112 # Machine-dependent subdirectories 113 MACHDEP= @MACHDEP@ 114 115 # Multiarch directory (may be empty) 116 MULTIARCH= @MULTIARCH@ 117 MULTIARCH_CPPFLAGS = @MULTIARCH_CPPFLAGS@ 118 119 # Install prefix for architecture-independent files 120 prefix= @prefix@ 121 122 # Install prefix for architecture-dependent files 123 exec_prefix= @exec_prefix@ 124 125 # Install prefix for data files 126 datarootdir= @datarootdir@ 127 128 # Expanded directories 129 BINDIR= @bindir@ 130 LIBDIR= @libdir@ 131 MANDIR= @mandir@ 132 INCLUDEDIR= @includedir@ 133 CONFINCLUDEDIR= $(exec_prefix)/include 134 SCRIPTDIR= $(prefix)/lib 135 ABIFLAGS= @ABIFLAGS@ 136 137 # Detailed destination directories 138 BINLIBDEST= $(LIBDIR)/python$(VERSION) 139 LIBDEST= $(SCRIPTDIR)/python$(VERSION) 140 INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION) 141 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) 142 143 # Symbols used for using shared libraries 144 SHLIB_SUFFIX= @SHLIB_SUFFIX@ 145 EXT_SUFFIX= @EXT_SUFFIX@ 146 LDSHARED= @LDSHARED@ $(PY_LDFLAGS) 147 BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) 148 LDCXXSHARED= @LDCXXSHARED@ 149 DESTSHARED= $(BINLIBDEST)/lib-dynload 150 151 # Executable suffix (.exe on Windows and Mac OS X) 152 EXE= @EXEEXT@ 153 BUILDEXE= @BUILDEXEEXT@ 154 155 # Short name and location for Mac OS X Python framework 156 UNIVERSALSDK=@UNIVERSALSDK@ 157 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@ 158 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@ 159 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@ 160 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@ 161 # Deployment target selected during configure, to be checked 162 # by distutils. The export statement is needed to ensure that the 163 # deployment target is active during build. 164 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 165 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET 166 167 # Option to install to strip binaries 168 STRIPFLAG=-s 169 170 # Flags to lipo to produce a 32-bit-only universal executable 171 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@ 172 173 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3) 174 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@ 175 176 # Environment to run shared python without installed libraries 177 RUNSHARED= @RUNSHARED@ 178 179 # ensurepip options 180 ENSUREPIP= @ENSUREPIP@ 181 182 # Modes for directories, executables and data files created by the 183 # install process. Default to user-only-writable for all file types. 184 DIRMODE= 755 185 EXEMODE= 755 186 FILEMODE= 644 187 188 # configure script arguments 189 CONFIG_ARGS= @CONFIG_ARGS@ 190 191 192 # Subdirectories with code 193 SRCDIRS= @SRCDIRS@ 194 195 # Other subdirectories 196 SUBDIRSTOO= Include Lib Misc 197 198 # Files and directories to be distributed 199 CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in 200 DISTFILES= README ChangeLog $(CONFIGFILES) 201 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy 202 DIST= $(DISTFILES) $(DISTDIRS) 203 204 205 LIBRARY= @LIBRARY@ 206 LDLIBRARY= @LDLIBRARY@ 207 BLDLIBRARY= @BLDLIBRARY@ 208 PY3LIBRARY= @PY3LIBRARY@ 209 DLLLIBRARY= @DLLLIBRARY@ 210 LDLIBRARYDIR= @LDLIBRARYDIR@ 211 INSTSONAME= @INSTSONAME@ 212 213 214 LIBS= @LIBS@ 215 LIBM= @LIBM@ 216 LIBC= @LIBC@ 217 SYSLIBS= $(LIBM) $(LIBC) 218 SHLIBS= @SHLIBS@ 219 220 THREADOBJ= @THREADOBJ@ 221 DLINCLDIR= @DLINCLDIR@ 222 DYNLOADFILE= @DYNLOADFILE@ 223 MACHDEP_OBJS= @MACHDEP_OBJS@ 224 LIBOBJDIR= Python/ 225 LIBOBJS= @LIBOBJS@ 226 227 PYTHON= python$(EXE) 228 BUILDPYTHON= python$(BUILDEXE) 229 230 PYTHON_FOR_GEN=@PYTHON_FOR_GEN@ 231 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ 232 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ 233 BUILD_GNU_TYPE= @build@ 234 HOST_GNU_TYPE= @host@ 235 236 # Tcl and Tk config info from --with-tcltk-includes and -libs options 237 TCLTK_INCLUDES= @TCLTK_INCLUDES@ 238 TCLTK_LIBS= @TCLTK_LIBS@ 239 240 # The task to run while instrumented when building the profile-opt target. 241 # We exclude unittests with -x that take a rediculious amount of time to 242 # run in the instrumented training build or do not provide much value. 243 PROFILE_TASK=-m test.regrtest --pgo 244 245 # report files for gcov / lcov coverage report 246 COVERAGE_INFO= $(abs_builddir)/coverage.info 247 COVERAGE_REPORT=$(abs_builddir)/lcov-report 248 COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report" 249 250 251 # === Definitions added by makesetup === 252 253 254 ########################################################################## 255 # Modules 256 MODULE_OBJS= \ 257 Modules/config.o \ 258 Modules/getpath.o \ 259 Modules/main.o \ 260 Modules/gcmodule.o 261 262 IO_H= Modules/_io/_iomodule.h 263 264 IO_OBJS= \ 265 Modules/_io/_iomodule.o \ 266 Modules/_io/iobase.o \ 267 Modules/_io/fileio.o \ 268 Modules/_io/bufferedio.o \ 269 Modules/_io/textio.o \ 270 Modules/_io/bytesio.o \ 271 Modules/_io/stringio.o 272 273 ########################################################################## 274 # Grammar 275 GRAMMAR_H= Include/graminit.h 276 GRAMMAR_C= Python/graminit.c 277 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar 278 279 280 LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ 281 282 ########################################################################## 283 # Parser 284 PGEN= Parser/pgen$(EXE) 285 286 POBJS= \ 287 Parser/acceler.o \ 288 Parser/grammar1.o \ 289 Parser/listnode.o \ 290 Parser/node.o \ 291 Parser/parser.o \ 292 Parser/bitset.o \ 293 Parser/metagrammar.o \ 294 Parser/firstsets.o \ 295 Parser/grammar.o \ 296 Parser/pgen.o 297 298 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o 299 300 PGOBJS= \ 301 Objects/obmalloc.o \ 302 Python/dynamic_annotations.o \ 303 Python/mysnprintf.o \ 304 Python/pyctype.o \ 305 Parser/tokenizer_pgen.o \ 306 Parser/printgrammar.o \ 307 Parser/parsetok_pgen.o \ 308 Parser/pgenmain.o 309 310 PARSER_HEADERS= \ 311 $(srcdir)/Parser/parser.h \ 312 $(srcdir)/Include/parsetok.h \ 313 $(srcdir)/Parser/tokenizer.h 314 315 PGENOBJS= $(POBJS) $(PGOBJS) 316 317 ########################################################################## 318 # opcode.h generation 319 OPCODE_H_DIR= $(srcdir)/Include 320 OPCODE_H_SCRIPT= $(srcdir)/Tools/scripts/generate_opcode_h.py 321 OPCODE_H= $(OPCODE_H_DIR)/opcode.h 322 OPCODE_H_GEN= $(PYTHON_FOR_GEN) $(OPCODE_H_SCRIPT) $(srcdir)/Lib/opcode.py $(OPCODE_H) 323 324 ########################################################################## 325 # AST 326 AST_H_DIR= Include 327 AST_H= $(AST_H_DIR)/Python-ast.h 328 AST_C_DIR= Python 329 AST_C= $(AST_C_DIR)/Python-ast.c 330 AST_ASDL= $(srcdir)/Parser/Python.asdl 331 332 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py 333 # Note that a build now requires Python to exist before the build starts. 334 # Use "hg touch" to fix up screwed up file mtimes in a checkout. 335 ASDLGEN= $(PYTHON_FOR_GEN) $(srcdir)/Parser/asdl_c.py 336 337 ########################################################################## 338 # Python 339 340 OPCODETARGETS_H= \ 341 Python/opcode_targets.h 342 343 OPCODETARGETGEN= \ 344 $(srcdir)/Python/makeopcodetargets.py 345 346 OPCODETARGETGEN_FILES= \ 347 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py 348 349 PYTHON_OBJS= \ 350 Python/_warnings.o \ 351 Python/Python-ast.o \ 352 Python/asdl.o \ 353 Python/ast.o \ 354 Python/bltinmodule.o \ 355 Python/ceval.o \ 356 Python/compile.o \ 357 Python/codecs.o \ 358 Python/dynamic_annotations.o \ 359 Python/errors.o \ 360 Python/frozenmain.o \ 361 Python/future.o \ 362 Python/getargs.o \ 363 Python/getcompiler.o \ 364 Python/getcopyright.o \ 365 Python/getplatform.o \ 366 Python/getversion.o \ 367 Python/graminit.o \ 368 Python/import.o \ 369 Python/importdl.o \ 370 Python/marshal.o \ 371 Python/modsupport.o \ 372 Python/mystrtoul.o \ 373 Python/mysnprintf.o \ 374 Python/peephole.o \ 375 Python/pyarena.o \ 376 Python/pyctype.o \ 377 Python/pyfpe.o \ 378 Python/pyhash.o \ 379 Python/pylifecycle.o \ 380 Python/pymath.o \ 381 Python/pystate.o \ 382 Python/pythonrun.o \ 383 Python/pytime.o \ 384 Python/random.o \ 385 Python/structmember.o \ 386 Python/symtable.o \ 387 Python/sysmodule.o \ 388 Python/traceback.o \ 389 Python/getopt.o \ 390 Python/pystrcmp.o \ 391 Python/pystrtod.o \ 392 Python/pystrhex.o \ 393 Python/dtoa.o \ 394 Python/formatter_unicode.o \ 395 Python/fileutils.o \ 396 Python/$(DYNLOADFILE) \ 397 $(LIBOBJS) \ 398 $(MACHDEP_OBJS) \ 399 $(THREADOBJ) \ 400 $(DTRACE_OBJS) 401 402 403 ########################################################################## 404 # Objects 405 OBJECT_OBJS= \ 406 Objects/abstract.o \ 407 Objects/accu.o \ 408 Objects/boolobject.o \ 409 Objects/bytes_methods.o \ 410 Objects/bytearrayobject.o \ 411 Objects/bytesobject.o \ 412 Objects/cellobject.o \ 413 Objects/classobject.o \ 414 Objects/codeobject.o \ 415 Objects/complexobject.o \ 416 Objects/descrobject.o \ 417 Objects/enumobject.o \ 418 Objects/exceptions.o \ 419 Objects/genobject.o \ 420 Objects/fileobject.o \ 421 Objects/floatobject.o \ 422 Objects/frameobject.o \ 423 Objects/funcobject.o \ 424 Objects/iterobject.o \ 425 Objects/listobject.o \ 426 Objects/longobject.o \ 427 Objects/dictobject.o \ 428 Objects/odictobject.o \ 429 Objects/memoryobject.o \ 430 Objects/methodobject.o \ 431 Objects/moduleobject.o \ 432 Objects/namespaceobject.o \ 433 Objects/object.o \ 434 Objects/obmalloc.o \ 435 Objects/capsule.o \ 436 Objects/rangeobject.o \ 437 Objects/setobject.o \ 438 Objects/sliceobject.o \ 439 Objects/structseq.o \ 440 Objects/tupleobject.o \ 441 Objects/typeobject.o \ 442 Objects/unicodeobject.o \ 443 Objects/unicodectype.o \ 444 Objects/weakrefobject.o 445 446 ########################################################################## 447 # objects that get linked into the Python library 448 LIBRARY_OBJS_OMIT_FROZEN= \ 449 Modules/getbuildinfo.o \ 450 $(PARSER_OBJS) \ 451 $(OBJECT_OBJS) \ 452 $(PYTHON_OBJS) \ 453 $(MODULE_OBJS) \ 454 $(MODOBJS) 455 456 LIBRARY_OBJS= \ 457 $(LIBRARY_OBJS_OMIT_FROZEN) \ 458 Python/frozen.o 459 460 ########################################################################## 461 # DTrace 462 463 # On some systems, object files that reference DTrace probes need to be modified 464 # in-place by dtrace(1). 465 DTRACE_DEPS = \ 466 Python/ceval.o 467 # XXX: should gcmodule, etc. be here, too? 468 469 ######################################################################### 470 # Rules 471 472 # Default target 473 all: @DEF_MAKE_ALL_RULE@ 474 build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config 475 476 # Compile a binary with profile guided optimization. 477 profile-opt: 478 @if [ $(LLVM_PROF_ERR) = yes ]; then \ 479 echo "Error: Cannot perform PGO build because llvm-profdata was not found in PATH" ;\ 480 echo "Please add it to PATH and run ./configure again" ;\ 481 exit 1;\ 482 fi 483 @echo "Building with support for profile generation:" 484 $(MAKE) clean 485 $(MAKE) profile-removal 486 $(MAKE) build_all_generate_profile 487 $(MAKE) profile-removal 488 @echo "Running code to generate profile data (this can take a while):" 489 $(MAKE) run_profile_task 490 $(MAKE) build_all_merge_profile 491 @echo "Rebuilding with profile guided optimizations:" 492 $(MAKE) clean 493 $(MAKE) build_all_use_profile 494 $(MAKE) profile-removal 495 496 build_all_generate_profile: 497 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)" 498 499 run_profile_task: 500 : # FIXME: can't run for a cross build 501 $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true 502 503 build_all_merge_profile: 504 $(LLVM_PROF_MERGER) 505 506 build_all_use_profile: 507 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@" 508 509 # Compile and run with gcov 510 .PHONY=coverage coverage-lcov coverage-report 511 coverage: 512 @echo "Building with support for coverage checking:" 513 $(MAKE) clean profile-removal 514 $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" 515 516 coverage-lcov: 517 @echo "Creating Coverage HTML report with LCOV:" 518 @rm -f $(COVERAGE_INFO) 519 @rm -rf $(COVERAGE_REPORT) 520 @lcov --capture --directory $(abs_builddir) \ 521 --base-directory $(realpath $(abs_builddir)) \ 522 --path $(realpath $(abs_srcdir)) \ 523 --output-file $(COVERAGE_INFO) 524 : # remove 3rd party modules, system headers and internal files with 525 : # debug, test or dummy functions. 526 @lcov --remove $(COVERAGE_INFO) \ 527 '*/Modules/_blake2/impl/*' \ 528 '*/Modules/_ctypes/libffi*/*' \ 529 '*/Modules/_decimal/libmpdec/*' \ 530 '*/Modules/_sha3/kcp/*' \ 531 '*/Modules/expat/*' \ 532 '*/Modules/zlib/*' \ 533 '*/Include/*' \ 534 '*/Modules/xx*.c' \ 535 '*/Parser/listnode.c' \ 536 '*/Python/pyfpe.c' \ 537 '*/Python/pystrcmp.c' \ 538 '/usr/include/*' \ 539 '/usr/local/include/*' \ 540 '/usr/lib/gcc/*' \ 541 --output-file $(COVERAGE_INFO) 542 @genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \ 543 $(COVERAGE_REPORT_OPTIONS) 544 @echo 545 @echo "lcov report at $(COVERAGE_REPORT)/index.html" 546 @echo 547 548 coverage-report: 549 : # force rebuilding of parser and importlib 550 @touch $(GRAMMAR_INPUT) 551 @touch $(srcdir)/Lib/importlib/_bootstrap.py 552 @touch $(srcdir)/Lib/importlib/_bootstrap_external.py 553 : # build with coverage info 554 $(MAKE) coverage 555 : # run tests, ignore failures 556 $(TESTRUNNER) $(TESTOPTS) || true 557 : # build lcov report 558 $(MAKE) coverage-lcov 559 560 # Run "Argument Clinic" over all source files 561 # (depends on python having already been built) 562 .PHONY=clinic 563 clinic: $(BUILDPYTHON) $(srcdir)/Modules/_blake2/blake2s_impl.c 564 $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make 565 566 # Build the interpreter 567 $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) 568 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) 569 570 platform: $(BUILDPYTHON) pybuilddir.txt 571 $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform 572 573 # Create build directory and generate the sysconfig build-time data there. 574 # pybuilddir.txt contains the name of the build dir and is used for 575 # sys.path fixup -- see Modules/getpath.c. 576 # Since this step runs before shared modules are built, try to avoid bootstrap 577 # problems by creating a dummy pybuilddir.txt just to allow interpreter 578 # initialization to succeed. It will be overwritten by generate-posix-vars 579 # or removed in case of failure. 580 pybuilddir.txt: $(BUILDPYTHON) 581 @echo "none" > ./pybuilddir.txt 582 $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ 583 if test $$? -ne 0 ; then \ 584 echo "generate-posix-vars failed" ; \ 585 rm -f ./pybuilddir.txt ; \ 586 exit 1 ; \ 587 fi 588 589 # This is shared by the math and cmath modules 590 Modules/_math.o: Modules/_math.c Modules/_math.h 591 $(CC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $< 592 593 # blake2s is auto-generated from blake2b 594 $(srcdir)/Modules/_blake2/blake2s_impl.c: $(BUILDPYTHON) $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py 595 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Modules/_blake2/blake2b2s.py 596 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/clinic/clinic.py -f $@ 597 598 # Build the shared modules 599 # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for 600 # -s, --silent or --quiet is always the first char. 601 # Under BSD make, MAKEFLAGS might be " -s -v x=y". 602 sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o 603 @case "$$MAKEFLAGS" in \ 604 *\ -s*|s*) quiet="-q";; \ 605 *) quiet="";; \ 606 esac; \ 607 $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ 608 _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ 609 $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build 610 611 612 # Build static library 613 # avoid long command lines, same as LIBRARY_OBJS 614 $(LIBRARY): $(LIBRARY_OBJS) 615 -rm -f $@ 616 $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o 617 $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) 618 $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) 619 $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o 620 $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) 621 $(AR) $(ARFLAGS) $@ $(MODOBJS) 622 $(RANLIB) $@ 623 624 libpython$(LDVERSION).so: $(LIBRARY_OBJS) 625 if test $(INSTSONAME) != $(LDLIBRARY); then \ 626 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ 627 $(LN) -f $(INSTSONAME) $@; \ 628 else \ 629 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ 630 fi 631 632 libpython3.so: libpython$(LDVERSION).so 633 $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ 634 635 libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) 636 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ 637 638 639 libpython$(VERSION).sl: $(LIBRARY_OBJS) 640 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST) 641 642 # Copy up the gdb python hooks into a position where they can be automatically 643 # loaded by gdb during Lib/test/test_gdb.py 644 # 645 # Distributors are likely to want to install this somewhere else e.g. relative 646 # to the stripped DWARF data for the shared library. 647 gdbhooks: $(BUILDPYTHON)-gdb.py 648 649 SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py 650 $(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS) 651 $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py 652 653 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary 654 # minimal framework (not including the Lib directory and such) in the current 655 # directory. 656 RESSRCDIR=Mac/Resources/framework 657 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \ 658 $(LIBRARY) \ 659 $(RESSRCDIR)/Info.plist 660 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) 661 $(CC) -o $(LDLIBRARY) $(PY_LDFLAGS) -dynamiclib \ 662 -all_load $(LIBRARY) -Wl,-single_module \ 663 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \ 664 -compatibility_version $(VERSION) \ 665 -current_version $(VERSION) \ 666 -framework CoreFoundation $(LIBS); 667 $(INSTALL) -d -m $(DIRMODE) \ 668 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj 669 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \ 670 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist 671 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current 672 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK) 673 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources 674 675 # This rule builds the Cygwin Python DLL and import library if configured 676 # for a shared core library; otherwise, this rule is a noop. 677 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS) 678 if test -n "$(DLLLIBRARY)"; then \ 679 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ 680 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \ 681 else true; \ 682 fi 683 684 685 oldsharedmods: $(SHAREDMODS) 686 687 688 Makefile Modules/config.c: Makefile.pre \ 689 $(srcdir)/Modules/config.c.in \ 690 $(MAKESETUP) \ 691 Modules/Setup.config \ 692 Modules/Setup \ 693 Modules/Setup.local 694 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ 695 -s Modules \ 696 Modules/Setup.config \ 697 Modules/Setup.local \ 698 Modules/Setup 699 @mv config.c Modules 700 @echo "The Makefile was updated, you may need to re-run make." 701 702 703 Modules/Setup: $(srcdir)/Modules/Setup.dist 704 @if test -f Modules/Setup; then \ 705 echo "-----------------------------------------------"; \ 706 echo "Modules/Setup.dist is newer than Modules/Setup;"; \ 707 echo "check to make sure you have all the updates you"; \ 708 echo "need in your Modules/Setup file."; \ 709 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \ 710 echo "-----------------------------------------------"; \ 711 fi 712 713 Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) 714 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) 715 716 ############################################################################ 717 # Importlib 718 719 Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile 720 721 Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) 722 $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) 723 724 Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib Python/marshal.c 725 ./Programs/_freeze_importlib \ 726 $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h 727 728 Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib Python/marshal.c 729 ./Programs/_freeze_importlib \ 730 $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h 731 732 733 ############################################################################ 734 # Special rules for object files 735 736 Modules/getbuildinfo.o: $(PARSER_OBJS) \ 737 $(OBJECT_OBJS) \ 738 $(PYTHON_OBJS) \ 739 $(MODULE_OBJS) \ 740 $(MODOBJS) \ 741 $(srcdir)/Modules/getbuildinfo.c 742 $(CC) -c $(PY_CORE_CFLAGS) \ 743 -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \ 744 -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \ 745 -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \ 746 -o $@ $(srcdir)/Modules/getbuildinfo.c 747 748 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile 749 $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ 750 -DPREFIX='"$(prefix)"' \ 751 -DEXEC_PREFIX='"$(exec_prefix)"' \ 752 -DVERSION='"$(VERSION)"' \ 753 -DVPATH='"$(VPATH)"' \ 754 -o $@ $(srcdir)/Modules/getpath.c 755 756 Programs/python.o: $(srcdir)/Programs/python.c 757 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c 758 759 Programs/_testembed.o: $(srcdir)/Programs/_testembed.c 760 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c 761 762 Modules/_sre.o: $(srcdir)/Modules/_sre.c $(srcdir)/Modules/sre.h $(srcdir)/Modules/sre_constants.h $(srcdir)/Modules/sre_lib.h 763 764 Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h 765 766 Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h 767 768 Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h 769 770 Modules/signalmodule.o: $(srcdir)/Modules/signalmodule.c $(srcdir)/Modules/posixmodule.h 771 772 Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile 773 $(CC) -c $(PY_CORE_CFLAGS) \ 774 -DSOABI='"$(SOABI)"' \ 775 -o $@ $(srcdir)/Python/dynload_shlib.c 776 777 Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile 778 $(CC) -c $(PY_CORE_CFLAGS) \ 779 -DSHLIB_EXT='"$(EXT_SUFFIX)"' \ 780 -o $@ $(srcdir)/Python/dynload_hpux.c 781 782 Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile 783 $(CC) -c $(PY_CORE_CFLAGS) \ 784 -DABIFLAGS='"$(ABIFLAGS)"' \ 785 $(MULTIARCH_CPPFLAGS) \ 786 -o $@ $(srcdir)/Python/sysmodule.c 787 788 $(IO_OBJS): $(IO_H) 789 790 $(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN) 791 @$(MKDIR_P) Include 792 $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) 793 $(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H) 794 touch $(GRAMMAR_C) 795 796 $(PGEN): $(PGENOBJS) 797 $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) 798 799 Parser/grammar.o: $(srcdir)/Parser/grammar.c \ 800 $(srcdir)/Include/token.h \ 801 $(srcdir)/Include/grammar.h 802 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c 803 804 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c 805 Parser/parsetok_pgen.o: $(srcdir)/Parser/parsetok.c 806 Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c 807 808 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h 809 810 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES) 811 $(MKDIR_P) $(AST_H_DIR) 812 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL) 813 814 $(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES) 815 $(MKDIR_P) $(AST_C_DIR) 816 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) 817 818 $(OPCODE_H): $(srcdir)/Lib/opcode.py $(OPCODE_H_SCRIPT) 819 $(OPCODE_H_GEN) 820 821 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) 822 823 Python/getplatform.o: $(srcdir)/Python/getplatform.c 824 $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c 825 826 Python/importdl.o: $(srcdir)/Python/importdl.c 827 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c 828 829 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \ 830 $(srcdir)/Objects/unicodetype_db.h 831 832 BYTESTR_DEPS = \ 833 $(srcdir)/Objects/stringlib/count.h \ 834 $(srcdir)/Objects/stringlib/ctype.h \ 835 $(srcdir)/Objects/stringlib/fastsearch.h \ 836 $(srcdir)/Objects/stringlib/find.h \ 837 $(srcdir)/Objects/stringlib/join.h \ 838 $(srcdir)/Objects/stringlib/partition.h \ 839 $(srcdir)/Objects/stringlib/split.h \ 840 $(srcdir)/Objects/stringlib/stringdefs.h \ 841 $(srcdir)/Objects/stringlib/transmogrify.h 842 843 UNICODE_DEPS = \ 844 $(srcdir)/Objects/stringlib/asciilib.h \ 845 $(srcdir)/Objects/stringlib/codecs.h \ 846 $(srcdir)/Objects/stringlib/count.h \ 847 $(srcdir)/Objects/stringlib/fastsearch.h \ 848 $(srcdir)/Objects/stringlib/find.h \ 849 $(srcdir)/Objects/stringlib/find_max_char.h \ 850 $(srcdir)/Objects/stringlib/localeutil.h \ 851 $(srcdir)/Objects/stringlib/partition.h \ 852 $(srcdir)/Objects/stringlib/replace.h \ 853 $(srcdir)/Objects/stringlib/split.h \ 854 $(srcdir)/Objects/stringlib/ucs1lib.h \ 855 $(srcdir)/Objects/stringlib/ucs2lib.h \ 856 $(srcdir)/Objects/stringlib/ucs4lib.h \ 857 $(srcdir)/Objects/stringlib/undef.h \ 858 $(srcdir)/Objects/stringlib/unicode_format.h \ 859 $(srcdir)/Objects/stringlib/unicodedefs.h 860 861 Objects/bytes_methods.o: $(srcdir)/Objects/bytes_methods.c $(BYTESTR_DEPS) 862 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS) 863 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS) 864 865 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS) 866 867 Objects/odictobject.o: $(srcdir)/Objects/dict-common.h 868 Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h $(srcdir)/Objects/dict-common.h 869 Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h 870 871 $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES) 872 $(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H) 873 874 Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h 875 876 Python/frozen.o: Python/importlib.h Python/importlib_external.h 877 878 # Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to 879 # follow our naming conventions. dtrace(1) uses the output filename to generate 880 # an include guard, so we can't use a pipeline to transform its output. 881 Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d 882 $(DTRACE) $(DFLAGS) -o $@ -h -s $< 883 : sed in-place edit with POSIX-only tools 884 sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp 885 mv $@.tmp $@ 886 887 Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS) 888 $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS) 889 890 Objects/typeobject.o: Objects/typeslots.inc 891 Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py 892 $(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc 893 894 ############################################################################ 895 # Header files 896 897 PYTHON_HEADERS= \ 898 $(srcdir)/Include/Python.h \ 899 $(srcdir)/Include/abstract.h \ 900 $(srcdir)/Include/accu.h \ 901 $(srcdir)/Include/asdl.h \ 902 $(srcdir)/Include/ast.h \ 903 $(srcdir)/Include/bltinmodule.h \ 904 $(srcdir)/Include/bitset.h \ 905 $(srcdir)/Include/boolobject.h \ 906 $(srcdir)/Include/bytes_methods.h \ 907 $(srcdir)/Include/bytearrayobject.h \ 908 $(srcdir)/Include/bytesobject.h \ 909 $(srcdir)/Include/cellobject.h \ 910 $(srcdir)/Include/ceval.h \ 911 $(srcdir)/Include/classobject.h \ 912 $(srcdir)/Include/code.h \ 913 $(srcdir)/Include/codecs.h \ 914 $(srcdir)/Include/compile.h \ 915 $(srcdir)/Include/complexobject.h \ 916 $(srcdir)/Include/descrobject.h \ 917 $(srcdir)/Include/dictobject.h \ 918 $(srcdir)/Include/dtoa.h \ 919 $(srcdir)/Include/dynamic_annotations.h \ 920 $(srcdir)/Include/enumobject.h \ 921 $(srcdir)/Include/errcode.h \ 922 $(srcdir)/Include/eval.h \ 923 $(srcdir)/Include/fileobject.h \ 924 $(srcdir)/Include/fileutils.h \ 925 $(srcdir)/Include/floatobject.h \ 926 $(srcdir)/Include/frameobject.h \ 927 $(srcdir)/Include/funcobject.h \ 928 $(srcdir)/Include/genobject.h \ 929 $(srcdir)/Include/import.h \ 930 $(srcdir)/Include/intrcheck.h \ 931 $(srcdir)/Include/iterobject.h \ 932 $(srcdir)/Include/listobject.h \ 933 $(srcdir)/Include/longintrepr.h \ 934 $(srcdir)/Include/longobject.h \ 935 $(srcdir)/Include/marshal.h \ 936 $(srcdir)/Include/memoryobject.h \ 937 $(srcdir)/Include/metagrammar.h \ 938 $(srcdir)/Include/methodobject.h \ 939 $(srcdir)/Include/modsupport.h \ 940 $(srcdir)/Include/moduleobject.h \ 941 $(srcdir)/Include/namespaceobject.h \ 942 $(srcdir)/Include/node.h \ 943 $(srcdir)/Include/object.h \ 944 $(srcdir)/Include/objimpl.h \ 945 $(OPCODE_H) \ 946 $(srcdir)/Include/osdefs.h \ 947 $(srcdir)/Include/osmodule.h \ 948 $(srcdir)/Include/patchlevel.h \ 949 $(srcdir)/Include/pgen.h \ 950 $(srcdir)/Include/pgenheaders.h \ 951 $(srcdir)/Include/pyarena.h \ 952 $(srcdir)/Include/pyatomic.h \ 953 $(srcdir)/Include/pycapsule.h \ 954 $(srcdir)/Include/pyctype.h \ 955 $(srcdir)/Include/pydebug.h \ 956 $(srcdir)/Include/pydtrace.h \ 957 $(srcdir)/Include/pyerrors.h \ 958 $(srcdir)/Include/pyfpe.h \ 959 $(srcdir)/Include/pyhash.h \ 960 $(srcdir)/Include/pylifecycle.h \ 961 $(srcdir)/Include/pymath.h \ 962 $(srcdir)/Include/pygetopt.h \ 963 $(srcdir)/Include/pymacro.h \ 964 $(srcdir)/Include/pymem.h \ 965 $(srcdir)/Include/pyport.h \ 966 $(srcdir)/Include/pystate.h \ 967 $(srcdir)/Include/pystrcmp.h \ 968 $(srcdir)/Include/pystrtod.h \ 969 $(srcdir)/Include/pystrhex.h \ 970 $(srcdir)/Include/pythonrun.h \ 971 $(srcdir)/Include/pythread.h \ 972 $(srcdir)/Include/pytime.h \ 973 $(srcdir)/Include/rangeobject.h \ 974 $(srcdir)/Include/setobject.h \ 975 $(srcdir)/Include/sliceobject.h \ 976 $(srcdir)/Include/structmember.h \ 977 $(srcdir)/Include/structseq.h \ 978 $(srcdir)/Include/symtable.h \ 979 $(srcdir)/Include/sysmodule.h \ 980 $(srcdir)/Include/traceback.h \ 981 $(srcdir)/Include/tupleobject.h \ 982 $(srcdir)/Include/ucnhash.h \ 983 $(srcdir)/Include/unicodeobject.h \ 984 $(srcdir)/Include/warnings.h \ 985 $(srcdir)/Include/weakrefobject.h \ 986 pyconfig.h \ 987 $(PARSER_HEADERS) \ 988 $(AST_H) \ 989 $(DTRACE_HEADERS) 990 991 $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) 992 993 994 ###################################################################### 995 996 TESTOPTS= $(EXTRATESTOPTS) 997 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS) 998 TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py 999 TESTTIMEOUT= 1200 1000 1001 # Run a basic set of regression tests. 1002 # This excludes some tests that are particularly resource-intensive. 1003 test: all platform 1004 $(TESTRUNNER) $(TESTOPTS) 1005 1006 # Run the full test suite twice - once without .pyc files, and once with. 1007 # In the past, we've had problems where bugs in the marshalling or 1008 # elsewhere caused bytecode read from .pyc files to behave differently 1009 # than bytecode generated directly from a .py source file. Sometimes 1010 # the bytecode read from a .pyc file had the bug, sometimes the directly 1011 # generated bytecode. This is sometimes a very shy bug needing a lot of 1012 # sample data. 1013 testall: all platform 1014 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f 1015 $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py 1016 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f 1017 -$(TESTRUNNER) -u all $(TESTOPTS) 1018 $(TESTRUNNER) -u all $(TESTOPTS) 1019 1020 # Run the test suite for both architectures in a Universal build on OSX. 1021 # Must be run on an Intel box. 1022 testuniversal: all platform 1023 if [ `arch` != 'i386' ];then \ 1024 echo "This can only be used on OSX/i386" ;\ 1025 exit 1 ;\ 1026 fi 1027 $(TESTRUNNER) -u all $(TESTOPTS) 1028 $(RUNSHARED) /usr/libexec/oah/translate \ 1029 ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS) 1030 1031 # Like testall, but with only one pass and without multiple processes. 1032 # Run an optional script to include information about the build environment. 1033 buildbottest: build_all platform 1034 -@if which pybuildbot.identify >/dev/null 2>&1; then \ 1035 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \ 1036 fi 1037 $(TESTRUNNER) -j 1 -u all -W --slowest --timeout=$(TESTTIMEOUT) $(TESTOPTS) 1038 1039 QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ 1040 test_multibytecodec test_urllib2_localnet test_itertools \ 1041 test_multiprocessing_fork test_multiprocessing_spawn \ 1042 test_multiprocessing_forkserver \ 1043 test_mailbox test_socket test_poll \ 1044 test_select test_zipfile test_concurrent_futures 1045 quicktest: all platform 1046 $(TESTRUNNER) $(QUICKTESTOPTS) 1047 1048 1049 install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@ 1050 if test "x$(ENSUREPIP)" != "xno" ; then \ 1051 case $(ENSUREPIP) in \ 1052 upgrade) ensurepip="--upgrade" ;; \ 1053 install|*) ensurepip="" ;; \ 1054 esac; \ 1055 $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ 1056 $$ensurepip --root=$(DESTDIR)/ ; \ 1057 fi 1058 1059 altinstall: commoninstall 1060 if test "x$(ENSUREPIP)" != "xno" ; then \ 1061 case $(ENSUREPIP) in \ 1062 upgrade) ensurepip="--altinstall --upgrade" ;; \ 1063 install|*) ensurepip="--altinstall" ;; \ 1064 esac; \ 1065 $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ 1066 $$ensurepip --root=$(DESTDIR)/ ; \ 1067 fi 1068 1069 commoninstall: @FRAMEWORKALTINSTALLFIRST@ \ 1070 altbininstall libinstall inclinstall libainstall \ 1071 sharedinstall oldsharedinstall altmaninstall \ 1072 @FRAMEWORKALTINSTALLLAST@ 1073 1074 # Install shared libraries enabled by Setup 1075 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED) 1076 1077 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS) 1078 @for i in X $(SHAREDMODS); do \ 1079 if test $$i != X; then \ 1080 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ 1081 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \ 1082 fi; \ 1083 done 1084 1085 $(DESTSHARED): 1086 @for i in $(DESTDIRS); \ 1087 do \ 1088 if test ! -d $(DESTDIR)$$i; then \ 1089 echo "Creating directory $$i"; \ 1090 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1091 else true; \ 1092 fi; \ 1093 done 1094 1095 # Install the interpreter with $(VERSION) affixed 1096 # This goes into $(exec_prefix) 1097 altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@ 1098 @for i in $(BINDIR) $(LIBDIR); \ 1099 do \ 1100 if test ! -d $(DESTDIR)$$i; then \ 1101 echo "Creating directory $$i"; \ 1102 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1103 else true; \ 1104 fi; \ 1105 done 1106 if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \ 1107 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ 1108 else \ 1109 $(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \ 1110 fi 1111 -if test "$(VERSION)" != "$(LDVERSION)"; then \ 1112 if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ 1113 then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ 1114 fi; \ 1115 (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \ 1116 fi 1117 if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \ 1118 if test -n "$(DLLLIBRARY)" ; then \ 1119 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ 1120 else \ 1121 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ 1122 if test $(LDLIBRARY) != $(INSTSONAME); then \ 1123 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \ 1124 fi \ 1125 fi; \ 1126 if test -n "$(PY3LIBRARY)"; then \ 1127 $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \ 1128 fi; \ 1129 else true; \ 1130 fi 1131 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ 1132 rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \ 1133 lipo $(LIPO_32BIT_FLAGS) \ 1134 -output $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE) \ 1135 $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \ 1136 fi 1137 1138 bininstall: altbininstall 1139 if test ! -d $(DESTDIR)$(LIBPC); then \ 1140 echo "Creating directory $(LIBPC)"; \ 1141 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \ 1142 fi 1143 -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \ 1144 then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \ 1145 else true; \ 1146 fi 1147 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE)) 1148 -if test "$(VERSION)" != "$(LDVERSION)"; then \ 1149 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \ 1150 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \ 1151 rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \ 1152 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \ 1153 fi 1154 -rm -f $(DESTDIR)$(BINDIR)/python3-config 1155 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config) 1156 -rm -f $(DESTDIR)$(LIBPC)/python3.pc 1157 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) 1158 -rm -f $(DESTDIR)$(BINDIR)/idle3 1159 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) 1160 -rm -f $(DESTDIR)$(BINDIR)/pydoc3 1161 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) 1162 -rm -f $(DESTDIR)$(BINDIR)/2to3 1163 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) 1164 -rm -f $(DESTDIR)$(BINDIR)/pyvenv 1165 (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv) 1166 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ 1167 rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \ 1168 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \ 1169 fi 1170 1171 # Install the versioned manual page 1172 altmaninstall: 1173 @for i in $(MANDIR) $(MANDIR)/man1; \ 1174 do \ 1175 if test ! -d $(DESTDIR)$$i; then \ 1176 echo "Creating directory $$i"; \ 1177 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1178 else true; \ 1179 fi; \ 1180 done 1181 $(INSTALL_DATA) $(srcdir)/Misc/python.man \ 1182 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1 1183 1184 # Install the unversioned manual page 1185 maninstall: altmaninstall 1186 -rm -f $(DESTDIR)$(MANDIR)/man1/python3.1 1187 (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python3.1) 1188 1189 # Install the library 1190 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax 1191 LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ 1192 tkinter/test/test_ttk site-packages test \ 1193 test/audiodata \ 1194 test/capath test/data \ 1195 test/cjkencodings test/decimaltestdata test/xmltestdata \ 1196 test/dtracedata \ 1197 test/eintrdata \ 1198 test/imghdrdata \ 1199 test/libregrtest \ 1200 test/subprocessdata test/sndhdrdata test/support \ 1201 test/tracedmodules test/encoded_modules \ 1202 test/test_import \ 1203 test/test_import/data \ 1204 test/test_import/data/circular_imports \ 1205 test/test_import/data/circular_imports/subpkg \ 1206 test/test_importlib/namespace_pkgs \ 1207 test/test_importlib/namespace_pkgs/both_portions \ 1208 test/test_importlib/namespace_pkgs/both_portions/foo \ 1209 test/test_importlib/namespace_pkgs/not_a_namespace_pkg \ 1210 test/test_importlib/namespace_pkgs/not_a_namespace_pkg/foo \ 1211 test/test_importlib/namespace_pkgs/portion1 \ 1212 test/test_importlib/namespace_pkgs/portion1/foo \ 1213 test/test_importlib/namespace_pkgs/portion2 \ 1214 test/test_importlib/namespace_pkgs/portion2/foo \ 1215 test/test_importlib/namespace_pkgs/project1 \ 1216 test/test_importlib/namespace_pkgs/project1/parent \ 1217 test/test_importlib/namespace_pkgs/project1/parent/child \ 1218 test/test_importlib/namespace_pkgs/project2 \ 1219 test/test_importlib/namespace_pkgs/project2/parent \ 1220 test/test_importlib/namespace_pkgs/project2/parent/child \ 1221 test/test_importlib/namespace_pkgs/project3 \ 1222 test/test_importlib/namespace_pkgs/project3/parent \ 1223 test/test_importlib/namespace_pkgs/project3/parent/child \ 1224 test/test_importlib/namespace_pkgs/module_and_namespace_package \ 1225 test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \ 1226 asyncio \ 1227 test/test_asyncio \ 1228 collections concurrent concurrent/futures encodings \ 1229 email email/mime test/test_email test/test_email/data \ 1230 ensurepip ensurepip/_bundled \ 1231 html json test/test_json http dbm xmlrpc \ 1232 sqlite3 sqlite3/test \ 1233 logging csv wsgiref urllib \ 1234 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \ 1235 lib2to3/tests/data lib2to3/tests/data/fixers \ 1236 lib2to3/tests/data/fixers/myfixes \ 1237 ctypes ctypes/test ctypes/macholib \ 1238 idlelib idlelib/Icons idlelib/idle_test \ 1239 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \ 1240 importlib test/test_importlib test/test_importlib/builtin \ 1241 test/test_importlib/extension test/test_importlib/frozen \ 1242 test/test_importlib/import_ test/test_importlib/source \ 1243 test/test_tools test/test_warnings test/test_warnings/data \ 1244 turtledemo \ 1245 multiprocessing multiprocessing/dummy \ 1246 unittest unittest/test unittest/test/testmock \ 1247 venv venv/scripts venv/scripts/common venv/scripts/posix \ 1248 curses pydoc_data 1249 libinstall: build_all $(srcdir)/Modules/xxmodule.c 1250 @for i in $(SCRIPTDIR) $(LIBDEST); \ 1251 do \ 1252 if test ! -d $(DESTDIR)$$i; then \ 1253 echo "Creating directory $$i"; \ 1254 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1255 else true; \ 1256 fi; \ 1257 done 1258 @for d in $(LIBSUBDIRS); \ 1259 do \ 1260 a=$(srcdir)/Lib/$$d; \ 1261 if test ! -d $$a; then continue; else true; fi; \ 1262 b=$(LIBDEST)/$$d; \ 1263 if test ! -d $(DESTDIR)$$b; then \ 1264 echo "Creating directory $$b"; \ 1265 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \ 1266 else true; \ 1267 fi; \ 1268 done 1269 @for i in $(srcdir)/Lib/*.py; \ 1270 do \ 1271 if test -x $$i; then \ 1272 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ 1273 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ 1274 else \ 1275 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \ 1276 echo $(INSTALL_DATA) $$i $(LIBDEST); \ 1277 fi; \ 1278 done 1279 @for d in $(LIBSUBDIRS); \ 1280 do \ 1281 a=$(srcdir)/Lib/$$d; \ 1282 if test ! -d $$a; then continue; else true; fi; \ 1283 if test `ls $$a | wc -l` -lt 1; then continue; fi; \ 1284 b=$(LIBDEST)/$$d; \ 1285 for i in $$a/*; \ 1286 do \ 1287 case $$i in \ 1288 *CVS) ;; \ 1289 *.py[co]) ;; \ 1290 *.orig) ;; \ 1291 *~) ;; \ 1292 *) \ 1293 if test -d $$i; then continue; fi; \ 1294 if test -x $$i; then \ 1295 echo $(INSTALL_SCRIPT) $$i $$b; \ 1296 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \ 1297 else \ 1298 echo $(INSTALL_DATA) $$i $$b; \ 1299 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \ 1300 fi;; \ 1301 esac; \ 1302 done; \ 1303 done 1304 $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \ 1305 $(DESTDIR)$(LIBDEST); \ 1306 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt 1307 if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \ 1308 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ 1309 $(DESTDIR)$(LIBDEST)/distutils/tests ; \ 1310 fi 1311 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1312 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ 1313 -d $(LIBDEST) -f \ 1314 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 1315 $(DESTDIR)$(LIBDEST) 1316 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1317 $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1318 -d $(LIBDEST) -f \ 1319 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 1320 $(DESTDIR)$(LIBDEST) 1321 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1322 $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ 1323 -d $(LIBDEST) -f \ 1324 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 1325 $(DESTDIR)$(LIBDEST) 1326 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1327 $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ 1328 -d $(LIBDEST)/site-packages -f \ 1329 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 1330 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1331 $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ 1332 -d $(LIBDEST)/site-packages -f \ 1333 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 1334 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1335 $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ 1336 -d $(LIBDEST)/site-packages -f \ 1337 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 1338 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1339 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt 1340 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 1341 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt 1342 1343 python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh 1344 # Substitution happens here, as the completely-expanded BINDIR 1345 # is not available in configure 1346 sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py 1347 # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} 1348 LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config 1349 # On Darwin, always use the python version of the script, the shell 1350 # version doesn't use the compiler customizations that are provided 1351 # in python (_osx_support.py). 1352 if test `uname -s` = Darwin; then \ 1353 cp python-config.py python-config; \ 1354 fi 1355 1356 1357 # Install the include files 1358 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) 1359 inclinstall: 1360 @for i in $(INCLDIRSTOMAKE); \ 1361 do \ 1362 if test ! -d $(DESTDIR)$$i; then \ 1363 echo "Creating directory $$i"; \ 1364 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1365 else true; \ 1366 fi; \ 1367 done 1368 @for i in $(srcdir)/Include/*.h; \ 1369 do \ 1370 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ 1371 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ 1372 done 1373 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h 1374 1375 # Install the library and miscellaneous stuff needed for extending/embedding 1376 # This goes into $(exec_prefix) 1377 LIBPL= @LIBPL@ 1378 1379 # pkgconfig directory 1380 LIBPC= $(LIBDIR)/pkgconfig 1381 1382 libainstall: all python-config 1383 @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \ 1384 do \ 1385 if test ! -d $(DESTDIR)$$i; then \ 1386 echo "Creating directory $$i"; \ 1387 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1388 else true; \ 1389 fi; \ 1390 done 1391 @if test -d $(LIBRARY); then :; else \ 1392 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ 1393 if test "$(SHLIB_SUFFIX)" = .dll; then \ 1394 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ 1395 else \ 1396 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ 1397 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ 1398 fi; \ 1399 else \ 1400 echo Skip install of $(LIBRARY) - use make frameworkinstall; \ 1401 fi; \ 1402 fi 1403 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c 1404 $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o 1405 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in 1406 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile 1407 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup 1408 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local 1409 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config 1410 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc 1411 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup 1412 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh 1413 $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py 1414 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config 1415 @if [ -s Modules/python.exp -a \ 1416 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ 1417 echo; echo "Installing support files for building shared extension modules on AIX:"; \ 1418 $(INSTALL_DATA) Modules/python.exp \ 1419 $(DESTDIR)$(LIBPL)/python.exp; \ 1420 echo; echo "$(LIBPL)/python.exp"; \ 1421 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \ 1422 $(DESTDIR)$(LIBPL)/makexp_aix; \ 1423 echo "$(LIBPL)/makexp_aix"; \ 1424 $(INSTALL_SCRIPT) Modules/ld_so_aix \ 1425 $(DESTDIR)$(LIBPL)/ld_so_aix; \ 1426 echo "$(LIBPL)/ld_so_aix"; \ 1427 echo; echo "See Misc/AIX-NOTES for details."; \ 1428 else true; \ 1429 fi 1430 1431 # Install the dynamically loadable modules 1432 # This goes into $(exec_prefix) 1433 sharedinstall: sharedmods 1434 $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ 1435 --prefix=$(prefix) \ 1436 --install-scripts=$(BINDIR) \ 1437 --install-platlib=$(DESTSHARED) \ 1438 --root=$(DESTDIR)/ 1439 -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py 1440 -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ 1441 1442 # Here are a couple of targets for MacOSX again, to install a full 1443 # framework-based Python. frameworkinstall installs everything, the 1444 # subtargets install specific parts. Much of the actual work is offloaded to 1445 # the Makefile in Mac 1446 # 1447 # 1448 # This target is here for backward compatibility, previous versions of Python 1449 # hadn't integrated framework installation in the normal install process. 1450 frameworkinstall: install 1451 1452 # On install, we re-make the framework 1453 # structure in the install location, /Library/Frameworks/ or the argument to 1454 # --enable-framework. If --enable-framework has been specified then we have 1455 # automatically set prefix to the location deep down in the framework, so we 1456 # only have to cater for the structural bits of the framework. 1457 1458 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib 1459 1460 frameworkinstallstructure: $(LDLIBRARY) 1461 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ 1462 echo Not configured with --enable-framework; \ 1463 exit 1; \ 1464 else true; \ 1465 fi 1466 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ 1467 if test ! -d $(DESTDIR)$$i; then \ 1468 echo "Creating directory $(DESTDIR)$$i"; \ 1469 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ 1470 else true; \ 1471 fi; \ 1472 done 1473 $(LN) -fsn include/python$(LDVERSION) $(DESTDIR)$(prefix)/Headers 1474 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist 1475 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current 1476 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK) 1477 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers 1478 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources 1479 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) 1480 1481 # This installs Mac/Lib into the framework 1482 # Install a number of symlinks to keep software that expects a normal unix 1483 # install (which includes python-config) happy. 1484 frameworkinstallmaclib: 1485 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).a" 1486 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib" 1487 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).a" 1488 $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib" 1489 $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib" 1490 $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" 1491 1492 # This installs the IDE, the Launcher and other apps into /Applications 1493 frameworkinstallapps: 1494 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)" 1495 1496 # Build the bootstrap executable that will spawn the interpreter inside 1497 # an app bundle within the framework. This allows the interpreter to 1498 # run OS X GUI APIs. 1499 frameworkpythonw: 1500 cd Mac && $(MAKE) pythonw 1501 1502 # This installs the python* and other bin symlinks in $prefix/bin or in 1503 # a bin directory relative to the framework root 1504 frameworkinstallunixtools: 1505 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)" 1506 1507 frameworkaltinstallunixtools: 1508 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)" 1509 1510 # This installs the Tools into the applications directory. 1511 # It is not part of a normal frameworkinstall 1512 frameworkinstallextras: 1513 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)" 1514 1515 # This installs a few of the useful scripts in Tools/scripts 1516 scriptsinstall: 1517 SRCDIR=$(srcdir) $(RUNSHARED) \ 1518 $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \ 1519 --prefix=$(prefix) \ 1520 --install-scripts=$(BINDIR) \ 1521 --root=$(DESTDIR)/ 1522 1523 # Build the toplevel Makefile 1524 Makefile.pre: $(srcdir)/Makefile.pre.in config.status 1525 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status 1526 $(MAKE) -f Makefile.pre Makefile 1527 1528 # Run the configure script. 1529 config.status: $(srcdir)/configure 1530 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS) 1531 1532 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre 1533 1534 # Some make's put the object file in the current directory 1535 .c.o: 1536 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $< 1537 1538 # Run reindent on the library 1539 reindent: 1540 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib 1541 1542 # Rerun configure with the same options as it was run last time, 1543 # provided the config.status script exists 1544 recheck: 1545 $(SHELL) config.status --recheck 1546 $(SHELL) config.status 1547 1548 # Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in 1549 autoconf: 1550 (cd $(srcdir); autoconf -Wall) 1551 (cd $(srcdir); autoheader -Wall) 1552 1553 # Create a tags file for vi 1554 tags:: 1555 cd $(srcdir); \ 1556 ctags -w Include/*.h; \ 1557 for i in $(SRCDIRS); do ctags -w -a $$i/*.[ch]; \ 1558 done; \ 1559 LC_ALL=C sort -o tags tags 1560 1561 # Create a tags file for GNU Emacs 1562 TAGS:: 1563 cd $(srcdir); \ 1564 etags Include/*.h; \ 1565 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done 1566 1567 # This fixes up the mtimes of checked-in generated files, assuming that they 1568 # only *appear* to be outdated because of checkout order. 1569 # This is run while preparing a source release tarball, and can be run manually 1570 # to avoid bootstrap issues. 1571 touch: 1572 cd $(srcdir); \ 1573 hg --config extensions.touch=Tools/hg/hgtouch.py touch -v 1574 1575 # Sanitation targets -- clean leaves libraries, executables and tags 1576 # files, which clobber removes as well 1577 pycremoval: 1578 -find $(srcdir) -depth -name '__pycache__' -exec rm -rf {} ';' 1579 -find $(srcdir) -name '*.py[co]' -exec rm -f {} ';' 1580 1581 rmtestturds: 1582 -rm -f *BAD *GOOD *SKIPPED 1583 -rm -rf OUT 1584 -rm -f *.TXT 1585 -rm -f *.txt 1586 -rm -f gb-18030-2000.xml 1587 1588 docclean: 1589 -rm -rf Doc/build 1590 -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils 1591 1592 clean: pycremoval 1593 find . -name '*.[oa]' -exec rm -f {} ';' 1594 find . -name '*.s[ol]' -exec rm -f {} ';' 1595 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';' 1596 find build -name 'fficonfig.h' -exec rm -f {} ';' || true 1597 find build -name '*.py' -exec rm -f {} ';' || true 1598 find build -name '*.py[co]' -exec rm -f {} ';' || true 1599 -rm -f pybuilddir.txt 1600 -rm -f Lib/lib2to3/*Grammar*.pickle 1601 -rm -f Programs/_testembed Programs/_freeze_importlib 1602 -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';' 1603 -rm -f Include/pydtrace_probes.h 1604 1605 profile-removal: 1606 find . -name '*.gc??' -exec rm -f {} ';' 1607 find . -name '*.profclang?' -exec rm -f {} ';' 1608 find . -name '*.dyn' -exec rm -f {} ';' 1609 rm -f $(COVERAGE_INFO) 1610 rm -rf $(COVERAGE_REPORT) 1611 1612 clobber: clean profile-removal 1613 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ 1614 tags TAGS \ 1615 config.cache config.log pyconfig.h Modules/config.c 1616 -rm -rf build platform 1617 -rm -rf $(PYTHONFRAMEWORKDIR) 1618 -rm -f python-config.py python-config 1619 1620 # Make things extra clean, before making a distribution: 1621 # remove all generated files, even Makefile[.pre] 1622 # Keep configure and Python-ast.[ch], it's possible they can't be generated 1623 distclean: clobber 1624 for file in $(srcdir)/Lib/test/data/* ; do \ 1625 if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \ 1626 done 1627 -rm -f core Makefile Makefile.pre config.status \ 1628 Modules/Setup Modules/Setup.local Modules/Setup.config \ 1629 Modules/ld_so_aix Modules/python.exp Misc/python.pc 1630 -rm -f python*-gdb.py 1631 # Issue #28258: set LC_ALL to avoid issues with Estonian locale. 1632 # Expansion is performed here by shell (spawned by make) itself before 1633 # arguments are passed to find. So LC_ALL=C must be set as a separate 1634 # command. 1635 LC_ALL=C; find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \ 1636 -o -name '[@,#]*' -o -name '*.old' \ 1637 -o -name '*.orig' -o -name '*.rej' \ 1638 -o -name '*.bak' ')' \ 1639 -exec rm -f {} ';' 1640 1641 # Check for smelly exported symbols (not starting with Py/_Py) 1642 smelly: all 1643 nm -p $(LIBRARY) | \ 1644 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \ 1645 1646 # Find files with funny names 1647 funny: 1648 find $(SUBDIRS) $(SUBDIRSTOO) \ 1649 -type d \ 1650 -o -name '*.[chs]' \ 1651 -o -name '*.py' \ 1652 -o -name '*.pyw' \ 1653 -o -name '*.dat' \ 1654 -o -name '*.el' \ 1655 -o -name '*.fd' \ 1656 -o -name '*.in' \ 1657 -o -name '*.gif' \ 1658 -o -name '*.txt' \ 1659 -o -name '*.xml' \ 1660 -o -name '*.xbm' \ 1661 -o -name '*.xpm' \ 1662 -o -name '*.uue' \ 1663 -o -name '*.decTest' \ 1664 -o -name '*.tmCommand' \ 1665 -o -name '*.tmSnippet' \ 1666 -o -name 'Setup' \ 1667 -o -name 'Setup.*' \ 1668 -o -name README \ 1669 -o -name NEWS \ 1670 -o -name HISTORY \ 1671 -o -name Makefile \ 1672 -o -name ChangeLog \ 1673 -o -name .hgignore \ 1674 -o -name .bzrignore \ 1675 -o -name MANIFEST \ 1676 -o -print 1677 1678 # Perform some verification checks on any modified files. 1679 patchcheck: all 1680 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py 1681 1682 # Dependencies 1683 1684 Python/thread.o: @THREADHEADERS@ 1685 1686 # Declare targets that aren't real files 1687 .PHONY: all build_all sharedmods oldsharedmods test quicktest 1688 .PHONY: install altinstall oldsharedinstall bininstall altbininstall 1689 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall 1690 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure 1691 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools 1692 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 1693 .PHONY: smelly funny patchcheck touch altmaninstall commoninstall 1694 .PHONY: gdbhooks 1695 1696 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY 1697 # Local Variables: 1698 # mode: makefile 1699 # End: 1700