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@
174 UNICODE_OBJS= @UNICODE_OBJS@
177 BUILDPYTHON= python$(BUILDEXE)
179 # === Definitions added by makesetup ===
182 ##########################################################################
190 # Used of signalmodule.o is not available
191 SIGNAL_OBJS= @SIGNAL_OBJS@
194 ##########################################################################
196 GRAMMAR_H= $(srcdir)/Include/graminit.h
197 GRAMMAR_C= $(srcdir)/Python/graminit.c
198 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
201 ##########################################################################
203 PGEN= Parser/pgen$(EXE)
213 Parser/metagrammar.o \
218 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
222 Python/mysnprintf.o \
223 Parser/tokenizer_pgen.o \
224 Parser/printgrammar.o \
231 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
233 ##########################################################################
235 AST_H_DIR= $(srcdir)/Include
236 AST_H= $(AST_H_DIR)/Python-ast.h
237 AST_C_DIR= $(srcdir)/Python
238 AST_C= $(AST_C_DIR)/Python-ast.c
239 AST_ASDL= $(srcdir)/Parser/Python.asdl
241 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
242 # XXX Note that a build now requires Python exist before the build starts
243 ASDLGEN= $(srcdir)/Parser/asdl_c.py
245 ##########################################################################
248 Python/Python-ast.o \
251 Python/bltinmodule.o \
257 Python/frozenmain.o \
260 Python/getcompiler.o \
261 Python/getcopyright.o \
263 Python/getplatform.o \
264 Python/getversion.o \
269 Python/modsupport.o \
271 Python/mysnprintf.o \
277 Python/structmember.o \
284 Python/formatter_unicode.o \
285 Python/formatter_string.o \
286 Python/$(DYNLOADFILE) \
292 ##########################################################################
296 Objects/boolobject.o \
297 Objects/bufferobject.o \
298 Objects/bytes_methods.o \
299 Objects/bytesobject.o \
300 Objects/cellobject.o \
301 Objects/classobject.o \
303 Objects/codeobject.o \
304 Objects/complexobject.o \
305 Objects/descrobject.o \
306 Objects/enumobject.o \
307 Objects/exceptions.o \
308 Objects/genobject.o \
309 Objects/fileobject.o \
310 Objects/floatobject.o \
311 Objects/frameobject.o \
312 Objects/funcobject.o \
313 Objects/intobject.o \
314 Objects/iterobject.o \
315 Objects/listobject.o \
316 Objects/longobject.o \
317 Objects/dictobject.o \
318 Objects/methodobject.o \
319 Objects/moduleobject.o \
322 Objects/rangeobject.o \
323 Objects/setobject.o \
324 Objects/sliceobject.o \
325 Objects/stringobject.o \
326 Objects/structseq.o \
327 Objects/tupleobject.o \
328 Objects/typeobject.o \
329 Objects/weakrefobject.o \
333 ##########################################################################
334 # objects that get linked into the Python library
336 Modules/_typesmodule.o \
337 Modules/getbuildinfo.o \
345 #########################################################################
350 build_all: $(BUILDPYTHON) oldsharedmods sharedmods
352 # Build the interpreter
353 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
354 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
356 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
358 platform: $(BUILDPYTHON)
359 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
362 # Build the shared modules
363 sharedmods: $(BUILDPYTHON)
364 @case $$MAKEFLAGS in \
365 *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
366 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
369 # Build static library
370 # avoid long command lines, same as LIBRARY_OBJS
371 $(LIBRARY): $(LIBRARY_OBJS)
373 $(AR) cr $@ Modules/getbuildinfo.o
374 $(AR) cr $@ Modules/_typesmodule.o
375 $(AR) cr $@ $(PARSER_OBJS)
376 $(AR) cr $@ $(OBJECT_OBJS)
377 $(AR) cr $@ $(PYTHON_OBJS)
378 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
379 $(AR) cr $@ $(MODOBJS)
382 libpython$(VERSION).so: $(LIBRARY_OBJS)
383 if test $(INSTSONAME) != $(LDLIBRARY); then \
384 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
385 $(LN) -f $(INSTSONAME) $@; \
387 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
390 libpython$(VERSION).sl: $(LIBRARY_OBJS)
391 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
393 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
394 # minimal framework (not including the Lib directory and such) in the current
396 RESSRCDIR=$(srcdir)/Mac/Resources/framework
397 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
399 $(RESSRCDIR)/Info.plist \
400 $(RESSRCDIR)/version.plist \
401 $(RESSRCDIR)/English.lproj/InfoPlist.strings
402 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
403 if test "${UNIVERSALSDK}"; then \
404 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
405 -isysroot "${UNIVERSALSDK}" \
406 -all_load $(LIBRARY) -Wl,-single_module \
407 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
408 -compatibility_version $(VERSION) \
409 -current_version $(VERSION); \
411 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
414 $(INSTALL) -d -m $(DIRMODE) \
415 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
416 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
417 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
418 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
419 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
420 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
421 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
422 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
423 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
424 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
425 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
427 # This rule builds the Cygwin Python DLL and import library if configured
428 # for a shared core library; otherwise, this rule is a noop.
429 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
430 if test -n "$(DLLLIBRARY)"; then \
431 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
432 $(LIBS) $(MODLIBS) $(SYSLIBS); \
437 oldsharedmods: $(SHAREDMODS)
440 Makefile Modules/config.c: Makefile.pre \
441 $(srcdir)/Modules/config.c.in \
443 Modules/Setup.config \
446 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
448 Modules/Setup.config \
449 Modules/Setup.local \
452 @echo "The Makefile was updated, you may need to re-run make."
455 Modules/Setup: $(srcdir)/Modules/Setup.dist
456 @if test -f Modules/Setup; then \
457 echo "-----------------------------------------------"; \
458 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
459 echo "check to make sure you have all the updates you"; \
460 echo "need in your Modules/Setup file."; \
461 echo "Usually, copying Setup.dist to Setup will work."; \
462 echo "-----------------------------------------------"; \
465 ############################################################################
466 # Special rules for object files
468 Modules/getbuildinfo.o: $(PARSER_OBJS) \
474 $(srcdir)/Modules/getbuildinfo.c
475 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
477 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
478 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
479 -DPREFIX='"$(prefix)"' \
480 -DEXEC_PREFIX='"$(exec_prefix)"' \
481 -DVERSION='"$(VERSION)"' \
482 -DVPATH='"$(VPATH)"' \
483 -o $@ $(srcdir)/Modules/getpath.c
485 Modules/python.o: $(srcdir)/Modules/python.c
486 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
489 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
490 -@$(INSTALL) -d Include
491 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
494 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
496 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
497 $(srcdir)/Include/token.h \
498 $(srcdir)/Include/grammar.h
499 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
501 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
503 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
505 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
506 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
508 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
509 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
511 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
513 Python/getplatform.o: $(srcdir)/Python/getplatform.c
514 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
516 Python/importdl.o: $(srcdir)/Python/importdl.c
517 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
519 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
520 $(srcdir)/Objects/unicodetype_db.h
523 $(srcdir)/Include/bytes_methods.h \
524 $(srcdir)/Objects/stringlib/count.h \
525 $(srcdir)/Objects/stringlib/ctype.h \
526 $(srcdir)/Objects/stringlib/fastsearch.h \
527 $(srcdir)/Objects/stringlib/find.h \
528 $(srcdir)/Objects/stringlib/formatter.h \
529 $(srcdir)/Objects/stringlib/partition.h \
530 $(srcdir)/Objects/stringlib/stringdefs.h \
531 $(srcdir)/Objects/stringlib/string_format.h \
532 $(srcdir)/Objects/stringlib/transmogrify.h \
533 $(srcdir)/Objects/stringlib/unicodedefs.h
535 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
538 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
540 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c \
543 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
546 Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
549 ############################################################################
553 Include/Python-ast.h \
559 Include/boolobject.h \
560 Include/bytes_methods.h \
561 Include/bytesobject.h \
562 Include/bufferobject.h \
563 Include/cellobject.h \
565 Include/classobject.h \
570 Include/complexobject.h \
571 Include/descrobject.h \
572 Include/dictobject.h \
573 Include/enumobject.h \
576 Include/fileobject.h \
577 Include/floatobject.h \
578 Include/frameobject.h \
579 Include/funcobject.h \
580 Include/genobject.h \
582 Include/intobject.h \
583 Include/intrcheck.h \
584 Include/iterobject.h \
585 Include/listobject.h \
586 Include/longintrepr.h \
587 Include/longobject.h \
589 Include/metagrammar.h \
590 Include/methodobject.h \
591 Include/modsupport.h \
592 Include/moduleobject.h \
599 Include/patchlevel.h \
601 Include/pgenheaders.h \
612 Include/pythonrun.h \
614 Include/rangeobject.h \
615 Include/setobject.h \
616 Include/sliceobject.h \
617 Include/stringobject.h \
618 Include/structmember.h \
619 Include/structseq.h \
621 Include/sysmodule.h \
622 Include/traceback.h \
623 Include/tupleobject.h \
625 Include/unicodeobject.h \
626 Include/weakrefobject.h \
630 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
633 ######################################################################
635 # Test the interpreter (twice, once without .pyc files, once with)
636 # In the past, we've had problems where bugs in the marshalling or
637 # elsewhere caused bytecode read from .pyc files to behave differently
638 # than bytecode generated directly from a .py source file. Sometimes
639 # the bytecode read from a .pyc file had the bug, somtimes the directly
640 # generated bytecode. This is sometimes a very shy bug needing a lot of
643 TESTOPTS= -l $(EXTRATESTOPTS)
644 TESTPROG= $(srcdir)/Lib/test/regrtest.py
645 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
647 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
648 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
649 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
651 testall: all platform
652 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
653 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
654 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
655 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
656 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
658 # Run the unitests for both architectures in a Universal build on OSX
659 # Must be run on an Intel box.
660 testuniversal: all platform
661 if [ `arch` != 'i386' ];then \
662 echo "This can only be used on OSX/i386" ;\
665 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
666 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
667 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
668 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
671 # Like testall, but with a single pass only
672 # run an optional script to include some information about the build environment
673 buildbottest: all platform
674 -@if which pybuildbot.identify >/dev/null 2>&1; then \
675 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
677 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
679 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
680 test_unicodedata test_re test_sre test_select test_poll \
681 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
682 quicktest: all platform
683 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
684 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
685 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
687 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
689 memtest: all platform
690 -rm -f $(srcdir)/Lib/test/*.py[co]
691 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
692 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
695 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
697 # Install almost everything without disturbing previous versions
698 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
699 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
701 # Install shared libraries enabled by Setup
702 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
704 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
705 @for i in X $(SHAREDMODS); do \
706 if test $$i != X; then \
707 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
708 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
713 @for i in $(DESTDIRS); \
715 if test ! -d $(DESTDIR)$$i; then \
716 echo "Creating directory $$i"; \
717 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
723 # Install the interpreter (by creating a hard link to python$(VERSION))
724 bininstall: altbininstall
725 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
726 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
729 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
730 -rm -f $(DESTDIR)$(BINDIR)/python-config
731 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
733 # Install the interpreter with $(VERSION) affixed
734 # This goes into $(exec_prefix)
735 altbininstall: $(BUILDPYTHON)
736 @for i in $(BINDIR) $(LIBDIR); \
738 if test ! -d $(DESTDIR)$$i; then \
739 echo "Creating directory $$i"; \
740 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
744 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
745 if test -f libpython$(VERSION)$(SO); then \
746 if test "$(SO)" = .dll; then \
747 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
749 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
750 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
751 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
757 # Install the manual page
759 @for i in $(MANDIR) $(MANDIR)/man1; \
761 if test ! -d $(DESTDIR)$$i; then \
762 echo "Creating directory $$i"; \
763 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
767 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
768 $(DESTDIR)$(MANDIR)/man1/python.1
770 # Install the library
771 PLATDIR= plat-$(MACHDEP)
772 EXTRAPLATDIR= @EXTRAPLATDIR@
773 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
774 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
775 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
776 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
777 plat-mac/lib-scriptpackages/_builtinSuites \
778 plat-mac/lib-scriptpackages/CodeWarrior \
779 plat-mac/lib-scriptpackages/Explorer \
780 plat-mac/lib-scriptpackages/Finder \
781 plat-mac/lib-scriptpackages/Netscape \
782 plat-mac/lib-scriptpackages/StdSuites \
783 plat-mac/lib-scriptpackages/SystemEvents \
784 plat-mac/lib-scriptpackages/Terminal
785 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
786 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
787 test/decimaltestdata \
788 encodings compiler hotshot \
789 email email/mime email/test email/test/data \
790 sqlite3 sqlite3/test \
791 logging bsddb bsddb/test csv wsgiref \
792 lib2to3 lib2to3/fixes lib2to3/pgen2 \
793 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
794 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
795 setuptools setuptools/command setuptools/tests setuptools.egg-info \
797 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
798 @for i in $(SCRIPTDIR) $(LIBDEST); \
800 if test ! -d $(DESTDIR)$$i; then \
801 echo "Creating directory $$i"; \
802 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
806 @for d in $(LIBSUBDIRS); \
808 a=$(srcdir)/Lib/$$d; \
809 if test ! -d $$a; then continue; else true; fi; \
811 if test ! -d $(DESTDIR)$$b; then \
812 echo "Creating directory $$b"; \
813 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
817 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
819 if test -x $$i; then \
820 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
821 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
823 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
824 echo $(INSTALL_DATA) $$i $(LIBDEST); \
827 @for d in $(LIBSUBDIRS); \
829 a=$(srcdir)/Lib/$$d; \
830 if test ! -d $$a; then continue; else true; fi; \
831 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
841 if test -d $$i; then continue; fi; \
842 if test -x $$i; then \
843 echo $(INSTALL_SCRIPT) $$i $$b; \
844 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
846 echo $(INSTALL_DATA) $$i $$b; \
847 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
852 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
853 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
854 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
856 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
857 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
858 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
860 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
861 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
862 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
863 -d $(LIBDEST)/site-packages -f \
864 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
865 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
866 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
867 -d $(LIBDEST)/site-packages -f \
868 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
869 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
870 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram"
872 # Create the PLATDIR source directory, if one wasn't distributed..
873 $(srcdir)/Lib/$(PLATDIR):
874 mkdir $(srcdir)/Lib/$(PLATDIR)
875 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
876 export PATH; PATH="`pwd`:$$PATH"; \
877 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
878 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
879 export EXE; EXE="$(BUILDEXE)"; \
880 cd $(srcdir)/Lib/$(PLATDIR); ./regen
882 # Install the include files
883 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
885 @for i in $(INCLDIRSTOMAKE); \
887 if test ! -d $(DESTDIR)$$i; then \
888 echo "Creating directory $$i"; \
889 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
893 @for i in $(srcdir)/Include/*.h; \
895 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
896 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
898 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
900 # Install the library and miscellaneous stuff needed for extending/embedding
901 # This goes into $(exec_prefix)
902 LIBPL= $(LIBP)/config
904 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
906 if test ! -d $(DESTDIR)$$i; then \
907 echo "Creating directory $$i"; \
908 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
912 @if test -d $(LIBRARY); then :; else \
913 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
914 if test "$(SO)" = .dll; then \
915 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
917 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
918 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
921 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
924 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
925 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
926 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
927 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
928 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
929 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
930 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
931 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
932 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
933 # Substitution happens here, as the completely-expanded BINDIR
934 # is not available in configure
935 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
936 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
938 @if [ -s Modules/python.exp -a \
939 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
940 echo; echo "Installing support files for building shared extension modules on AIX:"; \
941 $(INSTALL_DATA) Modules/python.exp \
942 $(DESTDIR)$(LIBPL)/python.exp; \
943 echo; echo "$(LIBPL)/python.exp"; \
944 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
945 $(DESTDIR)$(LIBPL)/makexp_aix; \
946 echo "$(LIBPL)/makexp_aix"; \
947 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
948 $(DESTDIR)$(LIBPL)/ld_so_aix; \
949 echo "$(LIBPL)/ld_so_aix"; \
950 echo; echo "See Misc/AIX-NOTES for details."; \
953 @case "$(MACHDEP)" in beos*) \
954 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
955 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
956 echo; echo "$(LIBPL)/README"; \
957 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
958 echo "$(LIBPL)/ar_beos"; \
959 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
960 echo "$(LIBPL)/ld_so_beos"; \
961 echo; echo "See Misc/BeOS-NOTES for details."; \
965 # Install the dynamically loadable modules
966 # This goes into $(exec_prefix)
968 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
970 --install-scripts=$(BINDIR) \
971 --install-platlib=$(DESTSHARED) \
974 # Here are a couple of targets for MacOSX again, to install a full
975 # framework-based Python. frameworkinstall installs everything, the
976 # subtargets install specific parts. Much of the actual work is offloaded to
977 # the Makefile in Mac
980 # This target is here for backward compatiblity, previous versions of Python
981 # hadn't integrated framework installation in the normal install process.
982 frameworkinstall: install
984 # On install, we re-make the framework
985 # structure in the install location, /Library/Frameworks/ or the argument to
986 # --enable-framework. If --enable-framework has been specified then we have
987 # automatically set prefix to the location deep down in the framework, so we
988 # only have to cater for the structural bits of the framework.
990 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
992 frameworkinstallstructure: $(LDLIBRARY)
993 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
994 echo Not configured with --enable-framework; \
998 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
999 if test ! -d $(DESTDIR)$$i; then \
1000 echo "Creating directory $(DESTDIR)$$i"; \
1001 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1005 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1006 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
1007 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
1008 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
1009 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
1010 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1011 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
1012 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1013 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1014 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1016 # This installs Mac/Lib into the framework
1017 # Install a number of symlinks to keep software that expects a normal unix
1018 # install (which includes python-config) happy.
1019 frameworkinstallmaclib:
1020 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1021 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1023 # This installs the IDE, the Launcher and other apps into /Applications
1024 frameworkinstallapps:
1025 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1027 # This install the unix python and pythonw tools in /usr/local/bin
1028 frameworkinstallunixtools:
1029 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1031 frameworkaltinstallunixtools:
1032 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1034 # This installs the Demos and Tools into the applications directory.
1035 # It is not part of a normal frameworkinstall
1036 frameworkinstallextras:
1037 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
1039 # This installs a few of the useful scripts in Tools/scripts
1041 SRCDIR=$(srcdir) $(RUNSHARED) \
1042 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1043 --prefix=$(prefix) \
1044 --install-scripts=$(BINDIR) \
1047 # Build the toplevel Makefile
1048 Makefile.pre: Makefile.pre.in config.status
1049 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1050 $(MAKE) -f Makefile.pre Makefile
1052 # Run the configure script.
1053 config.status: $(srcdir)/configure
1054 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1056 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1058 # Some make's put the object file in the current directory
1060 $(CC) -c $(PY_CFLAGS) -o $@ $<
1062 # Run reindent on the library
1064 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1066 # Rerun configure with the same options as it was run last time,
1067 # provided the config.status script exists
1069 $(SHELL) config.status --recheck
1070 $(SHELL) config.status
1072 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1074 (cd $(srcdir); autoconf)
1075 (cd $(srcdir); autoheader)
1077 # Create a tags file for vi
1080 ctags -w -t Include/*.h; \
1081 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1085 # Create a tags file for GNU Emacs
1088 etags Include/*.h; \
1089 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1091 # Sanitation targets -- clean leaves libraries, executables and tags
1092 # files, which clobber removes those as well
1094 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1097 find . -name '*.o' -exec rm -f {} ';'
1098 find . -name '*.s[ol]' -exec rm -f {} ';'
1099 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1100 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1103 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1105 config.cache config.log pyconfig.h Modules/config.c
1106 -rm -rf build platform
1107 -rm -rf $(PYTHONFRAMEWORKDIR)
1109 # Make things extra clean, before making a distribution:
1110 # remove all generated files, even Makefile[.pre]
1111 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1113 -rm -f core Makefile Makefile.pre config.status \
1114 Modules/Setup Modules/Setup.local Modules/Setup.config
1115 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1116 -o -name '[@,#]*' -o -name '*.old' \
1117 -o -name '*.orig' -o -name '*.rej' \
1118 -o -name '*.bak' ')' \
1121 # Check for smelly exported symbols (not starting with Py/_Py)
1123 nm -p $(LIBRARY) | \
1124 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1126 # Find files with funny names
1128 find $(DISTDIRS) -type d \
1129 -o -name '*.[chs]' \
1139 -o -name '*,[vpt]' \
1141 -o -name 'Setup.*' \
1144 -o -name ChangeLog \
1145 -o -name Repository \
1151 -o -name .cvsignore \
1155 # Perform some verification checks on any modified files.
1157 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1161 Python/thread.o: @THREADHEADERS@
1163 # Declare targets that aren't real files
1164 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1165 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1166 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1167 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1168 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1169 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1170 .PHONY: smelly funny
1172 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY