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