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