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
38 LDVERSION= @LDVERSION@
39 HGVERSION= @HGVERSION@
45 # Shell used by make (some versions default to the login shell, which is bad)
48 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
51 # Portable install script (configure doesn't always guess right)
53 INSTALL_PROGRAM=@INSTALL_PROGRAM@
54 INSTALL_SCRIPT= @INSTALL_SCRIPT@
55 INSTALL_DATA= @INSTALL_DATA@
56 # Shared libraries must be installed with executable mode on some systems;
57 # rather than figuring out exactly which, we always give them executable mode.
58 # Also, making them read-only seems to be a good idea...
59 INSTALL_SHARED= ${INSTALL} -m 555
63 MAKESETUP= $(srcdir)/Modules/makesetup
67 BASECFLAGS= @BASECFLAGS@
68 CONFIGURE_CFLAGS= @CFLAGS@
69 CONFIGURE_CPPFLAGS= @CPPFLAGS@
70 CONFIGURE_LDFLAGS= @LDFLAGS@
71 # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
72 # command line to append to these values without stomping the pre-set
74 PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
75 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
76 # be able to build extension modules using the directories specified in the
77 # environment variables
78 PY_CPPFLAGS= -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
79 PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
80 NO_AS_NEEDED= @NO_AS_NEEDED@
84 LINKFORSHARED= @LINKFORSHARED@
86 # Extra C flags added for building the interpreter object files.
87 CFLAGSFORSHARED=@CFLAGSFORSHARED@
88 # C flags used for building the interpreter object files
89 PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
92 # Machine-dependent subdirectories
95 # Install prefix for architecture-independent files
98 # Install prefix for architecture-dependent files
99 exec_prefix= @exec_prefix@
101 # Install prefix for data files
102 datarootdir= @datarootdir@
104 # Expanded directories
108 INCLUDEDIR= @includedir@
109 CONFINCLUDEDIR= $(exec_prefix)/include
110 SCRIPTDIR= $(prefix)/lib
113 # Detailed destination directories
114 BINLIBDEST= $(LIBDIR)/python$(VERSION)
115 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
116 INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
117 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
119 # Symbols used for using shared libraries
121 LDSHARED= @LDSHARED@ $(PY_LDFLAGS)
122 BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS)
123 LDCXXSHARED= @LDCXXSHARED@
124 DESTSHARED= $(BINLIBDEST)/lib-dynload
126 # Executable suffix (.exe on Windows and Mac OS X)
128 BUILDEXE= @BUILDEXEEXT@
130 # Short name and location for Mac OS X Python framework
131 UNIVERSALSDK=@UNIVERSALSDK@
132 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
133 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
134 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
135 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
136 # Deployment target selected during configure, to be checked
137 # by distutils. The export statement is needed to ensure that the
138 # deployment target is active during build.
139 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
140 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
142 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
143 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
145 # Environment to run shared python without installed libraries
146 RUNSHARED= @RUNSHARED@
148 # Modes for directories, executables and data files created by the
149 # install process. Default to user-only-writable for all file types.
154 # configure script arguments
155 CONFIG_ARGS= @CONFIG_ARGS@
158 # Subdirectories with code
161 # Other subdirectories
162 SUBDIRSTOO= Include Lib Misc
164 # Files and directories to be distributed
165 CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
166 DISTFILES= README ChangeLog $(CONFIGFILES)
167 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
168 DIST= $(DISTFILES) $(DISTDIRS)
172 LDLIBRARY= @LDLIBRARY@
173 BLDLIBRARY= @BLDLIBRARY@
174 PY3LIBRARY= @PY3LIBRARY@
175 DLLLIBRARY= @DLLLIBRARY@
176 LDLIBRARYDIR= @LDLIBRARYDIR@
177 INSTSONAME= @INSTSONAME@
183 SYSLIBS= $(LIBM) $(LIBC)
186 THREADOBJ= @THREADOBJ@
187 DLINCLDIR= @DLINCLDIR@
188 DYNLOADFILE= @DYNLOADFILE@
189 MACHDEP_OBJS= @MACHDEP_OBJS@
194 BUILDPYTHON= python$(BUILDEXE)
196 # The task to run while instrument when building the profile-opt target
197 PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
198 #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
200 # === Definitions added by makesetup ===
203 ##########################################################################
211 # Used of signalmodule.o is not available
212 SIGNAL_OBJS= @SIGNAL_OBJS@
214 IO_H= Modules/_io/_iomodule.h
217 Modules/_io/_iomodule.o \
218 Modules/_io/iobase.o \
219 Modules/_io/fileio.o \
220 Modules/_io/bufferedio.o \
221 Modules/_io/textio.o \
222 Modules/_io/bytesio.o \
223 Modules/_io/stringio.o
225 ##########################################################################
227 GRAMMAR_H= $(srcdir)/Include/graminit.h
228 GRAMMAR_C= $(srcdir)/Python/graminit.c
229 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
232 LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
234 ##########################################################################
236 PGEN= Parser/pgen$(EXE)
245 Parser/metagrammar.c \
257 Parser/metagrammar.o \
262 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
266 Python/dynamic_annotations.c \
267 Python/mysnprintf.c \
269 Parser/tokenizer_pgen.c \
270 Parser/printgrammar.c \
271 Parser/parsetok_pgen.c \
276 Python/dynamic_annotations.o \
277 Python/mysnprintf.o \
279 Parser/tokenizer_pgen.o \
280 Parser/printgrammar.o \
281 Parser/parsetok_pgen.o \
285 $(srcdir)/Parser/parser.h \
286 $(srcdir)/Include/parsetok.h \
287 $(srcdir)/Parser/tokenizer.h
289 PGENSRCS= $(PSRCS) $(PGSRCS)
290 PGENOBJS= $(POBJS) $(PGOBJS)
292 ##########################################################################
294 AST_H_DIR= $(srcdir)/Include
295 AST_H= $(AST_H_DIR)/Python-ast.h
296 AST_C_DIR= $(srcdir)/Python
297 AST_C= $(AST_C_DIR)/Python-ast.c
298 AST_ASDL= $(srcdir)/Parser/Python.asdl
300 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
301 # XXX Note that a build now requires Python exist before the build starts
302 ASDLGEN= @DISABLE_ASDLGEN@ $(srcdir)/Parser/asdl_c.py
304 ##########################################################################
308 $(srcdir)/Python/opcode_targets.h
311 $(srcdir)/Python/makeopcodetargets.py
313 OPCODETARGETGEN_FILES= \
314 $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
318 Python/Python-ast.o \
321 Python/bltinmodule.o \
325 Python/dynamic_annotations.o \
327 Python/frozenmain.o \
330 Python/getcompiler.o \
331 Python/getcopyright.o \
332 Python/getplatform.o \
333 Python/getversion.o \
338 Python/modsupport.o \
340 Python/mysnprintf.o \
350 Python/structmember.o \
358 Python/formatter_unicode.o \
360 Python/$(DYNLOADFILE) \
366 ##########################################################################
371 Objects/boolobject.o \
372 Objects/bytes_methods.o \
373 Objects/bytearrayobject.o \
374 Objects/bytesobject.o \
375 Objects/cellobject.o \
376 Objects/classobject.o \
377 Objects/codeobject.o \
378 Objects/complexobject.o \
379 Objects/descrobject.o \
380 Objects/enumobject.o \
381 Objects/exceptions.o \
382 Objects/genobject.o \
383 Objects/fileobject.o \
384 Objects/floatobject.o \
385 Objects/frameobject.o \
386 Objects/funcobject.o \
387 Objects/iterobject.o \
388 Objects/listobject.o \
389 Objects/longobject.o \
390 Objects/dictobject.o \
391 Objects/memoryobject.o \
392 Objects/methodobject.o \
393 Objects/moduleobject.o \
394 Objects/namespaceobject.o \
398 Objects/rangeobject.o \
399 Objects/setobject.o \
400 Objects/sliceobject.o \
401 Objects/structseq.o \
402 Objects/tupleobject.o \
403 Objects/typeobject.o \
404 Objects/unicodeobject.o \
405 Objects/unicodectype.o \
406 Objects/weakrefobject.o
408 SYSCONFIGDATA=$(srcdir)/Lib/_sysconfigdata.py
410 ##########################################################################
411 # objects that get linked into the Python library
412 LIBRARY_OBJS_OMIT_FROZEN= \
413 Modules/getbuildinfo.o \
422 $(LIBRARY_OBJS_OMIT_FROZEN) \
425 #########################################################################
430 build_all: $(BUILDPYTHON) $(SYSCONFIGDATA) oldsharedmods sharedmods gdbhooks Modules/_testembed
432 # Compile a binary with gcc profile guided optimization.
434 @echo "Building with support for profile generation:"
436 $(MAKE) build_all_generate_profile
437 @echo "Running benchmark to generate profile data:"
438 $(MAKE) profile-removal
439 $(MAKE) run_profile_task
440 @echo "Rebuilding with profile guided optimizations:"
442 $(MAKE) build_all_use_profile
444 build_all_generate_profile:
445 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
448 $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
450 build_all_use_profile:
451 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
454 @echo "Building with support for coverage checking:"
456 $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
459 # Build the interpreter
460 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
461 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
463 platform: $(BUILDPYTHON) $(SYSCONFIGDATA)
464 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
466 # Generate the sysconfig build-time data
467 $(SYSCONFIGDATA): $(BUILDPYTHON)
468 $(RUNSHARED) ./$(BUILDPYTHON) -SE -m sysconfig --generate-posix-vars
470 # Build the shared modules
471 sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA)
472 @case $$MAKEFLAGS in \
473 *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
474 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
477 # Build static library
478 # avoid long command lines, same as LIBRARY_OBJS
479 $(LIBRARY): $(LIBRARY_OBJS)
481 $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
482 $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
483 $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
484 $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
485 $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
486 $(AR) $(ARFLAGS) $@ $(MODOBJS)
489 libpython$(LDVERSION).so: $(LIBRARY_OBJS)
490 if test $(INSTSONAME) != $(LDLIBRARY); then \
491 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
492 $(LN) -f $(INSTSONAME) $@; \
494 $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
497 libpython3.so: libpython$(LDVERSION).so
498 $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
500 libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
501 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
504 libpython$(VERSION).sl: $(LIBRARY_OBJS)
505 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
507 # Copy up the gdb python hooks into a position where they can be automatically
508 # loaded by gdb during Lib/test/test_gdb.py
510 # Distributors are likely to want to install this somewhere else e.g. relative
511 # to the stripped DWARF data for the shared library.
512 gdbhooks: $(BUILDPYTHON)-gdb.py
514 SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
515 $(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
516 $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
518 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
519 # minimal framework (not including the Lib directory and such) in the current
521 RESSRCDIR=Mac/Resources/framework
522 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
524 $(RESSRCDIR)/Info.plist
525 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
526 $(CC) -o $(LDLIBRARY) $(PY_LDFLAGS) -dynamiclib \
527 -all_load $(LIBRARY) -Wl,-single_module \
528 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
529 -compatibility_version $(VERSION) \
530 -current_version $(VERSION) \
531 -framework CoreFoundation $(LIBS);
532 $(INSTALL) -d -m $(DIRMODE) \
533 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
534 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
535 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
536 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
537 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
538 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
540 # This rule builds the Cygwin Python DLL and import library if configured
541 # for a shared core library; otherwise, this rule is a noop.
542 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
543 if test -n "$(DLLLIBRARY)"; then \
544 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
545 $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
550 oldsharedmods: $(SHAREDMODS)
553 Makefile Modules/config.c: Makefile.pre \
554 $(srcdir)/Modules/config.c.in \
556 Modules/Setup.config \
559 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
561 Modules/Setup.config \
562 Modules/Setup.local \
565 @echo "The Makefile was updated, you may need to re-run make."
568 Modules/Setup: $(srcdir)/Modules/Setup.dist
569 @if test -f Modules/Setup; then \
570 echo "-----------------------------------------------"; \
571 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
572 echo "check to make sure you have all the updates you"; \
573 echo "need in your Modules/Setup file."; \
574 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
575 echo "-----------------------------------------------"; \
578 Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
579 $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
581 ############################################################################
584 Modules/_freeze_importlib: Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
585 $(LINKCC) $(PY_LDFLAGS) -o $@ Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
587 Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
588 $(MAKE) Modules/_freeze_importlib
589 ./Modules/_freeze_importlib \
590 $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
593 ############################################################################
594 # Special rules for object files
596 Modules/getbuildinfo.o: $(PARSER_OBJS) \
602 $(srcdir)/Modules/getbuildinfo.c
603 $(CC) -c $(PY_CORE_CFLAGS) \
604 -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
605 -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
606 -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
607 -o $@ $(srcdir)/Modules/getbuildinfo.c
609 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
610 $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
611 -DPREFIX='"$(prefix)"' \
612 -DEXEC_PREFIX='"$(exec_prefix)"' \
613 -DVERSION='"$(VERSION)"' \
614 -DVPATH='"$(VPATH)"' \
615 -o $@ $(srcdir)/Modules/getpath.c
617 Modules/python.o: $(srcdir)/Modules/python.c
618 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
620 Modules/_testembed.o: $(srcdir)/Modules/_testembed.c
621 $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/_testembed.c
623 Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
624 $(CC) -c $(PY_CORE_CFLAGS) \
625 -DSOABI='"$(SOABI)"' \
626 -o $@ $(srcdir)/Python/dynload_shlib.c
628 Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
629 $(CC) -c $(PY_CORE_CFLAGS) \
630 -DABIFLAGS='"$(ABIFLAGS)"' \
631 -o $@ $(srcdir)/Python/sysmodule.c
635 $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
638 $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
639 $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
644 $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
646 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
647 $(srcdir)/Include/token.h \
648 $(srcdir)/Include/grammar.h
649 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
651 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
652 Parser/parsetok_pgen.o: $(srcdir)/Parser/parsetok.c
653 Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c
655 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
657 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
658 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
660 $(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES)
661 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
663 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
665 Python/getplatform.o: $(srcdir)/Python/getplatform.c
666 $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
668 Python/importdl.o: $(srcdir)/Python/importdl.c
669 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
671 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
672 $(srcdir)/Objects/unicodetype_db.h
675 $(srcdir)/Include/bytes_methods.h \
676 $(srcdir)/Objects/stringlib/count.h \
677 $(srcdir)/Objects/stringlib/ctype.h \
678 $(srcdir)/Objects/stringlib/eq.h \
679 $(srcdir)/Objects/stringlib/fastsearch.h \
680 $(srcdir)/Objects/stringlib/find.h \
681 $(srcdir)/Objects/stringlib/find_max_char.h \
682 $(srcdir)/Objects/stringlib/partition.h \
683 $(srcdir)/Objects/stringlib/split.h \
684 $(srcdir)/Objects/stringlib/stringdefs.h \
685 $(srcdir)/Objects/stringlib/transmogrify.h \
686 $(srcdir)/Objects/stringlib/unicodedefs.h \
687 $(srcdir)/Objects/stringlib/localeutil.h \
688 $(srcdir)/Objects/stringlib/undef.h
690 UNICODE_DEPS = $(BYTESTR_DEPS) \
691 $(srcdir)/Objects/stringlib/asciilib.h \
692 $(srcdir)/Objects/stringlib/codecs.h \
693 $(srcdir)/Objects/stringlib/ucs1lib.h \
694 $(srcdir)/Objects/stringlib/ucs2lib.h \
695 $(srcdir)/Objects/stringlib/ucs4lib.h \
696 $(srcdir)/Objects/stringlib/unicode_format.h \
697 $(srcdir)/Objects/stringlib/unicodedefs.h
699 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
701 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
703 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS)
705 Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h
706 Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
708 $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
709 $(OPCODETARGETGEN) $(OPCODETARGETS_H)
711 Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
713 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
716 Python/frozen.o: $(srcdir)/Python/importlib.h
718 Objects/typeobject.o: $(srcdir)/Objects/typeslots.inc
719 $(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
720 $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc
722 ############################################################################
726 $(srcdir)/Include/Python.h \
727 $(srcdir)/Include/abstract.h \
728 $(srcdir)/Include/accu.h \
729 $(srcdir)/Include/asdl.h \
730 $(srcdir)/Include/ast.h \
731 $(srcdir)/Include/bltinmodule.h \
732 $(srcdir)/Include/bitset.h \
733 $(srcdir)/Include/boolobject.h \
734 $(srcdir)/Include/bytes_methods.h \
735 $(srcdir)/Include/bytearrayobject.h \
736 $(srcdir)/Include/bytesobject.h \
737 $(srcdir)/Include/cellobject.h \
738 $(srcdir)/Include/ceval.h \
739 $(srcdir)/Include/classobject.h \
740 $(srcdir)/Include/code.h \
741 $(srcdir)/Include/codecs.h \
742 $(srcdir)/Include/compile.h \
743 $(srcdir)/Include/complexobject.h \
744 $(srcdir)/Include/descrobject.h \
745 $(srcdir)/Include/dictobject.h \
746 $(srcdir)/Include/dtoa.h \
747 $(srcdir)/Include/dynamic_annotations.h \
748 $(srcdir)/Include/enumobject.h \
749 $(srcdir)/Include/errcode.h \
750 $(srcdir)/Include/eval.h \
751 $(srcdir)/Include/fileobject.h \
752 $(srcdir)/Include/fileutils.h \
753 $(srcdir)/Include/floatobject.h \
754 $(srcdir)/Include/frameobject.h \
755 $(srcdir)/Include/funcobject.h \
756 $(srcdir)/Include/genobject.h \
757 $(srcdir)/Include/import.h \
758 $(srcdir)/Include/intrcheck.h \
759 $(srcdir)/Include/iterobject.h \
760 $(srcdir)/Include/listobject.h \
761 $(srcdir)/Include/longintrepr.h \
762 $(srcdir)/Include/longobject.h \
763 $(srcdir)/Include/marshal.h \
764 $(srcdir)/Include/memoryobject.h \
765 $(srcdir)/Include/metagrammar.h \
766 $(srcdir)/Include/methodobject.h \
767 $(srcdir)/Include/modsupport.h \
768 $(srcdir)/Include/moduleobject.h \
769 $(srcdir)/Include/namespaceobject.h \
770 $(srcdir)/Include/node.h \
771 $(srcdir)/Include/object.h \
772 $(srcdir)/Include/objimpl.h \
773 $(srcdir)/Include/opcode.h \
774 $(srcdir)/Include/osdefs.h \
775 $(srcdir)/Include/patchlevel.h \
776 $(srcdir)/Include/pgen.h \
777 $(srcdir)/Include/pgenheaders.h \
778 $(srcdir)/Include/pyarena.h \
779 $(srcdir)/Include/pyatomic.h \
780 $(srcdir)/Include/pycapsule.h \
781 $(srcdir)/Include/pyctype.h \
782 $(srcdir)/Include/pydebug.h \
783 $(srcdir)/Include/pyerrors.h \
784 $(srcdir)/Include/pyfpe.h \
785 $(srcdir)/Include/pymath.h \
786 $(srcdir)/Include/pygetopt.h \
787 $(srcdir)/Include/pymacro.h \
788 $(srcdir)/Include/pymem.h \
789 $(srcdir)/Include/pyport.h \
790 $(srcdir)/Include/pystate.h \
791 $(srcdir)/Include/pystrcmp.h \
792 $(srcdir)/Include/pystrtod.h \
793 $(srcdir)/Include/pythonrun.h \
794 $(srcdir)/Include/pythread.h \
795 $(srcdir)/Include/pytime.h \
796 $(srcdir)/Include/rangeobject.h \
797 $(srcdir)/Include/setobject.h \
798 $(srcdir)/Include/sliceobject.h \
799 $(srcdir)/Include/structmember.h \
800 $(srcdir)/Include/structseq.h \
801 $(srcdir)/Include/symtable.h \
802 $(srcdir)/Include/sysmodule.h \
803 $(srcdir)/Include/traceback.h \
804 $(srcdir)/Include/tupleobject.h \
805 $(srcdir)/Include/ucnhash.h \
806 $(srcdir)/Include/unicodeobject.h \
807 $(srcdir)/Include/warnings.h \
808 $(srcdir)/Include/weakrefobject.h \
812 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
815 ######################################################################
817 TESTOPTS= $(EXTRATESTOPTS)
818 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
819 TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
822 # Run a basic set of regression tests.
823 # This excludes some tests that are particularly resource-intensive.
825 $(TESTRUNNER) $(TESTOPTS)
827 # Run the full test suite twice - once without .pyc files, and once with.
828 # In the past, we've had problems where bugs in the marshalling or
829 # elsewhere caused bytecode read from .pyc files to behave differently
830 # than bytecode generated directly from a .py source file. Sometimes
831 # the bytecode read from a .pyc file had the bug, sometimes the directly
832 # generated bytecode. This is sometimes a very shy bug needing a lot of
834 testall: all platform
835 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
836 $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
837 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
838 -$(TESTRUNNER) -u all $(TESTOPTS)
839 $(TESTRUNNER) -u all $(TESTOPTS)
841 # Run the test suite for both architectures in a Universal build on OSX.
842 # Must be run on an Intel box.
843 testuniversal: all platform
844 if [ `arch` != 'i386' ];then \
845 echo "This can only be used on OSX/i386" ;\
848 $(TESTRUNNER) -u all $(TESTOPTS)
849 $(RUNSHARED) /usr/libexec/oah/translate \
850 ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS)
852 # Like testall, but with only one pass and without multiple processes.
853 # Run an optional script to include information about the build environment.
854 buildbottest: all platform
855 -@if which pybuildbot.identify >/dev/null 2>&1; then \
856 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
858 $(TESTRUNNER) -j 1 -u all -W --timeout=$(TESTTIMEOUT) $(TESTOPTS)
860 QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
861 test_multibytecodec test_urllib2_localnet test_itertools \
862 test_multiprocessing test_mailbox test_socket test_poll \
863 test_select test_zipfile test_concurrent_futures
864 quicktest: all platform
865 $(TESTRUNNER) $(QUICKTESTOPTS)
868 install: altinstall bininstall
870 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
871 sharedinstall oldsharedinstall maninstall @FRAMEWORKALTINSTALLLAST@
873 # Install shared libraries enabled by Setup
874 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
876 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
877 @for i in X $(SHAREDMODS); do \
878 if test $$i != X; then \
879 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
880 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
885 @for i in $(DESTDIRS); \
887 if test ! -d $(DESTDIR)$$i; then \
888 echo "Creating directory $$i"; \
889 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
894 # Install the interpreter with $(VERSION) affixed
895 # This goes into $(exec_prefix)
896 altbininstall: $(BUILDPYTHON)
897 @for i in $(BINDIR) $(LIBDIR); \
899 if test ! -d $(DESTDIR)$$i; then \
900 echo "Creating directory $$i"; \
901 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
905 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE)
906 -if test "$(VERSION)" != "$(LDVERSION)"; then \
907 if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
908 then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
910 (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
912 if test -f $(LDLIBRARY); then \
913 if test -n "$(DLLLIBRARY)" ; then \
914 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
916 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
917 if test $(LDLIBRARY) != $(INSTSONAME); then \
918 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
921 if test -n "$(PY3LIBRARY)"; then \
922 $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
927 bininstall: altbininstall
928 -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \
929 then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \
932 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE))
933 -if test "$(VERSION)" != "$(LDVERSION)"; then \
934 rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
935 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
936 rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \
937 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \
939 -rm -f $(DESTDIR)$(BINDIR)/python3-config
940 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
941 -rm -f $(DESTDIR)$(LIBPC)/python3.pc
942 (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
943 -rm -f $(DESTDIR)$(BINDIR)/idle3
944 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
945 -rm -f $(DESTDIR)$(BINDIR)/pydoc3
946 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
947 -rm -f $(DESTDIR)$(BINDIR)/2to3
948 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
949 -rm -f $(DESTDIR)$(BINDIR)/pyvenv
950 (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
952 # Install the manual page
954 @for i in $(MANDIR) $(MANDIR)/man1; \
956 if test ! -d $(DESTDIR)$$i; then \
957 echo "Creating directory $$i"; \
958 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
962 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
963 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
965 # Install the library
966 PLATDIR= plat-$(MACHDEP)
967 EXTRAPLATDIR= @EXTRAPLATDIR@
968 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
969 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
970 LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
971 tkinter/test/test_ttk site-packages test \
972 test/capath test/data \
973 test/cjkencodings test/decimaltestdata test/xmltestdata \
974 test/subprocessdata test/sndhdrdata \
975 test/tracedmodules test/encoded_modules \
976 test/namespace_pkgs \
977 test/namespace_pkgs/both_portions \
978 test/namespace_pkgs/both_portions/foo \
979 test/namespace_pkgs/not_a_namespace_pkg \
980 test/namespace_pkgs/not_a_namespace_pkg/foo \
981 test/namespace_pkgs/portion1 \
982 test/namespace_pkgs/portion1/foo \
983 test/namespace_pkgs/portion2 \
984 test/namespace_pkgs/portion2/foo \
985 test/namespace_pkgs/project1 \
986 test/namespace_pkgs/project1/parent \
987 test/namespace_pkgs/project1/parent/child \
988 test/namespace_pkgs/project2 \
989 test/namespace_pkgs/project2/parent \
990 test/namespace_pkgs/project2/parent/child \
991 test/namespace_pkgs/project3 \
992 test/namespace_pkgs/project3/parent \
993 test/namespace_pkgs/project3/parent/child \
994 collections concurrent concurrent/futures encodings \
995 email email/mime test/test_email test/test_email/data \
996 html json test/json_tests http dbm xmlrpc \
997 sqlite3 sqlite3/test \
998 logging csv wsgiref urllib \
999 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
1000 lib2to3/tests/data lib2to3/tests/data/fixers \
1001 lib2to3/tests/data/fixers/myfixes \
1002 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
1003 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
1004 importlib importlib/test importlib/test/builtin \
1005 importlib/test/extension importlib/test/frozen \
1006 importlib/test/import_ importlib/test/source \
1008 multiprocessing multiprocessing/dummy \
1009 unittest unittest/test unittest/test/testmock \
1010 venv venv/scripts venv/scripts/posix \
1011 curses pydoc_data $(MACHDEPS)
1012 libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
1013 @for i in $(SCRIPTDIR) $(LIBDEST); \
1015 if test ! -d $(DESTDIR)$$i; then \
1016 echo "Creating directory $$i"; \
1017 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1021 @for d in $(LIBSUBDIRS); \
1023 a=$(srcdir)/Lib/$$d; \
1024 if test ! -d $$a; then continue; else true; fi; \
1026 if test ! -d $(DESTDIR)$$b; then \
1027 echo "Creating directory $$b"; \
1028 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
1032 @for i in $(srcdir)/Lib/*.py ; \
1034 if test -x $$i; then \
1035 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
1036 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
1038 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
1039 echo $(INSTALL_DATA) $$i $(LIBDEST); \
1042 @for d in $(LIBSUBDIRS); \
1044 a=$(srcdir)/Lib/$$d; \
1045 if test ! -d $$a; then continue; else true; fi; \
1046 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
1056 if test -d $$i; then continue; fi; \
1057 if test -x $$i; then \
1058 echo $(INSTALL_SCRIPT) $$i $$b; \
1059 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
1061 echo $(INSTALL_DATA) $$i $$b; \
1062 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
1067 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
1068 if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
1069 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
1070 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
1072 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1073 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
1075 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1076 $(DESTDIR)$(LIBDEST)
1077 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1078 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
1080 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1081 $(DESTDIR)$(LIBDEST)
1082 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1083 ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
1084 -d $(LIBDEST)/site-packages -f \
1085 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1086 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1087 ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
1088 -d $(LIBDEST)/site-packages -f \
1089 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1090 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1091 ./$(BUILDPYTHON) -Wi -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
1093 # Create the PLATDIR source directory, if one wasn't distributed..
1094 $(srcdir)/Lib/$(PLATDIR):
1095 mkdir $(srcdir)/Lib/$(PLATDIR)
1096 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
1097 export PATH; PATH="`pwd`:$$PATH"; \
1098 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
1099 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
1100 export EXE; EXE="$(BUILDEXE)"; \
1101 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
1103 python-config: $(srcdir)/Misc/python-config.in
1104 # Substitution happens here, as the completely-expanded BINDIR
1105 # is not available in configure
1106 sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
1108 # Install the include files
1109 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1111 @for i in $(INCLDIRSTOMAKE); \
1113 if test ! -d $(DESTDIR)$$i; then \
1114 echo "Creating directory $$i"; \
1115 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1119 @for i in $(srcdir)/Include/*.h; \
1121 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1122 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1124 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1126 # Install the library and miscellaneous stuff needed for extending/embedding
1127 # This goes into $(exec_prefix)
1128 LIBPL= $(LIBDEST)/config-$(LDVERSION)
1130 # pkgconfig directory
1131 LIBPC= $(LIBDIR)/pkgconfig
1133 libainstall: all python-config
1134 @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
1136 if test ! -d $(DESTDIR)$$i; then \
1137 echo "Creating directory $$i"; \
1138 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1142 @if test -d $(LIBRARY); then :; else \
1143 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1144 if test "$(SO)" = .dll; then \
1145 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
1147 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1148 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1151 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
1154 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1155 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
1156 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1157 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1158 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1159 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1160 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
1161 $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
1162 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1163 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1164 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
1166 @if [ -s Modules/python.exp -a \
1167 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1168 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1169 $(INSTALL_DATA) Modules/python.exp \
1170 $(DESTDIR)$(LIBPL)/python.exp; \
1171 echo; echo "$(LIBPL)/python.exp"; \
1172 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
1173 $(DESTDIR)$(LIBPL)/makexp_aix; \
1174 echo "$(LIBPL)/makexp_aix"; \
1175 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
1176 $(DESTDIR)$(LIBPL)/ld_so_aix; \
1177 echo "$(LIBPL)/ld_so_aix"; \
1178 echo; echo "See Misc/AIX-NOTES for details."; \
1182 # Install the dynamically loadable modules
1183 # This goes into $(exec_prefix)
1184 sharedinstall: sharedmods
1185 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1186 --prefix=$(prefix) \
1187 --install-scripts=$(BINDIR) \
1188 --install-platlib=$(DESTSHARED) \
1191 # Here are a couple of targets for MacOSX again, to install a full
1192 # framework-based Python. frameworkinstall installs everything, the
1193 # subtargets install specific parts. Much of the actual work is offloaded to
1194 # the Makefile in Mac
1197 # This target is here for backward compatiblity, previous versions of Python
1198 # hadn't integrated framework installation in the normal install process.
1199 frameworkinstall: install
1201 # On install, we re-make the framework
1202 # structure in the install location, /Library/Frameworks/ or the argument to
1203 # --enable-framework. If --enable-framework has been specified then we have
1204 # automatically set prefix to the location deep down in the framework, so we
1205 # only have to cater for the structural bits of the framework.
1207 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1209 frameworkinstallstructure: $(LDLIBRARY)
1210 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1211 echo Not configured with --enable-framework; \
1215 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1216 if test ! -d $(DESTDIR)$$i; then \
1217 echo "Creating directory $(DESTDIR)$$i"; \
1218 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1222 $(LN) -fsn include/python$(LDVERSION) $(DESTDIR)$(prefix)/Headers
1223 sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1224 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1225 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1226 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1227 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1228 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1230 # This installs Mac/Lib into the framework
1231 # Install a number of symlinks to keep software that expects a normal unix
1232 # install (which includes python-config) happy.
1233 frameworkinstallmaclib:
1234 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).a"
1235 ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).dylib"
1236 ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1238 # This installs the IDE, the Launcher and other apps into /Applications
1239 frameworkinstallapps:
1240 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1242 # This install the unix python and pythonw tools in /usr/local/bin
1243 frameworkinstallunixtools:
1244 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1246 frameworkaltinstallunixtools:
1247 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1249 # This installs the Tools into the applications directory.
1250 # It is not part of a normal frameworkinstall
1251 frameworkinstallextras:
1252 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1254 # This installs a few of the useful scripts in Tools/scripts
1256 SRCDIR=$(srcdir) $(RUNSHARED) \
1257 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1258 --prefix=$(prefix) \
1259 --install-scripts=$(BINDIR) \
1262 # Build the toplevel Makefile
1263 Makefile.pre: $(srcdir)/Makefile.pre.in config.status
1264 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1265 $(MAKE) -f Makefile.pre Makefile
1267 # Run the configure script.
1268 config.status: $(srcdir)/configure
1269 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1271 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1273 # Some make's put the object file in the current directory
1275 $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
1277 # Run reindent on the library
1279 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1281 # Rerun configure with the same options as it was run last time,
1282 # provided the config.status script exists
1284 $(SHELL) config.status --recheck
1285 $(SHELL) config.status
1287 # Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
1289 (cd $(srcdir); autoconf -Wall)
1290 (cd $(srcdir); autoheader -Wall)
1292 # Create a tags file for vi
1295 ctags -w -t Include/*.h; \
1296 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1300 # Create a tags file for GNU Emacs
1303 etags Include/*.h; \
1304 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1306 # Touch generated files
1308 hg --config extensions.touch=Tools/hg/hgtouch.py touch -v
1310 # Sanitation targets -- clean leaves libraries, executables and tags
1311 # files, which clobber removes as well
1313 -find $(srcdir) -depth -name '__pycache__' -exec rm -rf {} ';'
1314 -find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1317 -rm -f *BAD *GOOD *SKIPPED
1321 -rm -f gb-18030-2000.xml
1325 -rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils
1328 find . -name '*.[oa]' -exec rm -f {} ';'
1329 find . -name '*.s[ol]' -exec rm -f {} ';'
1330 find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
1331 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1332 find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1333 -rm -f Lib/lib2to3/*Grammar*.pickle
1334 -rm -f $(SYSCONFIGDATA)
1335 -rm -f Modules/_testembed Modules/_freeze_importlib
1338 find . -name '*.gc??' -exec rm -f {} ';'
1340 clobber: clean profile-removal
1341 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1343 config.cache config.log pyconfig.h Modules/config.c
1344 -rm -rf build platform
1345 -rm -rf $(PYTHONFRAMEWORKDIR)
1347 # Make things extra clean, before making a distribution:
1348 # remove all generated files, even Makefile[.pre]
1349 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1351 for file in Lib/test/data/* ; do \
1352 if test "$$file" != "Lib/test/data/README"; then rm "$$file"; fi; \
1354 -rm -f core Makefile Makefile.pre config.status \
1355 Modules/Setup Modules/Setup.local Modules/Setup.config \
1356 Modules/ld_so_aix Modules/python.exp Misc/python.pc
1357 -rm -f python*-gdb.py
1358 -rm -f pybuilddir.txt
1359 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1360 -o -name '[@,#]*' -o -name '*.old' \
1361 -o -name '*.orig' -o -name '*.rej' \
1362 -o -name '*.bak' ')' \
1365 # Check for smelly exported symbols (not starting with Py/_Py)
1367 nm -p $(LIBRARY) | \
1368 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1370 # Find files with funny names
1372 find $(SUBDIRS) $(SUBDIRSTOO) \
1374 -o -name '*.[chs]' \
1387 -o -name '*.decTest' \
1388 -o -name '*.tmCommand' \
1389 -o -name '*.tmSnippet' \
1391 -o -name 'Setup.*' \
1397 -o -name ChangeLog \
1398 -o -name .hgignore \
1399 -o -name .bzrignore \
1403 # Perform some verification checks on any modified files.
1405 $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1409 Python/thread.o: @THREADHEADERS@
1411 # Declare targets that aren't real files
1412 .PHONY: all build_all sharedmods oldsharedmods test quicktest
1413 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1414 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1415 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1416 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1417 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1418 .PHONY: smelly funny patchcheck touch
1421 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY