1 # Top-level Makefile for Python
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:
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
19 # See also the section "Build instructions" in the README file.
21 # === Variables set by makesetup ===
26 # === Variables set by configure
37 SVNVERSION= @SVNVERSION@
39 # Shell used by make (some versions default to the login shell, which is bad)
42 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
45 # Portable install script (configure doesn't always guess right)
47 INSTALL_PROGRAM=@INSTALL_PROGRAM@
48 INSTALL_SCRIPT= @INSTALL_SCRIPT@
49 INSTALL_DATA= @INSTALL_DATA@
50 # Shared libraries must be installed with executable mode on some systems;
51 # rather than figuring out exactly which, we always give them executable mode.
52 # Also, making them read-only seems to be a good idea...
53 INSTALL_SHARED= ${INSTALL} -m 555
55 MAKESETUP= $(srcdir)/Modules/makesetup
59 BASECFLAGS= @BASECFLAGS@
60 CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
61 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
62 # be able to build extension modules using the directories specified in the
63 # environment variables
64 CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
69 LINKFORSHARED= @LINKFORSHARED@
70 # Extra C flags added for building the interpreter object files.
71 CFLAGSFORSHARED=@CFLAGSFORSHARED@
72 # C flags used for building the interpreter object files
73 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
76 # Machine-dependent subdirectories
79 # Install prefix for architecture-independent files
82 # Install prefix for architecture-dependent files
83 exec_prefix= @exec_prefix@
85 # Install prefix for data files
86 datarootdir= @datarootdir@
88 # Expanded directories
89 BINDIR= $(exec_prefix)/bin
90 LIBDIR= $(exec_prefix)/lib
92 INCLUDEDIR= @includedir@
93 CONFINCLUDEDIR= $(exec_prefix)/include
94 SCRIPTDIR= $(prefix)/lib
96 # Detailed destination directories
97 BINLIBDEST= $(LIBDIR)/python$(VERSION)
98 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
99 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
100 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
101 LIBP= $(LIBDIR)/python$(VERSION)
103 # Symbols used for using shared libraries
106 BLDSHARED= @BLDSHARED@
107 DESTSHARED= $(BINLIBDEST)/lib-dynload
109 # Executable suffix (.exe on Windows and Mac OS X)
111 BUILDEXE= @BUILDEXEEXT@
113 # Short name and location for Mac OS X Python framework
114 UNIVERSALSDK=@UNIVERSALSDK@
115 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
116 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
117 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
118 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
119 # Deployment target selected during configure, to be checked
120 # by distutils. The export statement is needed to ensure that the
121 # deployment target is active during build.
122 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
123 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
125 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
126 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
128 # Environment to run shared python without installed libraries
129 RUNSHARED= @RUNSHARED@
131 # Modes for directories, executables and data files created by the
132 # install process. Default to user-only-writable for all file types.
137 # configure script arguments
138 CONFIG_ARGS= @CONFIG_ARGS@
141 # Subdirectories with code
144 # Other subdirectories
145 SUBDIRSTOO= Include Lib Misc Demo
147 # Files and directories to be distributed
148 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
149 DISTFILES= README ChangeLog $(CONFIGFILES)
150 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
151 DIST= $(DISTFILES) $(DISTDIRS)
155 LDLIBRARY= @LDLIBRARY@
156 BLDLIBRARY= @BLDLIBRARY@
157 DLLLIBRARY= @DLLLIBRARY@
158 LDLIBRARYDIR= @LDLIBRARYDIR@
159 INSTSONAME= @INSTSONAME@
165 SYSLIBS= $(LIBM) $(LIBC)
168 THREADOBJ= @THREADOBJ@
169 DLINCLDIR= @DLINCLDIR@
170 DYNLOADFILE= @DYNLOADFILE@
171 MACHDEP_OBJS= @MACHDEP_OBJS@
176 BUILDPYTHON= python$(BUILDEXE)
178 # The task to run while instrument when building the profile-opt target
179 PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
180 #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
182 # === Definitions added by makesetup ===
185 ##########################################################################
193 # Used of signalmodule.o is not available
194 SIGNAL_OBJS= @SIGNAL_OBJS@
196 IO_H= Modules/_io/_iomodule.h
199 Modules/_io/_iomodule.o \
200 Modules/_io/iobase.o \
201 Modules/_io/fileio.o \
202 Modules/_io/bufferedio.o \
203 Modules/_io/textio.o \
204 Modules/_io/bytesio.o \
205 Modules/_io/stringio.o
207 ##########################################################################
209 GRAMMAR_H= $(srcdir)/Include/graminit.h
210 GRAMMAR_C= $(srcdir)/Python/graminit.c
211 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
214 ##########################################################################
216 PGEN= Parser/pgen$(EXE)
226 Parser/metagrammar.o \
231 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
235 Python/mysnprintf.o \
236 Parser/tokenizer_pgen.o \
237 Parser/printgrammar.o \
244 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
246 ##########################################################################
248 AST_H_DIR= $(srcdir)/Include
249 AST_H= $(AST_H_DIR)/Python-ast.h
250 AST_C_DIR= $(srcdir)/Python
251 AST_C= $(AST_C_DIR)/Python-ast.c
252 AST_ASDL= $(srcdir)/Parser/Python.asdl
254 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
255 # XXX Note that a build now requires Python exist before the build starts
256 ASDLGEN= $(srcdir)/Parser/asdl_c.py
258 ##########################################################################
262 $(srcdir)/Python/opcode_targets.h
265 $(srcdir)/Python/makeopcodetargets.py
267 OPCODETARGETGEN_FILES= \
268 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
272 Python/Python-ast.o \
275 Python/bltinmodule.o \
281 Python/frozenmain.o \
284 Python/getcompiler.o \
285 Python/getcopyright.o \
286 Python/getplatform.o \
287 Python/getversion.o \
292 Python/modsupport.o \
294 Python/mysnprintf.o \
301 Python/structmember.o \
309 Python/formatter_unicode.o \
310 Python/$(DYNLOADFILE) \
316 ##########################################################################
320 Objects/boolobject.o \
321 Objects/bytes_methods.o \
322 Objects/bytearrayobject.o \
323 Objects/bytesobject.o \
324 Objects/cellobject.o \
325 Objects/classobject.o \
327 Objects/codeobject.o \
328 Objects/complexobject.o \
329 Objects/descrobject.o \
330 Objects/enumobject.o \
331 Objects/exceptions.o \
332 Objects/genobject.o \
333 Objects/fileobject.o \
334 Objects/floatobject.o \
335 Objects/frameobject.o \
336 Objects/funcobject.o \
337 Objects/iterobject.o \
338 Objects/listobject.o \
339 Objects/longobject.o \
340 Objects/dictobject.o \
341 Objects/memoryobject.o \
342 Objects/methodobject.o \
343 Objects/moduleobject.o \
346 Objects/rangeobject.o \
347 Objects/setobject.o \
348 Objects/sliceobject.o \
349 Objects/structseq.o \
350 Objects/tupleobject.o \
351 Objects/typeobject.o \
352 Objects/unicodeobject.o \
353 Objects/unicodectype.o \
354 Objects/weakrefobject.o
357 ##########################################################################
358 # objects that get linked into the Python library
360 Modules/getbuildinfo.o \
368 #########################################################################
373 build_all: $(BUILDPYTHON) oldsharedmods sharedmods
375 # Compile a binary with gcc profile guided optimization.
377 @echo "Building with support for profile generation:"
379 $(MAKE) build_all_generate_profile
380 @echo "Running benchmark to generate profile data:"
381 $(MAKE) profile-removal
382 $(MAKE) run_profile_task
383 @echo "Rebuilding with profile guided optimizations:"
385 $(MAKE) build_all_use_profile
387 build_all_generate_profile:
388 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
391 ./$(BUILDPYTHON) $(PROFILE_TASK)
393 build_all_use_profile:
394 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
397 @echo "Building with support for coverage checking:"
399 $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
402 # Build the interpreter
403 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
404 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
406 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
408 platform: $(BUILDPYTHON)
409 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
412 # Build the shared modules
413 sharedmods: $(BUILDPYTHON)
414 @case $$MAKEFLAGS in \
415 *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
416 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
419 # Build static library
420 # avoid long command lines, same as LIBRARY_OBJS
421 $(LIBRARY): $(LIBRARY_OBJS)
423 $(AR) cr $@ Modules/getbuildinfo.o
424 $(AR) cr $@ $(PARSER_OBJS)
425 $(AR) cr $@ $(OBJECT_OBJS)
426 $(AR) cr $@ $(PYTHON_OBJS)
427 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
428 $(AR) cr $@ $(MODOBJS)
431 libpython$(VERSION).so: $(LIBRARY_OBJS)
432 if test $(INSTSONAME) != $(LDLIBRARY); then \
433 $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
434 $(LN) -f $(INSTSONAME) $@; \
436 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
439 libpython$(VERSION).dylib: $(LIBRARY_OBJS)
440 $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
443 libpython$(VERSION).sl: $(LIBRARY_OBJS)
444 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
446 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
447 # minimal framework (not including the Lib directory and such) in the current
449 RESSRCDIR=Mac/Resources/framework
450 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
452 $(RESSRCDIR)/Info.plist
453 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
454 if test "${UNIVERSALSDK}"; then \
455 $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
456 -isysroot "${UNIVERSALSDK}" \
457 -all_load $(LIBRARY) -Wl,-single_module \
458 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
459 -compatibility_version $(VERSION) \
460 -current_version $(VERSION); \
462 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
465 $(INSTALL) -d -m $(DIRMODE) \
466 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
467 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
468 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
469 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
470 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
471 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
472 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
474 # This rule builds the Cygwin Python DLL and import library if configured
475 # for a shared core library; otherwise, this rule is a noop.
476 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
477 if test -n "$(DLLLIBRARY)"; then \
478 $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
479 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
484 oldsharedmods: $(SHAREDMODS)
487 Makefile Modules/config.c: Makefile.pre \
488 $(srcdir)/Modules/config.c.in \
490 Modules/Setup.config \
493 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
495 Modules/Setup.config \
496 Modules/Setup.local \
499 @echo "The Makefile was updated, you may need to re-run make."
502 Modules/Setup: $(srcdir)/Modules/Setup.dist
503 @if test -f Modules/Setup; then \
504 echo "-----------------------------------------------"; \
505 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
506 echo "check to make sure you have all the updates you"; \
507 echo "need in your Modules/Setup file."; \
508 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
509 echo "-----------------------------------------------"; \
512 ############################################################################
513 # Special rules for object files
515 Modules/getbuildinfo.o: $(PARSER_OBJS) \
521 $(srcdir)/Modules/getbuildinfo.c
522 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
524 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
525 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
526 -DPREFIX='"$(prefix)"' \
527 -DEXEC_PREFIX='"$(exec_prefix)"' \
528 -DVERSION='"$(VERSION)"' \
529 -DVPATH='"$(VPATH)"' \
530 -o $@ $(srcdir)/Modules/getpath.c
532 Modules/python.o: $(srcdir)/Modules/python.c
533 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
537 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
538 -@$(INSTALL) -d Include
539 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
542 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
544 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
545 $(srcdir)/Include/token.h \
546 $(srcdir)/Include/grammar.h
547 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
549 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
551 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
553 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
554 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
556 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
557 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
559 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
561 Python/getplatform.o: $(srcdir)/Python/getplatform.c
562 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
564 Python/importdl.o: $(srcdir)/Python/importdl.c
565 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
567 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
568 $(srcdir)/Objects/unicodetype_db.h
571 $(srcdir)/Include/bytes_methods.h \
572 $(srcdir)/Objects/stringlib/count.h \
573 $(srcdir)/Objects/stringlib/ctype.h \
574 $(srcdir)/Objects/stringlib/eq.h \
575 $(srcdir)/Objects/stringlib/fastsearch.h \
576 $(srcdir)/Objects/stringlib/find.h \
577 $(srcdir)/Objects/stringlib/partition.h \
578 $(srcdir)/Objects/stringlib/stringdefs.h \
579 $(srcdir)/Objects/stringlib/string_format.h \
580 $(srcdir)/Objects/stringlib/transmogrify.h \
581 $(srcdir)/Objects/stringlib/unicodedefs.h \
582 $(srcdir)/Objects/stringlib/localeutil.h
584 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
586 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
588 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
591 $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
592 $(OPCODETARGETGEN) $(OPCODETARGETS_H)
594 Python/ceval.o: $(OPCODETARGETS_H)
596 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
598 $(srcdir)/Objects/stringlib/formatter.h
601 ############################################################################
605 Include/Python-ast.h \
611 Include/boolobject.h \
612 Include/bytes_methods.h \
613 Include/bytearrayobject.h \
614 Include/bytesobject.h \
615 Include/cellobject.h \
617 Include/classobject.h \
622 Include/complexobject.h \
623 Include/descrobject.h \
624 Include/dictobject.h \
626 Include/enumobject.h \
629 Include/fileobject.h \
630 Include/floatobject.h \
631 Include/frameobject.h \
632 Include/funcobject.h \
633 Include/genobject.h \
635 Include/intrcheck.h \
636 Include/iterobject.h \
637 Include/listobject.h \
638 Include/longintrepr.h \
639 Include/longobject.h \
641 Include/memoryobject.h \
642 Include/metagrammar.h \
643 Include/methodobject.h \
644 Include/modsupport.h \
645 Include/moduleobject.h \
652 Include/patchlevel.h \
654 Include/pgenheaders.h \
666 Include/pythonrun.h \
668 Include/rangeobject.h \
669 Include/setobject.h \
670 Include/sliceobject.h \
671 Include/structmember.h \
672 Include/structseq.h \
674 Include/sysmodule.h \
675 Include/traceback.h \
676 Include/tupleobject.h \
678 Include/unicodeobject.h \
680 Include/weakrefobject.h \
684 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
687 ######################################################################
689 # Test the interpreter (twice, once without .pyc files, once with)
690 # In the past, we've had problems where bugs in the marshalling or
691 # elsewhere caused bytecode read from .pyc files to behave differently
692 # than bytecode generated directly from a .py source file. Sometimes
693 # the bytecode read from a .pyc file had the bug, somtimes the directly
694 # generated bytecode. This is sometimes a very shy bug needing a lot of
697 TESTOPTS= -l $(EXTRATESTOPTS)
698 TESTPROG= $(srcdir)/Lib/test/regrtest.py
699 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -bb
701 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
702 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
703 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
705 testall: all platform
706 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
707 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
708 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
709 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
710 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
712 # Run the unitests for both architectures in a Universal build on OSX
713 # Must be run on an Intel box.
714 testuniversal: all platform
715 if [ `arch` != 'i386' ];then \
716 echo "This can only be used on OSX/i386" ;\
719 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
720 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
721 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
722 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
725 # Like testall, but with a single pass only
726 # run an optional script to include some information about the build environment
727 buildbottest: all platform
728 -@if which pybuildbot.identify >/dev/null 2>&1; then \
729 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
731 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
733 QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
734 test_multibytecodec test_urllib2_localnet test_itertools \
735 test_multiprocessing test_mailbox test_socket test_poll \
736 test_select test_zipfile
737 quicktest: all platform
738 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
739 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
740 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
742 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
744 memtest: all platform
745 -rm -f $(srcdir)/Lib/test/*.py[co]
746 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
747 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
749 # Install everything, and install Python 3 to "python"
750 fullinstall: @FRAMEWORKINSTALLFIRST@ altinstall bininstall @FRAMEWORKINSTALLLAST@
752 # "make install" is an alias for "make altinstall" since we don't want to
753 # overwrite Python 2.x by default.
755 @echo "* Note: not installed as 'python'."
756 @echo "* Use 'make fullinstall' to install as 'python'."
757 @echo "* However, 'make fullinstall' is discouraged,"
758 @echo "* as it will clobber your Python 2.x installation."
760 # Install almost everything without disturbing 2.x versions
761 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
762 sharedinstall oldsharedinstall maninstall @FRAMEWORKALTINSTALLLAST@
764 # Install shared libraries enabled by Setup
765 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
767 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
768 @for i in X $(SHAREDMODS); do \
769 if test $$i != X; then \
770 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
771 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
776 @for i in $(DESTDIRS); \
778 if test ! -d $(DESTDIR)$$i; then \
779 echo "Creating directory $$i"; \
780 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
786 # Install the interpreter (by creating a hard link to python$(VERSION))
787 bininstall: altbininstall
788 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)$(EXE); \
789 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)$(EXE); \
792 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)$(EXE))
793 -rm -f $(DESTDIR)$(BINDIR)/python-config
794 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
796 # Install the interpreter with $(VERSION) affixed
797 # This goes into $(exec_prefix)
798 altbininstall: $(BUILDPYTHON)
799 @for i in $(BINDIR) $(LIBDIR); \
801 if test ! -d $(DESTDIR)$$i; then \
802 echo "Creating directory $$i"; \
803 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
807 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
808 if test -f $(LDLIBRARY); then \
809 if test -n "$(DLLLIBRARY)" ; then \
810 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
812 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
813 if test $(LDLIBRARY) != $(INSTSONAME); then \
814 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
819 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \
820 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \
823 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE))
824 -rm -f $(DESTDIR)$(BINDIR)/python3-config
825 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
827 # Install the manual page
829 @for i in $(MANDIR) $(MANDIR)/man1; \
831 if test ! -d $(DESTDIR)$$i; then \
832 echo "Creating directory $$i"; \
833 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
837 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
838 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
840 # Install the library
841 PLATDIR= plat-$(MACHDEP)
842 EXTRAPLATDIR= @EXTRAPLATDIR@
843 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
844 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
845 LIBSUBDIRS= tkinter site-packages test test/output test/data \
846 test/decimaltestdata \
848 email email/mime email/test email/test/data \
849 html json json/tests http dbm xmlrpc \
850 sqlite3 sqlite3/test \
851 logging bsddb bsddb/test csv wsgiref urllib \
852 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
853 lib2to3/tests/data lib2to3/tests/data/fixes lib2to3/tests/data/fixers/myfixes \
854 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
855 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
856 importlib importlib/test importlib/test/builtin \
857 importlib/test/extension importlib/test/frozen \
858 importlib/test/import_ importlib/test/source \
859 setuptools setuptools/command setuptools/tests setuptools.egg-info \
860 multiprocessing multiprocessing/dummy \
862 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
863 @for i in $(SCRIPTDIR) $(LIBDEST); \
865 if test ! -d $(DESTDIR)$$i; then \
866 echo "Creating directory $$i"; \
867 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
871 @for d in $(LIBSUBDIRS); \
873 a=$(srcdir)/Lib/$$d; \
874 if test ! -d $$a; then continue; else true; fi; \
876 if test ! -d $(DESTDIR)$$b; then \
877 echo "Creating directory $$b"; \
878 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
882 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
884 if test -x $$i; then \
885 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
886 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
888 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
889 echo $(INSTALL_DATA) $$i $(LIBDEST); \
892 @for d in $(LIBSUBDIRS); \
894 a=$(srcdir)/Lib/$$d; \
895 if test ! -d $$a; then continue; else true; fi; \
896 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
906 if test -d $$i; then continue; fi; \
907 if test -x $$i; then \
908 echo $(INSTALL_SCRIPT) $$i $$b; \
909 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
911 echo $(INSTALL_DATA) $$i $$b; \
912 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
917 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
918 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
919 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
921 -x 'bad_coding|badsyntax|site-packages|py2_test_grammar' \
923 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
924 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
926 -x 'bad_coding|badsyntax|site-packages|py2_test_grammar' \
928 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
929 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
930 -d $(LIBDEST)/site-packages -f \
931 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
932 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
933 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
934 -d $(LIBDEST)/site-packages -f \
935 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
936 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
937 ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
939 # Create the PLATDIR source directory, if one wasn't distributed..
940 $(srcdir)/Lib/$(PLATDIR):
941 mkdir $(srcdir)/Lib/$(PLATDIR)
942 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
943 export PATH; PATH="`pwd`:$$PATH"; \
944 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
945 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
946 export EXE; EXE="$(BUILDEXE)"; \
947 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
949 # Install the include files
950 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
952 @for i in $(INCLDIRSTOMAKE); \
954 if test ! -d $(DESTDIR)$$i; then \
955 echo "Creating directory $$i"; \
956 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
960 @for i in $(srcdir)/Include/*.h; \
962 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
963 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
965 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
967 # Install the library and miscellaneous stuff needed for extending/embedding
968 # This goes into $(exec_prefix)
969 LIBPL= $(LIBP)/config
971 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
973 if test ! -d $(DESTDIR)$$i; then \
974 echo "Creating directory $$i"; \
975 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
979 @if test -d $(LIBRARY); then :; else \
980 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
981 if test "$(SO)" = .dll; then \
982 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
984 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
985 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
988 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
991 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
992 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
993 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
994 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
995 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
996 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
997 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
998 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
999 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1000 # Substitution happens here, as the completely-expanded BINDIR
1001 # is not available in configure
1002 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1003 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
1005 @if [ -s Modules/python.exp -a \
1006 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1007 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1008 $(INSTALL_DATA) Modules/python.exp \
1009 $(DESTDIR)$(LIBPL)/python.exp; \
1010 echo; echo "$(LIBPL)/python.exp"; \
1011 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
1012 $(DESTDIR)$(LIBPL)/makexp_aix; \
1013 echo "$(LIBPL)/makexp_aix"; \
1014 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
1015 $(DESTDIR)$(LIBPL)/ld_so_aix; \
1016 echo "$(LIBPL)/ld_so_aix"; \
1017 echo; echo "See Misc/AIX-NOTES for details."; \
1021 # Install the dynamically loadable modules
1022 # This goes into $(exec_prefix)
1024 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1025 --prefix=$(prefix) \
1026 --install-scripts=$(BINDIR) \
1027 --install-platlib=$(DESTSHARED) \
1030 # Here are a couple of targets for MacOSX again, to install a full
1031 # framework-based Python. frameworkinstall installs everything, the
1032 # subtargets install specific parts. Much of the actual work is offloaded to
1033 # the Makefile in Mac
1036 # This target is here for backward compatiblity, previous versions of Python
1037 # hadn't integrated framework installation in the normal install process.
1038 frameworkinstall: install
1040 # On install, we re-make the framework
1041 # structure in the install location, /Library/Frameworks/ or the argument to
1042 # --enable-framework. If --enable-framework has been specified then we have
1043 # automatically set prefix to the location deep down in the framework, so we
1044 # only have to cater for the structural bits of the framework.
1046 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1048 frameworkinstallstructure: $(LDLIBRARY)
1049 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1050 echo Not configured with --enable-framework; \
1054 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1055 if test ! -d $(DESTDIR)$$i; then \
1056 echo "Creating directory $(DESTDIR)$$i"; \
1057 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1061 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1062 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1063 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1064 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1065 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1066 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1067 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1069 # This installs Mac/Lib into the framework
1070 # Install a number of symlinks to keep software that expects a normal unix
1071 # install (which includes python-config) happy.
1072 frameworkinstallmaclib:
1073 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1075 # This installs the IDE, the Launcher and other apps into /Applications
1076 frameworkinstallapps:
1077 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1079 frameworkinstallapps4way:
1080 cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
1082 # This install the unix python and pythonw tools in /usr/local/bin
1083 frameworkinstallunixtools:
1084 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1086 frameworkinstallunixtools4way:
1087 cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
1089 frameworkaltinstallunixtools:
1090 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1092 frameworkaltinstallunixtools4way:
1093 cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
1095 # This installs the Demos and Tools into the applications directory.
1096 # It is not part of a normal frameworkinstall
1097 frameworkinstallextras:
1098 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1100 # This installs a few of the useful scripts in Tools/scripts
1102 SRCDIR=$(srcdir) $(RUNSHARED) \
1103 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1104 --prefix=$(prefix) \
1105 --install-scripts=$(BINDIR) \
1108 # Build the toplevel Makefile
1109 Makefile.pre: Makefile.pre.in config.status
1110 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1111 $(MAKE) -f Makefile.pre Makefile
1113 # Run the configure script.
1114 config.status: $(srcdir)/configure
1115 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1117 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1119 # Some make's put the object file in the current directory
1121 $(CC) -c $(PY_CFLAGS) -o $@ $<
1123 # Run reindent on the library
1125 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1127 # Rerun configure with the same options as it was run last time,
1128 # provided the config.status script exists
1130 $(SHELL) config.status --recheck
1131 $(SHELL) config.status
1133 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1135 (cd $(srcdir); autoconf)
1136 (cd $(srcdir); autoheader)
1138 # Create a tags file for vi
1141 ctags -w -t Include/*.h; \
1142 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1146 # Create a tags file for GNU Emacs
1149 etags Include/*.h; \
1150 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1152 # Sanitation targets -- clean leaves libraries, executables and tags
1153 # files, which clobber removes those as well
1155 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1158 -rm -f *BAD *GOOD *SKIPPED
1162 -rm -f gb-18030-2000.xml
1166 -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1169 find . -name '*.o' -exec rm -f {} ';'
1170 find . -name '*.s[ol]' -exec rm -f {} ';'
1171 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1172 find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1175 find . -name '*.gc??' -exec rm -f {} ';'
1177 clobber: clean profile-removal
1178 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1180 config.cache config.log pyconfig.h Modules/config.c
1181 -rm -rf build platform
1182 -rm -rf $(PYTHONFRAMEWORKDIR)
1184 # Make things extra clean, before making a distribution:
1185 # remove all generated files, even Makefile[.pre]
1186 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1188 -rm -f core Makefile Makefile.pre config.status \
1189 Modules/Setup Modules/Setup.local Modules/Setup.config
1190 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1191 -o -name '[@,#]*' -o -name '*.old' \
1192 -o -name '*.orig' -o -name '*.rej' \
1193 -o -name '*.bak' ')' \
1196 # Check for smelly exported symbols (not starting with Py/_Py)
1198 nm -p $(LIBRARY) | \
1199 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1201 # Find files with funny names
1206 -o -name '*.[chs]' \
1219 -o -name '*.decTest' \
1220 -o -name '*,[vpt]' \
1222 -o -name 'Setup.*' \
1226 -o -name ChangeLog \
1227 -o -name Repository \
1233 -o -name .cvsignore \
1237 # Perform some verification checks on any modified files.
1239 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1243 Python/thread.o: @THREADHEADERS@
1245 # Declare targets that aren't real files
1246 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1247 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1248 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1249 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1250 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1251 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1252 .PHONY: smelly funny patchcheck
1254 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY