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@
172 UNICODE_OBJS= @UNICODE_OBJS@
175 BUILDPYTHON= python$(BUILDEXE)
177 # === Definitions added by makesetup ===
180 ##########################################################################
188 # Used of signalmodule.o is not available
189 SIGNAL_OBJS= @SIGNAL_OBJS@
192 ##########################################################################
194 GRAMMAR_H= $(srcdir)/Include/graminit.h
195 GRAMMAR_C= $(srcdir)/Python/graminit.c
196 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
199 ##########################################################################
201 PGEN= Parser/pgen$(EXE)
211 Parser/metagrammar.o \
216 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
220 Python/mysnprintf.o \
221 Parser/tokenizer_pgen.o \
222 Parser/printgrammar.o \
225 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
227 ##########################################################################
229 AST_H_DIR= $(srcdir)/Include
230 AST_H= $(AST_H_DIR)/Python-ast.h
231 AST_C_DIR= $(srcdir)/Python
232 AST_C= $(AST_C_DIR)/Python-ast.c
233 AST_ASDL= $(srcdir)/Parser/Python.asdl
235 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
236 # XXX Note that a build now requires Python exist before the build starts
237 ASDLGEN= $(srcdir)/Parser/asdl_c.py
239 ##########################################################################
242 Python/Python-ast.o \
245 Python/bltinmodule.o \
251 Python/frozenmain.o \
254 Python/getcompiler.o \
255 Python/getcopyright.o \
257 Python/getplatform.o \
258 Python/getversion.o \
263 Python/modsupport.o \
265 Python/mysnprintf.o \
271 Python/structmember.o \
277 Python/$(DYNLOADFILE) \
282 ##########################################################################
286 Objects/boolobject.o \
287 Objects/bufferobject.o \
288 Objects/cellobject.o \
289 Objects/classobject.o \
291 Objects/codeobject.o \
292 Objects/complexobject.o \
293 Objects/descrobject.o \
294 Objects/enumobject.o \
295 Objects/exceptions.o \
296 Objects/genobject.o \
297 Objects/fileobject.o \
298 Objects/floatobject.o \
299 Objects/frameobject.o \
300 Objects/funcobject.o \
301 Objects/intobject.o \
302 Objects/iterobject.o \
303 Objects/listobject.o \
304 Objects/longobject.o \
305 Objects/dictobject.o \
306 Objects/methodobject.o \
307 Objects/moduleobject.o \
310 Objects/rangeobject.o \
311 Objects/setobject.o \
312 Objects/sliceobject.o \
313 Objects/stringobject.o \
314 Objects/structseq.o \
315 Objects/tupleobject.o \
316 Objects/typeobject.o \
317 Objects/weakrefobject.o \
321 ##########################################################################
322 # objects that get linked into the Python library
324 Modules/_typesmodule.o \
325 Modules/getbuildinfo.o \
333 #########################################################################
337 all: $(BUILDPYTHON) oldsharedmods sharedmods
339 # Build the interpreter
340 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
341 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
343 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
345 platform: $(BUILDPYTHON)
346 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
349 # Build the shared modules
350 sharedmods: $(BUILDPYTHON)
351 @case $$MAKEFLAGS in \
352 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
353 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
356 # Build static library
357 # avoid long command lines, same as LIBRARY_OBJS
358 $(LIBRARY): $(LIBRARY_OBJS)
360 $(AR) cr $@ Modules/getbuildinfo.o
361 $(AR) cr $@ Modules/_typesmodule.o
362 $(AR) cr $@ $(PARSER_OBJS)
363 $(AR) cr $@ $(OBJECT_OBJS)
364 $(AR) cr $@ $(PYTHON_OBJS)
365 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
366 $(AR) cr $@ $(MODOBJS)
369 libpython$(VERSION).so: $(LIBRARY_OBJS)
370 if test $(INSTSONAME) != $(LDLIBRARY); then \
371 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
372 $(LN) -f $(INSTSONAME) $@; \
374 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
377 libpython$(VERSION).sl: $(LIBRARY_OBJS)
378 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
380 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
381 # minimal framework (not including the Lib directory and such) in the current
383 RESSRCDIR=$(srcdir)/Mac/Resources/framework
384 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
386 $(RESSRCDIR)/Info.plist \
387 $(RESSRCDIR)/version.plist \
388 $(RESSRCDIR)/English.lproj/InfoPlist.strings
389 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
390 if test "${UNIVERSALSDK}"; then \
391 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
392 -isysroot "${UNIVERSALSDK}" \
393 -all_load $(LIBRARY) -Wl,-single_module \
394 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
395 -compatibility_version $(VERSION) \
396 -current_version $(VERSION); \
398 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
401 $(INSTALL) -d -m $(DIRMODE) \
402 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
403 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
404 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
405 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
406 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
407 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
408 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
409 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
410 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
411 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
412 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
414 # This rule builds the Cygwin Python DLL and import library if configured
415 # for a shared core library; otherwise, this rule is a noop.
416 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
417 if test -n "$(DLLLIBRARY)"; then \
418 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
419 $(LIBS) $(MODLIBS) $(SYSLIBS); \
424 oldsharedmods: $(SHAREDMODS)
427 Makefile Modules/config.c: Makefile.pre \
428 $(srcdir)/Modules/config.c.in \
430 Modules/Setup.config \
433 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
435 Modules/Setup.config \
436 Modules/Setup.local \
439 @echo "The Makefile was updated, you may need to re-run make."
442 Modules/Setup: $(srcdir)/Modules/Setup.dist
443 @if test -f Modules/Setup; then \
444 echo "-----------------------------------------------"; \
445 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
446 echo "check to make sure you have all the updates you"; \
447 echo "need in your Modules/Setup file."; \
448 echo "Usually, copying Setup.dist to Setup will work."; \
449 echo "-----------------------------------------------"; \
452 ############################################################################
453 # Special rules for object files
455 Modules/getbuildinfo.o: $(PARSER_OBJS) \
461 $(srcdir)/Modules/getbuildinfo.c
462 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
464 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
465 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
466 -DPREFIX='"$(prefix)"' \
467 -DEXEC_PREFIX='"$(exec_prefix)"' \
468 -DVERSION='"$(VERSION)"' \
469 -DVPATH='"$(VPATH)"' \
470 -o $@ $(srcdir)/Modules/getpath.c
472 Modules/python.o: $(srcdir)/Modules/python.c
473 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
476 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
478 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
481 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
483 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
484 $(srcdir)/Include/token.h \
485 $(srcdir)/Include/grammar.h
486 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
488 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
490 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
492 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
493 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
495 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
496 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
498 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
500 Python/getplatform.o: $(srcdir)/Python/getplatform.c
501 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
503 Python/importdl.o: $(srcdir)/Python/importdl.c
504 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
506 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
507 $(srcdir)/Objects/unicodetype_db.h
509 ############################################################################
514 Include/Python-ast.h \
517 Include/boolobject.h \
518 Include/bufferobject.h \
520 Include/classobject.h \
525 Include/complexobject.h \
526 Include/descrobject.h \
527 Include/dictobject.h \
528 Include/enumobject.h \
529 Include/genobject.h \
530 Include/fileobject.h \
531 Include/floatobject.h \
532 Include/funcobject.h \
534 Include/intobject.h \
535 Include/intrcheck.h \
536 Include/iterobject.h \
537 Include/listobject.h \
538 Include/longobject.h \
539 Include/methodobject.h \
540 Include/modsupport.h \
541 Include/moduleobject.h \
545 Include/patchlevel.h \
553 Include/pythonrun.h \
554 Include/rangeobject.h \
555 Include/setobject.h \
556 Include/sliceobject.h \
557 Include/stringobject.h \
558 Include/structseq.h \
559 Include/structmember.h \
561 Include/sysmodule.h \
562 Include/traceback.h \
563 Include/tupleobject.h \
564 Include/unicodeobject.h \
565 Include/weakrefobject.h \
568 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
571 ######################################################################
573 # Test the interpreter (twice, once without .pyc files, once with)
574 # In the past, we've had problems where bugs in the marshalling or
575 # elsewhere caused bytecode read from .pyc files to behave differently
576 # than bytecode generated directly from a .py source file. Sometimes
577 # the bytecode read from a .pyc file had the bug, somtimes the directly
578 # generated bytecode. This is sometimes a very shy bug needing a lot of
581 TESTOPTS= -l $(EXTRATESTOPTS)
582 TESTPROG= $(srcdir)/Lib/test/regrtest.py
583 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
585 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
586 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
587 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
589 testall: all platform
590 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
591 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
592 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
594 # Run the unitests for both architectures in a Universal build on OSX
595 # Must be run on an Intel box.
596 testuniversal: all platform
597 if [ `arch` != 'i386' ];then \
598 echo "This can only be used on OSX/i386" ;\
601 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
602 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
603 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
604 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
607 # Like testall, but with a single pass only
608 # run an optional script to include some information about the build environment
609 buildbottest: all platform
610 -@if which pybuildbot.identify >/dev/null 2>&1; then \
611 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
613 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
615 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
616 test_unicodedata test_re test_sre test_select test_poll \
617 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
618 quicktest: all platform
619 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
620 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
621 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
623 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
625 memtest: all platform
626 -rm -f $(srcdir)/Lib/test/*.py[co]
627 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
628 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
631 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
633 # Install almost everything without disturbing previous versions
634 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
635 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
637 # Install shared libraries enabled by Setup
638 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
640 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
641 @for i in X $(SHAREDMODS); do \
642 if test $$i != X; then \
643 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
644 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
649 @for i in $(DESTDIRS); \
651 if test ! -d $(DESTDIR)$$i; then \
652 echo "Creating directory $$i"; \
653 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
659 # Install the interpreter (by creating a hard link to python$(VERSION))
660 bininstall: altbininstall
661 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
662 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
665 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
666 -rm -f $(DESTDIR)$(BINDIR)/python-config
667 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
669 # Install the interpreter with $(VERSION) affixed
670 # This goes into $(exec_prefix)
671 altbininstall: $(BUILDPYTHON)
672 @for i in $(BINDIR) $(LIBDIR); \
674 if test ! -d $(DESTDIR)$$i; then \
675 echo "Creating directory $$i"; \
676 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
680 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
681 if test -f libpython$(VERSION)$(SO); then \
682 if test "$(SO)" = .dll; then \
683 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
685 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
686 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
687 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
693 # Install the manual page
695 @for i in $(MANDIR) $(MANDIR)/man1; \
697 if test ! -d $(DESTDIR)$$i; then \
698 echo "Creating directory $$i"; \
699 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
703 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
704 $(DESTDIR)$(MANDIR)/man1/python.1
706 # Install the library
707 PLATDIR= plat-$(MACHDEP)
708 EXTRAPLATDIR= @EXTRAPLATDIR@
709 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
710 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
711 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
712 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
713 plat-mac/lib-scriptpackages/_builtinSuites \
714 plat-mac/lib-scriptpackages/CodeWarrior \
715 plat-mac/lib-scriptpackages/Explorer \
716 plat-mac/lib-scriptpackages/Finder \
717 plat-mac/lib-scriptpackages/Netscape \
718 plat-mac/lib-scriptpackages/StdSuites \
719 plat-mac/lib-scriptpackages/SystemEvents \
720 plat-mac/lib-scriptpackages/Terminal
721 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
722 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
723 test/decimaltestdata \
724 encodings compiler hotshot \
725 email email/mime email/test email/test/data \
726 sqlite3 sqlite3/test \
727 logging bsddb bsddb/test csv wsgiref \
728 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
729 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
730 setuptools setuptools/command setuptools/tests setuptools.egg-info \
732 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
733 @for i in $(SCRIPTDIR) $(LIBDEST); \
735 if test ! -d $(DESTDIR)$$i; then \
736 echo "Creating directory $$i"; \
737 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
741 @for d in $(LIBSUBDIRS); \
743 a=$(srcdir)/Lib/$$d; \
744 if test ! -d $$a; then continue; else true; fi; \
746 if test ! -d $(DESTDIR)$$b; then \
747 echo "Creating directory $$b"; \
748 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
752 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
754 if test -x $$i; then \
755 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
756 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
758 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
759 echo $(INSTALL_DATA) $$i $(LIBDEST); \
762 @for d in $(LIBSUBDIRS); \
764 a=$(srcdir)/Lib/$$d; \
765 if test ! -d $$a; then continue; else true; fi; \
766 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
776 if test -d $$i; then continue; fi; \
777 if test -x $$i; then \
778 echo $(INSTALL_SCRIPT) $$i $$b; \
779 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
781 echo $(INSTALL_DATA) $$i $$b; \
782 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
787 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
788 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
789 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
791 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
792 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
793 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
795 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
796 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
797 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
798 -d $(LIBDEST)/site-packages -f \
799 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
800 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
801 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
802 -d $(LIBDEST)/site-packages -f \
803 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
805 # Create the PLATDIR source directory, if one wasn't distributed..
806 $(srcdir)/Lib/$(PLATDIR):
807 mkdir $(srcdir)/Lib/$(PLATDIR)
808 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
809 export PATH; PATH="`pwd`:$$PATH"; \
810 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
811 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
812 export EXE; EXE="$(BUILDEXE)"; \
813 cd $(srcdir)/Lib/$(PLATDIR); ./regen
815 # Install the include files
816 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
818 @for i in $(INCLDIRSTOMAKE); \
820 if test ! -d $(DESTDIR)$$i; then \
821 echo "Creating directory $$i"; \
822 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
826 @for i in $(srcdir)/Include/*.h; \
828 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
829 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
831 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
833 # Install the library and miscellaneous stuff needed for extending/embedding
834 # This goes into $(exec_prefix)
835 LIBPL= $(LIBP)/config
837 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
839 if test ! -d $(DESTDIR)$$i; then \
840 echo "Creating directory $$i"; \
841 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
845 @if test -d $(LIBRARY); then :; else \
846 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
847 if test "$(SO)" = .dll; then \
848 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
850 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
851 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
854 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
857 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
858 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
859 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
860 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
861 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
862 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
863 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
864 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
865 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
866 # Substitution happens here, as the completely-expanded BINDIR
867 # is not available in configure
868 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
869 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
871 @if [ -s Modules/python.exp -a \
872 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
873 echo; echo "Installing support files for building shared extension modules on AIX:"; \
874 $(INSTALL_DATA) Modules/python.exp \
875 $(DESTDIR)$(LIBPL)/python.exp; \
876 echo; echo "$(LIBPL)/python.exp"; \
877 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
878 $(DESTDIR)$(LIBPL)/makexp_aix; \
879 echo "$(LIBPL)/makexp_aix"; \
880 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
881 $(DESTDIR)$(LIBPL)/ld_so_aix; \
882 echo "$(LIBPL)/ld_so_aix"; \
883 echo; echo "See Misc/AIX-NOTES for details."; \
886 @case "$(MACHDEP)" in beos*) \
887 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
888 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
889 echo; echo "$(LIBPL)/README"; \
890 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
891 echo "$(LIBPL)/ar_beos"; \
892 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
893 echo "$(LIBPL)/ld_so_beos"; \
894 echo; echo "See Misc/BeOS-NOTES for details."; \
898 # Install the dynamically loadable modules
899 # This goes into $(exec_prefix)
901 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
903 --install-scripts=$(BINDIR) \
904 --install-platlib=$(DESTSHARED) \
907 # Here are a couple of targets for MacOSX again, to install a full
908 # framework-based Python. frameworkinstall installs everything, the
909 # subtargets install specific parts. Much of the actual work is offloaded to
910 # the Makefile in Mac
913 # This target is here for backward compatiblity, previous versions of Python
914 # hadn't integrated framework installation in the normal install process.
915 frameworkinstall: install
917 # On install, we re-make the framework
918 # structure in the install location, /Library/Frameworks/ or the argument to
919 # --enable-framework. If --enable-framework has been specified then we have
920 # automatically set prefix to the location deep down in the framework, so we
921 # only have to cater for the structural bits of the framework.
923 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
925 frameworkinstallstructure: $(LDLIBRARY)
926 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
927 echo Not configured with --enable-framework; \
931 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
932 if test ! -d $(DESTDIR)$$i; then \
933 echo "Creating directory $(DESTDIR)$$i"; \
934 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
938 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
939 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
940 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
941 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
942 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
943 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
944 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
945 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
946 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
947 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
949 # This installs Mac/Lib into the framework
950 # Install a number of symlinks to keep software that expects a normal unix
951 # install (which includes python-config) happy.
952 frameworkinstallmaclib:
953 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
954 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
956 # This installs the IDE, the Launcher and other apps into /Applications
957 frameworkinstallapps:
958 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
960 # This install the unix python and pythonw tools in /usr/local/bin
961 frameworkinstallunixtools:
962 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
964 frameworkaltinstallunixtools:
965 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
967 # This installs the Demos and Tools into the applications directory.
968 # It is not part of a normal frameworkinstall
969 frameworkinstallextras:
970 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
972 # This installs a few of the useful scripts in Tools/scripts
974 SRCDIR=$(srcdir) $(RUNSHARED) \
975 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
977 --install-scripts=$(BINDIR) \
980 # Build the toplevel Makefile
981 Makefile.pre: Makefile.pre.in config.status
982 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
983 $(MAKE) -f Makefile.pre Makefile
985 # Run the configure script.
986 config.status: $(srcdir)/configure
987 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
989 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
991 # Some make's put the object file in the current directory
993 $(CC) -c $(PY_CFLAGS) -o $@ $<
995 # Run reindent on the library
997 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
999 # Rerun configure with the same options as it was run last time,
1000 # provided the config.status script exists
1002 $(SHELL) config.status --recheck
1003 $(SHELL) config.status
1005 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1007 (cd $(srcdir); autoconf)
1008 (cd $(srcdir); autoheader)
1010 # Create a tags file for vi
1013 ctags -w -t Include/*.h; \
1014 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1018 # Create a tags file for GNU Emacs
1021 etags Include/*.h; \
1022 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1024 # Sanitation targets -- clean leaves libraries, executables and tags
1025 # files, which clobber removes those as well
1027 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1030 find . -name '*.o' -exec rm -f {} ';'
1031 find . -name '*.s[ol]' -exec rm -f {} ';'
1032 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1033 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1036 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1038 config.cache config.log pyconfig.h Modules/config.c
1039 -rm -rf build platform
1040 -rm -rf $(PYTHONFRAMEWORKDIR)
1042 # Make things extra clean, before making a distribution:
1043 # remove all generated files, even Makefile[.pre]
1044 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1046 -rm -f core Makefile Makefile.pre config.status \
1047 Modules/Setup Modules/Setup.local Modules/Setup.config
1048 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1049 -o -name '[@,#]*' -o -name '*.old' \
1050 -o -name '*.orig' -o -name '*.rej' \
1051 -o -name '*.bak' ')' \
1054 # Check for smelly exported symbols (not starting with Py/_Py)
1056 nm -p $(LIBRARY) | \
1057 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1059 # Find files with funny names
1061 find $(DISTDIRS) -type d \
1062 -o -name '*.[chs]' \
1072 -o -name '*,[vpt]' \
1074 -o -name 'Setup.*' \
1077 -o -name ChangeLog \
1078 -o -name Repository \
1084 -o -name .cvsignore \
1090 Python/thread.o: @THREADHEADERS@
1092 # Declare targets that aren't real files
1093 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1094 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1095 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1096 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1097 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1098 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1099 .PHONY: smelly funny
1101 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY