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. -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 # Expanded directories
86 BINDIR= $(exec_prefix)/bin
87 LIBDIR= $(exec_prefix)/lib
89 INCLUDEDIR= @includedir@
90 CONFINCLUDEDIR= $(exec_prefix)/include
91 SCRIPTDIR= $(prefix)/lib
93 # Detailed destination directories
94 BINLIBDEST= $(LIBDIR)/python$(VERSION)
95 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
96 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
97 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
98 LIBP= $(LIBDIR)/python$(VERSION)
100 # Symbols used for using shared libraries
103 BLDSHARED= @BLDSHARED@
104 DESTSHARED= $(BINLIBDEST)/lib-dynload
106 # Executable suffix (.exe on Windows and Mac OS X)
108 BUILDEXE= @BUILDEXEEXT@
110 # Short name and location for Mac OS X Python framework
111 UNIVERSALSDK=@UNIVERSALSDK@
112 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
113 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
114 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
115 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
116 # Deployment target selected during configure, to be checked
117 # by distutils. The export statement is needed to ensure that the
118 # deployment target is active during build.
119 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
120 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
122 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
123 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
125 # Environment to run shared python without installed libraries
126 RUNSHARED= @RUNSHARED@
128 # Modes for directories, executables and data files created by the
129 # install process. Default to user-only-writable for all file types.
134 # configure script arguments
135 CONFIG_ARGS= @CONFIG_ARGS@
138 # Subdirectories with code
141 # Other subdirectories
142 SUBDIRSTOO= Include Lib Misc Demo
144 # Files and directories to be distributed
145 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
146 DISTFILES= README ChangeLog $(CONFIGFILES)
147 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
148 DIST= $(DISTFILES) $(DISTDIRS)
152 LDLIBRARY= @LDLIBRARY@
153 BLDLIBRARY= @BLDLIBRARY@
154 DLLLIBRARY= @DLLLIBRARY@
155 LDLIBRARYDIR= @LDLIBRARYDIR@
156 INSTSONAME= @INSTSONAME@
162 SYSLIBS= $(LIBM) $(LIBC)
165 THREADOBJ= @THREADOBJ@
166 DLINCLDIR= @DLINCLDIR@
167 DYNLOADFILE= @DYNLOADFILE@
168 MACHDEP_OBJS= @MACHDEP_OBJS@
169 UNICODE_OBJS= @UNICODE_OBJS@
172 BUILDPYTHON= python$(BUILDEXE)
174 # === Definitions added by makesetup ===
177 ##########################################################################
185 # Used of signalmodule.o is not available
186 SIGNAL_OBJS= @SIGNAL_OBJS@
189 ##########################################################################
191 GRAMMAR_H= $(srcdir)/Include/graminit.h
192 GRAMMAR_C= $(srcdir)/Python/graminit.c
193 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
196 ##########################################################################
198 PGEN= Parser/pgen$(EXE)
208 Parser/metagrammar.o \
213 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
217 Python/mysnprintf.o \
218 Parser/tokenizer_pgen.o \
219 Parser/printgrammar.o \
222 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
224 ##########################################################################
226 AST_H_DIR= $(srcdir)/Include
227 AST_H= $(AST_H_DIR)/Python-ast.h
228 AST_C_DIR= $(srcdir)/Python
229 AST_C= $(AST_C_DIR)/Python-ast.c
230 AST_ASDL= $(srcdir)/Parser/Python.asdl
232 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
233 # XXX Note that a build now requires Python exist before the build starts
234 ASDLGEN= $(srcdir)/Parser/asdl_c.py
236 ##########################################################################
239 Python/Python-ast.o \
242 Python/bltinmodule.o \
248 Python/frozenmain.o \
251 Python/getcompiler.o \
252 Python/getcopyright.o \
254 Python/getplatform.o \
255 Python/getversion.o \
260 Python/modsupport.o \
262 Python/mysnprintf.o \
267 Python/structmember.o \
273 Python/$(DYNLOADFILE) \
278 ##########################################################################
282 Objects/boolobject.o \
283 Objects/bufferobject.o \
284 Objects/cellobject.o \
285 Objects/classobject.o \
287 Objects/codeobject.o \
288 Objects/complexobject.o \
289 Objects/descrobject.o \
290 Objects/enumobject.o \
291 Objects/exceptions.o \
292 Objects/genobject.o \
293 Objects/fileobject.o \
294 Objects/floatobject.o \
295 Objects/frameobject.o \
296 Objects/funcobject.o \
297 Objects/intobject.o \
298 Objects/iterobject.o \
299 Objects/listobject.o \
300 Objects/longobject.o \
301 Objects/dictobject.o \
302 Objects/methodobject.o \
303 Objects/moduleobject.o \
306 Objects/rangeobject.o \
307 Objects/setobject.o \
308 Objects/sliceobject.o \
309 Objects/stringobject.o \
310 Objects/structseq.o \
311 Objects/tupleobject.o \
312 Objects/typeobject.o \
313 Objects/weakrefobject.o \
317 ##########################################################################
318 # objects that get linked into the Python library
320 Modules/_typesmodule.o \
321 Modules/getbuildinfo.o \
329 #########################################################################
333 all: $(BUILDPYTHON) oldsharedmods sharedmods
335 # Build the interpreter
336 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
337 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
339 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
341 platform: $(BUILDPYTHON)
342 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
345 # Build the shared modules
346 sharedmods: $(BUILDPYTHON)
347 case $$MAKEFLAGS in \
348 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
349 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
352 # Build static library
353 # avoid long command lines, same as LIBRARY_OBJS
354 $(LIBRARY): $(LIBRARY_OBJS)
356 $(AR) cr $@ Modules/getbuildinfo.o
357 $(AR) cr $@ Modules/_typesmodule.o
358 $(AR) cr $@ $(PARSER_OBJS)
359 $(AR) cr $@ $(OBJECT_OBJS)
360 $(AR) cr $@ $(PYTHON_OBJS)
361 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
362 $(AR) cr $@ $(MODOBJS)
365 libpython$(VERSION).so: $(LIBRARY_OBJS)
366 if test $(INSTSONAME) != $(LDLIBRARY); then \
367 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
368 $(LN) -f $(INSTSONAME) $@; \
370 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
373 libpython$(VERSION).sl: $(LIBRARY_OBJS)
374 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
376 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
377 # minimal framework (not including the Lib directory and such) in the current
379 RESSRCDIR=$(srcdir)/Mac/Resources/framework
380 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
382 $(RESSRCDIR)/Info.plist \
383 $(RESSRCDIR)/version.plist \
384 $(RESSRCDIR)/English.lproj/InfoPlist.strings
385 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
386 if test "${UNIVERSALSDK}"; then \
387 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
388 -isysroot "${UNIVERSALSDK}" \
389 -all_load $(LIBRARY) -Wl,-single_module \
390 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
391 -compatibility_version $(VERSION) \
392 -current_version $(VERSION); \
394 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
397 $(INSTALL) -d -m $(DIRMODE) \
398 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
399 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
400 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
401 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
402 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
403 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
404 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
405 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
406 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
407 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
408 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
410 # This rule builds the Cygwin Python DLL and import library if configured
411 # for a shared core library; otherwise, this rule is a noop.
412 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
413 if test -n "$(DLLLIBRARY)"; then \
414 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
415 $(LIBS) $(MODLIBS) $(SYSLIBS); \
420 oldsharedmods: $(SHAREDMODS)
423 Makefile Modules/config.c: Makefile.pre \
424 $(srcdir)/Modules/config.c.in \
426 Modules/Setup.config \
429 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
431 Modules/Setup.config \
432 Modules/Setup.local \
435 @echo "The Makefile was updated, you may need to re-run make."
438 Modules/Setup: $(srcdir)/Modules/Setup.dist
439 @if test -f Modules/Setup; then \
440 echo "-----------------------------------------------"; \
441 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
442 echo "check to make sure you have all the updates you"; \
443 echo "need in your Modules/Setup file."; \
444 echo "Usually, copying Setup.dist to Setup will work."; \
445 echo "-----------------------------------------------"; \
448 ############################################################################
449 # Special rules for object files
451 Modules/getbuildinfo.o: $(PARSER_OBJS) \
457 $(srcdir)/Modules/getbuildinfo.c
458 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
460 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
461 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
462 -DPREFIX='"$(prefix)"' \
463 -DEXEC_PREFIX='"$(exec_prefix)"' \
464 -DVERSION='"$(VERSION)"' \
465 -DVPATH='"$(VPATH)"' \
466 -o $@ $(srcdir)/Modules/getpath.c
468 Modules/python.o: $(srcdir)/Modules/python.c
469 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
472 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
473 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
476 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
478 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
479 $(srcdir)/Include/token.h \
480 $(srcdir)/Include/grammar.h
481 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
483 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
485 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
486 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
488 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
489 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
491 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
493 Python/getplatform.o: $(srcdir)/Python/getplatform.c
494 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
496 Python/importdl.o: $(srcdir)/Python/importdl.c
497 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
499 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
500 $(srcdir)/Objects/unicodetype_db.h
502 ############################################################################
507 Include/Python-ast.h \
510 Include/boolobject.h \
511 Include/bufferobject.h \
513 Include/classobject.h \
518 Include/complexobject.h \
519 Include/descrobject.h \
520 Include/dictobject.h \
521 Include/enumobject.h \
522 Include/genobject.h \
523 Include/fileobject.h \
524 Include/floatobject.h \
525 Include/funcobject.h \
527 Include/intobject.h \
528 Include/intrcheck.h \
529 Include/iterobject.h \
530 Include/listobject.h \
531 Include/longobject.h \
532 Include/methodobject.h \
533 Include/modsupport.h \
534 Include/moduleobject.h \
537 Include/patchlevel.h \
545 Include/pythonrun.h \
546 Include/rangeobject.h \
547 Include/setobject.h \
548 Include/sliceobject.h \
549 Include/stringobject.h \
550 Include/structseq.h \
551 Include/structmember.h \
553 Include/sysmodule.h \
554 Include/traceback.h \
555 Include/tupleobject.h \
556 Include/unicodeobject.h \
557 Include/weakrefobject.h \
560 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
563 ######################################################################
565 # Test the interpreter (twice, once without .pyc files, once with)
566 # In the past, we've had problems where bugs in the marshalling or
567 # elsewhere caused bytecode read from .pyc files to behave differently
568 # than bytecode generated directly from a .py source file. Sometimes
569 # the bytecode read from a .pyc file had the bug, somtimes the directly
570 # generated bytecode. This is sometimes a very shy bug needing a lot of
573 TESTOPTS= -l $(EXTRATESTOPTS)
574 TESTPROG= $(srcdir)/Lib/test/regrtest.py
575 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
577 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
578 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
579 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
581 testall: all platform
582 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
583 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
584 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
586 # Run the unitests for both architectures in a Universal build on OSX
587 # Must be run on an Intel box.
588 testuniversal: all platform
589 if [ `arch` != 'i386' ];then \
590 echo "This can only be used on OSX/i386" ;\
593 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
594 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
595 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
596 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
599 # Like testall, but with a single pass only
600 buildbottest: all platform
601 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
603 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
604 test_unicodedata test_re test_sre test_select test_poll \
605 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
606 quicktest: all platform
607 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
608 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
609 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
611 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
613 memtest: all platform
614 -rm -f $(srcdir)/Lib/test/*.py[co]
615 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
616 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
619 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
621 # Install almost everything without disturbing previous versions
622 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
623 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
625 # Install shared libraries enabled by Setup
626 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
628 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
629 @for i in X $(SHAREDMODS); do \
630 if test $$i != X; then \
631 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
632 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
637 @for i in $(DESTDIRS); \
639 if test ! -d $(DESTDIR)$$i; then \
640 echo "Creating directory $$i"; \
641 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
647 # Install the interpreter (by creating a hard link to python$(VERSION))
648 bininstall: altbininstall
649 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
650 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
653 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
654 (cd $(DESTDIR)$(BINDIR); $(LN) -sf python$(VERSION)-config python-config)
656 # Install the interpreter with $(VERSION) affixed
657 # This goes into $(exec_prefix)
658 altbininstall: $(BUILDPYTHON)
659 @for i in $(BINDIR) $(LIBDIR); \
661 if test ! -d $(DESTDIR)$$i; then \
662 echo "Creating directory $$i"; \
663 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
667 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
668 if test -f libpython$(VERSION)$(SO); then \
669 if test "$(SO)" = .dll; then \
670 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
672 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
673 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
674 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
680 # Install the manual page
682 @for i in $(MANDIR) $(MANDIR)/man1; \
684 if test ! -d $(DESTDIR)$$i; then \
685 echo "Creating directory $$i"; \
686 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
690 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
691 $(DESTDIR)$(MANDIR)/man1/python.1
693 # Install the library
694 PLATDIR= plat-$(MACHDEP)
695 EXTRAPLATDIR= @EXTRAPLATDIR@
696 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
697 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
698 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
699 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
700 plat-mac/lib-scriptpackages/_builtinSuites \
701 plat-mac/lib-scriptpackages/CodeWarrior \
702 plat-mac/lib-scriptpackages/Explorer \
703 plat-mac/lib-scriptpackages/Finder \
704 plat-mac/lib-scriptpackages/Netscape \
705 plat-mac/lib-scriptpackages/StdSuites \
706 plat-mac/lib-scriptpackages/SystemEvents \
707 plat-mac/lib-scriptpackages/Terminal
708 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
709 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
710 test/decimaltestdata \
711 encodings compiler hotshot \
712 email email/mime email/test email/test/data \
713 sqlite3 sqlite3/test \
714 logging bsddb bsddb/test csv wsgiref \
715 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
716 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
717 setuptools setuptools/command setuptools/tests setuptools.egg-info \
719 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
720 @for i in $(SCRIPTDIR) $(LIBDEST); \
722 if test ! -d $(DESTDIR)$$i; then \
723 echo "Creating directory $$i"; \
724 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
728 @for d in $(LIBSUBDIRS); \
730 a=$(srcdir)/Lib/$$d; \
731 if test ! -d $$a; then continue; else true; fi; \
733 if test ! -d $(DESTDIR)$$b; then \
734 echo "Creating directory $$b"; \
735 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
739 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
741 if test -x $$i; then \
742 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
743 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
745 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
746 echo $(INSTALL_DATA) $$i $(LIBDEST); \
749 @for d in $(LIBSUBDIRS); \
751 a=$(srcdir)/Lib/$$d; \
752 if test ! -d $$a; then continue; else true; fi; \
753 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
763 if test -d $$i; then continue; fi; \
764 if test -x $$i; then \
765 echo $(INSTALL_SCRIPT) $$i $$b; \
766 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
768 echo $(INSTALL_DATA) $$i $$b; \
769 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
774 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
775 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
776 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
778 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
779 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
780 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
782 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
783 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
784 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
785 -d $(LIBDEST)/site-packages -f \
786 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
787 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
788 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
789 -d $(LIBDEST)/site-packages -f \
790 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
792 # Create the PLATDIR source directory, if one wasn't distributed..
793 $(srcdir)/Lib/$(PLATDIR):
794 mkdir $(srcdir)/Lib/$(PLATDIR)
795 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
796 export PATH; PATH="`pwd`:$$PATH"; \
797 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
798 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
799 export EXE; EXE="$(BUILDEXE)"; \
800 cd $(srcdir)/Lib/$(PLATDIR); ./regen
802 # Install the include files
803 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
805 @for i in $(INCLDIRSTOMAKE); \
807 if test ! -d $(DESTDIR)$$i; then \
808 echo "Creating directory $$i"; \
809 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
813 @for i in $(srcdir)/Include/*.h; \
815 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
816 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
818 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
820 # Install the library and miscellaneous stuff needed for extending/embedding
821 # This goes into $(exec_prefix)
822 LIBPL= $(LIBP)/config
824 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
826 if test ! -d $(DESTDIR)$$i; then \
827 echo "Creating directory $$i"; \
828 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
832 @if test -d $(LIBRARY); then :; else \
833 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
834 if test "$(SO)" = .dll; then \
835 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
837 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
838 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
841 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
844 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
845 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
846 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
847 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
848 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
849 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
850 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
851 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
852 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
853 # Substitution happens here, as the completely-expanded BINDIR
854 # is not available in configure
855 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
856 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
858 @if [ -s Modules/python.exp -a \
859 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
860 echo; echo "Installing support files for building shared extension modules on AIX:"; \
861 $(INSTALL_DATA) Modules/python.exp \
862 $(DESTDIR)$(LIBPL)/python.exp; \
863 echo; echo "$(LIBPL)/python.exp"; \
864 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
865 $(DESTDIR)$(LIBPL)/makexp_aix; \
866 echo "$(LIBPL)/makexp_aix"; \
867 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
868 $(DESTDIR)$(LIBPL)/ld_so_aix; \
869 echo "$(LIBPL)/ld_so_aix"; \
870 echo; echo "See Misc/AIX-NOTES for details."; \
873 @case "$(MACHDEP)" in beos*) \
874 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
875 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
876 echo; echo "$(LIBPL)/README"; \
877 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
878 echo "$(LIBPL)/ar_beos"; \
879 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
880 echo "$(LIBPL)/ld_so_beos"; \
881 echo; echo "See Misc/BeOS-NOTES for details."; \
885 # Install the dynamically loadable modules
886 # This goes into $(exec_prefix)
888 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
890 --install-scripts=$(BINDIR) \
891 --install-platlib=$(DESTSHARED) \
894 # Here are a couple of targets for MacOSX again, to install a full
895 # framework-based Python. frameworkinstall installs everything, the
896 # subtargets install specific parts. Much of the actual work is offloaded to
897 # the Makefile in Mac
900 # This target is here for backward compatiblity, previous versions of Python
901 # hadn't integrated framework installation in the normal install process.
902 frameworkinstall: install
904 # On install, we re-make the framework
905 # structure in the install location, /Library/Frameworks/ or the argument to
906 # --enable-framework. If --enable-framework has been specified then we have
907 # automatically set prefix to the location deep down in the framework, so we
908 # only have to cater for the structural bits of the framework.
910 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
912 frameworkinstallstructure: $(LDLIBRARY)
913 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
914 echo Not configured with --enable-framework; \
918 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
919 if test ! -d $(DESTDIR)$$i; then \
920 echo "Creating directory $(DESTDIR)$$i"; \
921 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
925 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
926 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
927 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
928 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
929 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
930 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
931 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
932 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
933 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
934 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
936 # This installs Mac/Lib into the framework
937 # Install a number of symlinks to keep software that expects a normal unix
938 # install (which includes python-config) happy.
939 frameworkinstallmaclib:
940 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
941 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
943 # This installs the IDE, the Launcher and other apps into /Applications
944 frameworkinstallapps:
945 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
947 # This install the unix python and pythonw tools in /usr/local/bin
948 frameworkinstallunixtools:
949 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
951 frameworkaltinstallunixtools:
952 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
954 # This installs the Demos and Tools into the applications directory.
955 # It is not part of a normal frameworkinstall
956 frameworkinstallextras:
957 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
959 # This installs a few of the useful scripts in Tools/scripts
961 SRCDIR=$(srcdir) $(RUNSHARED) \
962 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
964 --install-scripts=$(BINDIR) \
967 # Build the toplevel Makefile
968 Makefile.pre: Makefile.pre.in config.status
969 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
970 $(MAKE) -f Makefile.pre Makefile
972 # Run the configure script.
973 config.status: $(srcdir)/configure
974 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
976 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
978 # Some make's put the object file in the current directory
980 $(CC) -c $(PY_CFLAGS) -o $@ $<
982 # Run reindent on the library
984 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
986 # Rerun configure with the same options as it was run last time,
987 # provided the config.status script exists
989 $(SHELL) config.status --recheck
990 $(SHELL) config.status
992 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
994 (cd $(srcdir); autoconf)
995 (cd $(srcdir); autoheader)
997 # Create a tags file for vi
1000 ctags -w -t Include/*.h; \
1001 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1005 # Create a tags file for GNU Emacs
1008 etags Include/*.h; \
1009 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1011 # Sanitation targets -- clean leaves libraries, executables and tags
1012 # files, which clobber removes those as well
1014 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1017 find . -name '*.o' -exec rm -f {} ';'
1018 find . -name '*.s[ol]' -exec rm -f {} ';'
1019 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1020 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1023 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1025 config.cache config.log pyconfig.h Modules/config.c
1026 -rm -rf build platform
1027 -rm -rf $(PYTHONFRAMEWORKDIR)
1029 # Make things extra clean, before making a distribution:
1030 # remove all generated files, even Makefile[.pre]
1031 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1033 -rm -f core Makefile Makefile.pre config.status \
1034 Modules/Setup Modules/Setup.local Modules/Setup.config
1035 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1036 -o -name '[@,#]*' -o -name '*.old' \
1037 -o -name '*.orig' -o -name '*.rej' \
1038 -o -name '*.bak' ')' \
1041 # Check for smelly exported symbols (not starting with Py/_Py)
1043 nm -p $(LIBRARY) | \
1044 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1046 # Find files with funny names
1048 find $(DISTDIRS) -type d \
1049 -o -name '*.[chs]' \
1059 -o -name '*,[vpt]' \
1061 -o -name 'Setup.*' \
1064 -o -name ChangeLog \
1065 -o -name Repository \
1071 -o -name .cvsignore \
1077 Python/thread.o: @THREADHEADERS@
1079 # Declare targets that aren't real files
1080 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1081 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1082 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1083 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1084 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1085 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1086 .PHONY: smelly funny
1088 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY