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 #########################################################################
338 build_all: $(BUILDPYTHON) oldsharedmods sharedmods
340 # Build the interpreter
341 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
342 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
344 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
346 platform: $(BUILDPYTHON)
347 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
350 # Build the shared modules
351 sharedmods: $(BUILDPYTHON)
352 @case $$MAKEFLAGS in \
353 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
354 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
357 # Build static library
358 # avoid long command lines, same as LIBRARY_OBJS
359 $(LIBRARY): $(LIBRARY_OBJS)
361 $(AR) cr $@ Modules/getbuildinfo.o
362 $(AR) cr $@ Modules/_typesmodule.o
363 $(AR) cr $@ $(PARSER_OBJS)
364 $(AR) cr $@ $(OBJECT_OBJS)
365 $(AR) cr $@ $(PYTHON_OBJS)
366 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
367 $(AR) cr $@ $(MODOBJS)
370 libpython$(VERSION).so: $(LIBRARY_OBJS)
371 if test $(INSTSONAME) != $(LDLIBRARY); then \
372 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
373 $(LN) -f $(INSTSONAME) $@; \
375 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
378 libpython$(VERSION).sl: $(LIBRARY_OBJS)
379 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
381 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
382 # minimal framework (not including the Lib directory and such) in the current
384 RESSRCDIR=$(srcdir)/Mac/Resources/framework
385 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
387 $(RESSRCDIR)/Info.plist \
388 $(RESSRCDIR)/version.plist \
389 $(RESSRCDIR)/English.lproj/InfoPlist.strings
390 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
391 if test "${UNIVERSALSDK}"; then \
392 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
393 -isysroot "${UNIVERSALSDK}" \
394 -all_load $(LIBRARY) -Wl,-single_module \
395 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
396 -compatibility_version $(VERSION) \
397 -current_version $(VERSION); \
399 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
402 $(INSTALL) -d -m $(DIRMODE) \
403 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
404 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
405 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
406 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
407 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
408 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
409 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
410 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
411 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
412 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
413 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
415 # This rule builds the Cygwin Python DLL and import library if configured
416 # for a shared core library; otherwise, this rule is a noop.
417 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
418 if test -n "$(DLLLIBRARY)"; then \
419 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
420 $(LIBS) $(MODLIBS) $(SYSLIBS); \
425 oldsharedmods: $(SHAREDMODS)
428 Makefile Modules/config.c: Makefile.pre \
429 $(srcdir)/Modules/config.c.in \
431 Modules/Setup.config \
434 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
436 Modules/Setup.config \
437 Modules/Setup.local \
440 @echo "The Makefile was updated, you may need to re-run make."
443 Modules/Setup: $(srcdir)/Modules/Setup.dist
444 @if test -f Modules/Setup; then \
445 echo "-----------------------------------------------"; \
446 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
447 echo "check to make sure you have all the updates you"; \
448 echo "need in your Modules/Setup file."; \
449 echo "Usually, copying Setup.dist to Setup will work."; \
450 echo "-----------------------------------------------"; \
453 ############################################################################
454 # Special rules for object files
456 Modules/getbuildinfo.o: $(PARSER_OBJS) \
462 $(srcdir)/Modules/getbuildinfo.c
463 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
465 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
466 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
467 -DPREFIX='"$(prefix)"' \
468 -DEXEC_PREFIX='"$(exec_prefix)"' \
469 -DVERSION='"$(VERSION)"' \
470 -DVPATH='"$(VPATH)"' \
471 -o $@ $(srcdir)/Modules/getpath.c
473 Modules/python.o: $(srcdir)/Modules/python.c
474 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
477 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
479 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
482 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
484 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
485 $(srcdir)/Include/token.h \
486 $(srcdir)/Include/grammar.h
487 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
489 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
491 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
493 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
494 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
496 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
497 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
499 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
501 Python/getplatform.o: $(srcdir)/Python/getplatform.c
502 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
504 Python/importdl.o: $(srcdir)/Python/importdl.c
505 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
507 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
508 $(srcdir)/Objects/unicodetype_db.h
510 ############################################################################
515 Include/Python-ast.h \
518 Include/boolobject.h \
519 Include/bufferobject.h \
521 Include/classobject.h \
526 Include/complexobject.h \
527 Include/descrobject.h \
528 Include/dictobject.h \
529 Include/enumobject.h \
530 Include/genobject.h \
531 Include/fileobject.h \
532 Include/floatobject.h \
533 Include/funcobject.h \
535 Include/intobject.h \
536 Include/intrcheck.h \
537 Include/iterobject.h \
538 Include/listobject.h \
539 Include/longobject.h \
540 Include/methodobject.h \
541 Include/modsupport.h \
542 Include/moduleobject.h \
546 Include/patchlevel.h \
554 Include/pythonrun.h \
555 Include/rangeobject.h \
556 Include/setobject.h \
557 Include/sliceobject.h \
558 Include/stringobject.h \
559 Include/structseq.h \
560 Include/structmember.h \
562 Include/sysmodule.h \
563 Include/traceback.h \
564 Include/tupleobject.h \
565 Include/unicodeobject.h \
566 Include/weakrefobject.h \
569 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
572 ######################################################################
574 # Test the interpreter (twice, once without .pyc files, once with)
575 # In the past, we've had problems where bugs in the marshalling or
576 # elsewhere caused bytecode read from .pyc files to behave differently
577 # than bytecode generated directly from a .py source file. Sometimes
578 # the bytecode read from a .pyc file had the bug, somtimes the directly
579 # generated bytecode. This is sometimes a very shy bug needing a lot of
582 TESTOPTS= -l $(EXTRATESTOPTS)
583 TESTPROG= $(srcdir)/Lib/test/regrtest.py
584 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
586 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
587 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
588 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
590 testall: all platform
591 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
592 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
593 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
595 # Run the unitests for both architectures in a Universal build on OSX
596 # Must be run on an Intel box.
597 testuniversal: all platform
598 if [ `arch` != 'i386' ];then \
599 echo "This can only be used on OSX/i386" ;\
602 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
603 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
604 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
605 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
608 # Like testall, but with a single pass only
609 # run an optional script to include some information about the build environment
610 buildbottest: all platform
611 -@if which pybuildbot.identify >/dev/null 2>&1; then \
612 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
614 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
616 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
617 test_unicodedata test_re test_sre test_select test_poll \
618 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
619 quicktest: all platform
620 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
621 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
622 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
624 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
626 memtest: all platform
627 -rm -f $(srcdir)/Lib/test/*.py[co]
628 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
629 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
632 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
634 # Install almost everything without disturbing previous versions
635 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
636 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
638 # Install shared libraries enabled by Setup
639 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
641 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
642 @for i in X $(SHAREDMODS); do \
643 if test $$i != X; then \
644 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
645 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
650 @for i in $(DESTDIRS); \
652 if test ! -d $(DESTDIR)$$i; then \
653 echo "Creating directory $$i"; \
654 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
660 # Install the interpreter (by creating a hard link to python$(VERSION))
661 bininstall: altbininstall
662 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
663 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
666 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
667 -rm -f $(DESTDIR)$(BINDIR)/python-config
668 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
670 # Install the interpreter with $(VERSION) affixed
671 # This goes into $(exec_prefix)
672 altbininstall: $(BUILDPYTHON)
673 @for i in $(BINDIR) $(LIBDIR); \
675 if test ! -d $(DESTDIR)$$i; then \
676 echo "Creating directory $$i"; \
677 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
681 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
682 if test -f libpython$(VERSION)$(SO); then \
683 if test "$(SO)" = .dll; then \
684 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
686 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
687 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
688 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
694 # Install the manual page
696 @for i in $(MANDIR) $(MANDIR)/man1; \
698 if test ! -d $(DESTDIR)$$i; then \
699 echo "Creating directory $$i"; \
700 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
704 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
705 $(DESTDIR)$(MANDIR)/man1/python.1
707 # Install the library
708 PLATDIR= plat-$(MACHDEP)
709 EXTRAPLATDIR= @EXTRAPLATDIR@
710 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
711 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
712 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
713 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
714 plat-mac/lib-scriptpackages/_builtinSuites \
715 plat-mac/lib-scriptpackages/CodeWarrior \
716 plat-mac/lib-scriptpackages/Explorer \
717 plat-mac/lib-scriptpackages/Finder \
718 plat-mac/lib-scriptpackages/Netscape \
719 plat-mac/lib-scriptpackages/StdSuites \
720 plat-mac/lib-scriptpackages/SystemEvents \
721 plat-mac/lib-scriptpackages/Terminal
722 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
723 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
724 test/decimaltestdata \
725 encodings compiler hotshot \
726 email email/mime email/test email/test/data \
727 sqlite3 sqlite3/test \
728 logging bsddb bsddb/test csv wsgiref \
729 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
730 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
731 setuptools setuptools/command setuptools/tests setuptools.egg-info \
733 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
734 @for i in $(SCRIPTDIR) $(LIBDEST); \
736 if test ! -d $(DESTDIR)$$i; then \
737 echo "Creating directory $$i"; \
738 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
742 @for d in $(LIBSUBDIRS); \
744 a=$(srcdir)/Lib/$$d; \
745 if test ! -d $$a; then continue; else true; fi; \
747 if test ! -d $(DESTDIR)$$b; then \
748 echo "Creating directory $$b"; \
749 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
753 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
755 if test -x $$i; then \
756 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
757 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
759 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
760 echo $(INSTALL_DATA) $$i $(LIBDEST); \
763 @for d in $(LIBSUBDIRS); \
765 a=$(srcdir)/Lib/$$d; \
766 if test ! -d $$a; then continue; else true; fi; \
767 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
777 if test -d $$i; then continue; fi; \
778 if test -x $$i; then \
779 echo $(INSTALL_SCRIPT) $$i $$b; \
780 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
782 echo $(INSTALL_DATA) $$i $$b; \
783 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
788 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
789 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
790 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
792 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
793 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
794 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
796 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
797 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
798 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
799 -d $(LIBDEST)/site-packages -f \
800 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
801 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
802 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
803 -d $(LIBDEST)/site-packages -f \
804 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
806 # Create the PLATDIR source directory, if one wasn't distributed..
807 $(srcdir)/Lib/$(PLATDIR):
808 mkdir $(srcdir)/Lib/$(PLATDIR)
809 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
810 export PATH; PATH="`pwd`:$$PATH"; \
811 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
812 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
813 export EXE; EXE="$(BUILDEXE)"; \
814 cd $(srcdir)/Lib/$(PLATDIR); ./regen
816 # Install the include files
817 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
819 @for i in $(INCLDIRSTOMAKE); \
821 if test ! -d $(DESTDIR)$$i; then \
822 echo "Creating directory $$i"; \
823 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
827 @for i in $(srcdir)/Include/*.h; \
829 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
830 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
832 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
834 # Install the library and miscellaneous stuff needed for extending/embedding
835 # This goes into $(exec_prefix)
836 LIBPL= $(LIBP)/config
838 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
840 if test ! -d $(DESTDIR)$$i; then \
841 echo "Creating directory $$i"; \
842 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
846 @if test -d $(LIBRARY); then :; else \
847 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
848 if test "$(SO)" = .dll; then \
849 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
851 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
852 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
855 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
858 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
859 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
860 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
861 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
862 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
863 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
864 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
865 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
866 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
867 # Substitution happens here, as the completely-expanded BINDIR
868 # is not available in configure
869 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
870 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
872 @if [ -s Modules/python.exp -a \
873 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
874 echo; echo "Installing support files for building shared extension modules on AIX:"; \
875 $(INSTALL_DATA) Modules/python.exp \
876 $(DESTDIR)$(LIBPL)/python.exp; \
877 echo; echo "$(LIBPL)/python.exp"; \
878 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
879 $(DESTDIR)$(LIBPL)/makexp_aix; \
880 echo "$(LIBPL)/makexp_aix"; \
881 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
882 $(DESTDIR)$(LIBPL)/ld_so_aix; \
883 echo "$(LIBPL)/ld_so_aix"; \
884 echo; echo "See Misc/AIX-NOTES for details."; \
887 @case "$(MACHDEP)" in beos*) \
888 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
889 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
890 echo; echo "$(LIBPL)/README"; \
891 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
892 echo "$(LIBPL)/ar_beos"; \
893 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
894 echo "$(LIBPL)/ld_so_beos"; \
895 echo; echo "See Misc/BeOS-NOTES for details."; \
899 # Install the dynamically loadable modules
900 # This goes into $(exec_prefix)
902 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
904 --install-scripts=$(BINDIR) \
905 --install-platlib=$(DESTSHARED) \
908 # Here are a couple of targets for MacOSX again, to install a full
909 # framework-based Python. frameworkinstall installs everything, the
910 # subtargets install specific parts. Much of the actual work is offloaded to
911 # the Makefile in Mac
914 # This target is here for backward compatiblity, previous versions of Python
915 # hadn't integrated framework installation in the normal install process.
916 frameworkinstall: install
918 # On install, we re-make the framework
919 # structure in the install location, /Library/Frameworks/ or the argument to
920 # --enable-framework. If --enable-framework has been specified then we have
921 # automatically set prefix to the location deep down in the framework, so we
922 # only have to cater for the structural bits of the framework.
924 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
926 frameworkinstallstructure: $(LDLIBRARY)
927 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
928 echo Not configured with --enable-framework; \
932 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
933 if test ! -d $(DESTDIR)$$i; then \
934 echo "Creating directory $(DESTDIR)$$i"; \
935 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
939 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
940 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
941 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
942 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
943 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
944 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
945 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
946 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
947 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
948 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
950 # This installs Mac/Lib into the framework
951 # Install a number of symlinks to keep software that expects a normal unix
952 # install (which includes python-config) happy.
953 frameworkinstallmaclib:
954 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
955 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
957 # This installs the IDE, the Launcher and other apps into /Applications
958 frameworkinstallapps:
959 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
961 # This install the unix python and pythonw tools in /usr/local/bin
962 frameworkinstallunixtools:
963 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
965 frameworkaltinstallunixtools:
966 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
968 # This installs the Demos and Tools into the applications directory.
969 # It is not part of a normal frameworkinstall
970 frameworkinstallextras:
971 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
973 # This installs a few of the useful scripts in Tools/scripts
975 SRCDIR=$(srcdir) $(RUNSHARED) \
976 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
978 --install-scripts=$(BINDIR) \
981 # Build the toplevel Makefile
982 Makefile.pre: Makefile.pre.in config.status
983 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
984 $(MAKE) -f Makefile.pre Makefile
986 # Run the configure script.
987 config.status: $(srcdir)/configure
988 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
990 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
992 # Some make's put the object file in the current directory
994 $(CC) -c $(PY_CFLAGS) -o $@ $<
996 # Run reindent on the library
998 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1000 # Rerun configure with the same options as it was run last time,
1001 # provided the config.status script exists
1003 $(SHELL) config.status --recheck
1004 $(SHELL) config.status
1006 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1008 (cd $(srcdir); autoconf)
1009 (cd $(srcdir); autoheader)
1011 # Create a tags file for vi
1014 ctags -w -t Include/*.h; \
1015 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1019 # Create a tags file for GNU Emacs
1022 etags Include/*.h; \
1023 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1025 # Sanitation targets -- clean leaves libraries, executables and tags
1026 # files, which clobber removes those as well
1028 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1031 find . -name '*.o' -exec rm -f {} ';'
1032 find . -name '*.s[ol]' -exec rm -f {} ';'
1033 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1034 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1037 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1039 config.cache config.log pyconfig.h Modules/config.c
1040 -rm -rf build platform
1041 -rm -rf $(PYTHONFRAMEWORKDIR)
1043 # Make things extra clean, before making a distribution:
1044 # remove all generated files, even Makefile[.pre]
1045 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1047 -rm -f core Makefile Makefile.pre config.status \
1048 Modules/Setup Modules/Setup.local Modules/Setup.config
1049 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1050 -o -name '[@,#]*' -o -name '*.old' \
1051 -o -name '*.orig' -o -name '*.rej' \
1052 -o -name '*.bak' ')' \
1055 # Check for smelly exported symbols (not starting with Py/_Py)
1057 nm -p $(LIBRARY) | \
1058 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1060 # Find files with funny names
1062 find $(DISTDIRS) -type d \
1063 -o -name '*.[chs]' \
1073 -o -name '*,[vpt]' \
1075 -o -name 'Setup.*' \
1078 -o -name ChangeLog \
1079 -o -name Repository \
1085 -o -name .cvsignore \
1091 Python/thread.o: @THREADHEADERS@
1093 # Declare targets that aren't real files
1094 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1095 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1096 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1097 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1098 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1099 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1100 .PHONY: smelly funny
1102 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY