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/$(DYNLOADFILE) \
290 ##########################################################################
294 Objects/boolobject.o \
295 Objects/bufferobject.o \
296 Objects/cellobject.o \
297 Objects/classobject.o \
299 Objects/codeobject.o \
300 Objects/complexobject.o \
301 Objects/descrobject.o \
302 Objects/enumobject.o \
303 Objects/exceptions.o \
304 Objects/genobject.o \
305 Objects/fileobject.o \
306 Objects/floatobject.o \
307 Objects/frameobject.o \
308 Objects/funcobject.o \
309 Objects/intobject.o \
310 Objects/iterobject.o \
311 Objects/listobject.o \
312 Objects/longobject.o \
313 Objects/dictobject.o \
314 Objects/methodobject.o \
315 Objects/moduleobject.o \
318 Objects/rangeobject.o \
319 Objects/setobject.o \
320 Objects/sliceobject.o \
321 Objects/stringobject.o \
322 Objects/structseq.o \
323 Objects/tupleobject.o \
324 Objects/typeobject.o \
325 Objects/weakrefobject.o \
329 ##########################################################################
330 # objects that get linked into the Python library
332 Modules/_typesmodule.o \
333 Modules/getbuildinfo.o \
341 #########################################################################
346 build_all: $(BUILDPYTHON) oldsharedmods sharedmods
348 # Build the interpreter
349 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
350 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
352 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
354 platform: $(BUILDPYTHON)
355 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
358 # Build the shared modules
359 sharedmods: $(BUILDPYTHON)
360 @case $$MAKEFLAGS in \
361 *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
362 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
365 # Build static library
366 # avoid long command lines, same as LIBRARY_OBJS
367 $(LIBRARY): $(LIBRARY_OBJS)
369 $(AR) cr $@ Modules/getbuildinfo.o
370 $(AR) cr $@ Modules/_typesmodule.o
371 $(AR) cr $@ $(PARSER_OBJS)
372 $(AR) cr $@ $(OBJECT_OBJS)
373 $(AR) cr $@ $(PYTHON_OBJS)
374 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
375 $(AR) cr $@ $(MODOBJS)
378 libpython$(VERSION).so: $(LIBRARY_OBJS)
379 if test $(INSTSONAME) != $(LDLIBRARY); then \
380 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
381 $(LN) -f $(INSTSONAME) $@; \
383 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
386 libpython$(VERSION).sl: $(LIBRARY_OBJS)
387 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
389 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
390 # minimal framework (not including the Lib directory and such) in the current
392 RESSRCDIR=$(srcdir)/Mac/Resources/framework
393 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
395 $(RESSRCDIR)/Info.plist \
396 $(RESSRCDIR)/version.plist \
397 $(RESSRCDIR)/English.lproj/InfoPlist.strings
398 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
399 if test "${UNIVERSALSDK}"; then \
400 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
401 -isysroot "${UNIVERSALSDK}" \
402 -all_load $(LIBRARY) -Wl,-single_module \
403 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
404 -compatibility_version $(VERSION) \
405 -current_version $(VERSION); \
407 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
410 $(INSTALL) -d -m $(DIRMODE) \
411 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
412 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
413 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
414 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
415 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
416 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
417 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
418 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
419 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
420 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
421 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
423 # This rule builds the Cygwin Python DLL and import library if configured
424 # for a shared core library; otherwise, this rule is a noop.
425 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
426 if test -n "$(DLLLIBRARY)"; then \
427 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
428 $(LIBS) $(MODLIBS) $(SYSLIBS); \
433 oldsharedmods: $(SHAREDMODS)
436 Makefile Modules/config.c: Makefile.pre \
437 $(srcdir)/Modules/config.c.in \
439 Modules/Setup.config \
442 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
444 Modules/Setup.config \
445 Modules/Setup.local \
448 @echo "The Makefile was updated, you may need to re-run make."
451 Modules/Setup: $(srcdir)/Modules/Setup.dist
452 @if test -f Modules/Setup; then \
453 echo "-----------------------------------------------"; \
454 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
455 echo "check to make sure you have all the updates you"; \
456 echo "need in your Modules/Setup file."; \
457 echo "Usually, copying Setup.dist to Setup will work."; \
458 echo "-----------------------------------------------"; \
461 ############################################################################
462 # Special rules for object files
464 Modules/getbuildinfo.o: $(PARSER_OBJS) \
470 $(srcdir)/Modules/getbuildinfo.c
471 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
473 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
474 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
475 -DPREFIX='"$(prefix)"' \
476 -DEXEC_PREFIX='"$(exec_prefix)"' \
477 -DVERSION='"$(VERSION)"' \
478 -DVPATH='"$(VPATH)"' \
479 -o $@ $(srcdir)/Modules/getpath.c
481 Modules/python.o: $(srcdir)/Modules/python.c
482 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
485 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
486 -@$(INSTALL) -d Include
487 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
490 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
492 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
493 $(srcdir)/Include/token.h \
494 $(srcdir)/Include/grammar.h
495 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
497 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
499 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
501 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
502 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
504 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
505 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
507 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
509 Python/getplatform.o: $(srcdir)/Python/getplatform.c
510 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
512 Python/importdl.o: $(srcdir)/Python/importdl.c
513 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
515 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
516 $(srcdir)/Objects/unicodetype_db.h
518 ############################################################################
522 Include/Python-ast.h \
528 Include/boolobject.h \
529 Include/bufferobject.h \
530 Include/cellobject.h \
532 Include/classobject.h \
537 Include/complexobject.h \
538 Include/descrobject.h \
539 Include/dictobject.h \
540 Include/enumobject.h \
543 Include/fileobject.h \
544 Include/floatobject.h \
545 Include/frameobject.h \
546 Include/funcobject.h \
547 Include/genobject.h \
549 Include/intobject.h \
550 Include/intrcheck.h \
551 Include/iterobject.h \
552 Include/listobject.h \
553 Include/longintrepr.h \
554 Include/longobject.h \
556 Include/metagrammar.h \
557 Include/methodobject.h \
558 Include/modsupport.h \
559 Include/moduleobject.h \
566 Include/patchlevel.h \
568 Include/pgenheaders.h \
579 Include/pythonrun.h \
581 Include/rangeobject.h \
582 Include/setobject.h \
583 Include/sliceobject.h \
584 Include/stringobject.h \
585 Include/structmember.h \
586 Include/structseq.h \
588 Include/sysmodule.h \
589 Include/traceback.h \
590 Include/tupleobject.h \
592 Include/unicodeobject.h \
593 Include/weakrefobject.h \
597 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
600 ######################################################################
602 # Test the interpreter (twice, once without .pyc files, once with)
603 # In the past, we've had problems where bugs in the marshalling or
604 # elsewhere caused bytecode read from .pyc files to behave differently
605 # than bytecode generated directly from a .py source file. Sometimes
606 # the bytecode read from a .pyc file had the bug, somtimes the directly
607 # generated bytecode. This is sometimes a very shy bug needing a lot of
610 TESTOPTS= -l $(EXTRATESTOPTS)
611 TESTPROG= $(srcdir)/Lib/test/regrtest.py
612 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
614 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
615 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
616 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
618 testall: all platform
619 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
620 $(TESTPYTHON) Lib/compileall.py
621 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
622 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
623 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
625 # Run the unitests for both architectures in a Universal build on OSX
626 # Must be run on an Intel box.
627 testuniversal: all platform
628 if [ `arch` != 'i386' ];then \
629 echo "This can only be used on OSX/i386" ;\
632 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
633 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
634 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
635 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
638 # Like testall, but with a single pass only
639 # run an optional script to include some information about the build environment
640 buildbottest: all platform
641 -@if which pybuildbot.identify >/dev/null 2>&1; then \
642 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
644 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
646 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
647 test_unicodedata test_re test_sre test_select test_poll \
648 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
649 quicktest: all platform
650 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
651 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
652 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
654 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
656 memtest: all platform
657 -rm -f $(srcdir)/Lib/test/*.py[co]
658 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
659 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
662 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
664 # Install almost everything without disturbing previous versions
665 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
666 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
668 # Install shared libraries enabled by Setup
669 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
671 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
672 @for i in X $(SHAREDMODS); do \
673 if test $$i != X; then \
674 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
675 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
680 @for i in $(DESTDIRS); \
682 if test ! -d $(DESTDIR)$$i; then \
683 echo "Creating directory $$i"; \
684 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
690 # Install the interpreter (by creating a hard link to python$(VERSION))
691 bininstall: altbininstall
692 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
693 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
696 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
697 -rm -f $(DESTDIR)$(BINDIR)/python-config
698 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
700 # Install the interpreter with $(VERSION) affixed
701 # This goes into $(exec_prefix)
702 altbininstall: $(BUILDPYTHON)
703 @for i in $(BINDIR) $(LIBDIR); \
705 if test ! -d $(DESTDIR)$$i; then \
706 echo "Creating directory $$i"; \
707 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
711 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
712 if test -f libpython$(VERSION)$(SO); then \
713 if test "$(SO)" = .dll; then \
714 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
716 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
717 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
718 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
724 # Install the manual page
726 @for i in $(MANDIR) $(MANDIR)/man1; \
728 if test ! -d $(DESTDIR)$$i; then \
729 echo "Creating directory $$i"; \
730 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
734 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
735 $(DESTDIR)$(MANDIR)/man1/python.1
737 # Install the library
738 PLATDIR= plat-$(MACHDEP)
739 EXTRAPLATDIR= @EXTRAPLATDIR@
740 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
741 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
742 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
743 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
744 plat-mac/lib-scriptpackages/_builtinSuites \
745 plat-mac/lib-scriptpackages/CodeWarrior \
746 plat-mac/lib-scriptpackages/Explorer \
747 plat-mac/lib-scriptpackages/Finder \
748 plat-mac/lib-scriptpackages/Netscape \
749 plat-mac/lib-scriptpackages/StdSuites \
750 plat-mac/lib-scriptpackages/SystemEvents \
751 plat-mac/lib-scriptpackages/Terminal
752 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
753 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
754 test/decimaltestdata \
755 encodings compiler hotshot \
756 email email/mime email/test email/test/data \
757 sqlite3 sqlite3/test \
758 logging bsddb bsddb/test csv wsgiref \
759 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
760 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
761 setuptools setuptools/command setuptools/tests setuptools.egg-info \
763 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
764 @for i in $(SCRIPTDIR) $(LIBDEST); \
766 if test ! -d $(DESTDIR)$$i; then \
767 echo "Creating directory $$i"; \
768 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
772 @for d in $(LIBSUBDIRS); \
774 a=$(srcdir)/Lib/$$d; \
775 if test ! -d $$a; then continue; else true; fi; \
777 if test ! -d $(DESTDIR)$$b; then \
778 echo "Creating directory $$b"; \
779 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
783 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
785 if test -x $$i; then \
786 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
787 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
789 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
790 echo $(INSTALL_DATA) $$i $(LIBDEST); \
793 @for d in $(LIBSUBDIRS); \
795 a=$(srcdir)/Lib/$$d; \
796 if test ! -d $$a; then continue; else true; fi; \
797 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
807 if test -d $$i; then continue; fi; \
808 if test -x $$i; then \
809 echo $(INSTALL_SCRIPT) $$i $$b; \
810 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
812 echo $(INSTALL_DATA) $$i $$b; \
813 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
818 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
819 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
820 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
822 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
823 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
824 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
826 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
827 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
828 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
829 -d $(LIBDEST)/site-packages -f \
830 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
831 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
832 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
833 -d $(LIBDEST)/site-packages -f \
834 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
836 # Create the PLATDIR source directory, if one wasn't distributed..
837 $(srcdir)/Lib/$(PLATDIR):
838 mkdir $(srcdir)/Lib/$(PLATDIR)
839 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
840 export PATH; PATH="`pwd`:$$PATH"; \
841 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
842 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
843 export EXE; EXE="$(BUILDEXE)"; \
844 cd $(srcdir)/Lib/$(PLATDIR); ./regen
846 # Install the include files
847 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
849 @for i in $(INCLDIRSTOMAKE); \
851 if test ! -d $(DESTDIR)$$i; then \
852 echo "Creating directory $$i"; \
853 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
857 @for i in $(srcdir)/Include/*.h; \
859 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
860 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
862 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
864 # Install the library and miscellaneous stuff needed for extending/embedding
865 # This goes into $(exec_prefix)
866 LIBPL= $(LIBP)/config
868 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
870 if test ! -d $(DESTDIR)$$i; then \
871 echo "Creating directory $$i"; \
872 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
876 @if test -d $(LIBRARY); then :; else \
877 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
878 if test "$(SO)" = .dll; then \
879 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
881 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
882 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
885 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
888 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
889 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
890 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
891 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
892 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
893 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
894 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
895 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
896 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
897 # Substitution happens here, as the completely-expanded BINDIR
898 # is not available in configure
899 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
900 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
902 @if [ -s Modules/python.exp -a \
903 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
904 echo; echo "Installing support files for building shared extension modules on AIX:"; \
905 $(INSTALL_DATA) Modules/python.exp \
906 $(DESTDIR)$(LIBPL)/python.exp; \
907 echo; echo "$(LIBPL)/python.exp"; \
908 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
909 $(DESTDIR)$(LIBPL)/makexp_aix; \
910 echo "$(LIBPL)/makexp_aix"; \
911 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
912 $(DESTDIR)$(LIBPL)/ld_so_aix; \
913 echo "$(LIBPL)/ld_so_aix"; \
914 echo; echo "See Misc/AIX-NOTES for details."; \
917 @case "$(MACHDEP)" in beos*) \
918 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
919 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
920 echo; echo "$(LIBPL)/README"; \
921 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
922 echo "$(LIBPL)/ar_beos"; \
923 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
924 echo "$(LIBPL)/ld_so_beos"; \
925 echo; echo "See Misc/BeOS-NOTES for details."; \
929 # Install the dynamically loadable modules
930 # This goes into $(exec_prefix)
932 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
934 --install-scripts=$(BINDIR) \
935 --install-platlib=$(DESTSHARED) \
938 # Here are a couple of targets for MacOSX again, to install a full
939 # framework-based Python. frameworkinstall installs everything, the
940 # subtargets install specific parts. Much of the actual work is offloaded to
941 # the Makefile in Mac
944 # This target is here for backward compatiblity, previous versions of Python
945 # hadn't integrated framework installation in the normal install process.
946 frameworkinstall: install
948 # On install, we re-make the framework
949 # structure in the install location, /Library/Frameworks/ or the argument to
950 # --enable-framework. If --enable-framework has been specified then we have
951 # automatically set prefix to the location deep down in the framework, so we
952 # only have to cater for the structural bits of the framework.
954 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
956 frameworkinstallstructure: $(LDLIBRARY)
957 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
958 echo Not configured with --enable-framework; \
962 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
963 if test ! -d $(DESTDIR)$$i; then \
964 echo "Creating directory $(DESTDIR)$$i"; \
965 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
969 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
970 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
971 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
972 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
973 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
974 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
975 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
976 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
977 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
978 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
980 # This installs Mac/Lib into the framework
981 # Install a number of symlinks to keep software that expects a normal unix
982 # install (which includes python-config) happy.
983 frameworkinstallmaclib:
984 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
985 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
987 # This installs the IDE, the Launcher and other apps into /Applications
988 frameworkinstallapps:
989 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
991 # This install the unix python and pythonw tools in /usr/local/bin
992 frameworkinstallunixtools:
993 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
995 frameworkaltinstallunixtools:
996 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
998 # This installs the Demos and Tools into the applications directory.
999 # It is not part of a normal frameworkinstall
1000 frameworkinstallextras:
1001 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
1003 # This installs a few of the useful scripts in Tools/scripts
1005 SRCDIR=$(srcdir) $(RUNSHARED) \
1006 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1007 --prefix=$(prefix) \
1008 --install-scripts=$(BINDIR) \
1011 # Build the toplevel Makefile
1012 Makefile.pre: Makefile.pre.in config.status
1013 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1014 $(MAKE) -f Makefile.pre Makefile
1016 # Run the configure script.
1017 config.status: $(srcdir)/configure
1018 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1020 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1022 # Some make's put the object file in the current directory
1024 $(CC) -c $(PY_CFLAGS) -o $@ $<
1026 # Run reindent on the library
1028 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1030 # Rerun configure with the same options as it was run last time,
1031 # provided the config.status script exists
1033 $(SHELL) config.status --recheck
1034 $(SHELL) config.status
1036 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1038 (cd $(srcdir); autoconf)
1039 (cd $(srcdir); autoheader)
1041 # Create a tags file for vi
1044 ctags -w -t Include/*.h; \
1045 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1049 # Create a tags file for GNU Emacs
1052 etags Include/*.h; \
1053 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1055 # Sanitation targets -- clean leaves libraries, executables and tags
1056 # files, which clobber removes those as well
1058 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1061 find . -name '*.o' -exec rm -f {} ';'
1062 find . -name '*.s[ol]' -exec rm -f {} ';'
1063 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1064 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1067 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1069 config.cache config.log pyconfig.h Modules/config.c
1070 -rm -rf build platform
1071 -rm -rf $(PYTHONFRAMEWORKDIR)
1073 # Make things extra clean, before making a distribution:
1074 # remove all generated files, even Makefile[.pre]
1075 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1077 -rm -f core Makefile Makefile.pre config.status \
1078 Modules/Setup Modules/Setup.local Modules/Setup.config
1079 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1080 -o -name '[@,#]*' -o -name '*.old' \
1081 -o -name '*.orig' -o -name '*.rej' \
1082 -o -name '*.bak' ')' \
1085 # Check for smelly exported symbols (not starting with Py/_Py)
1087 nm -p $(LIBRARY) | \
1088 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1090 # Find files with funny names
1092 find $(DISTDIRS) -type d \
1093 -o -name '*.[chs]' \
1103 -o -name '*,[vpt]' \
1105 -o -name 'Setup.*' \
1108 -o -name ChangeLog \
1109 -o -name Repository \
1115 -o -name .cvsignore \
1121 Python/thread.o: @THREADHEADERS@
1123 # Declare targets that aren't real files
1124 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1125 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1126 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1127 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1128 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1129 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1130 .PHONY: smelly funny
1132 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY