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