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 \
268 Python/structmember.o \
274 Python/$(DYNLOADFILE) \
279 ##########################################################################
283 Objects/boolobject.o \
284 Objects/bufferobject.o \
285 Objects/cellobject.o \
286 Objects/classobject.o \
288 Objects/codeobject.o \
289 Objects/complexobject.o \
290 Objects/descrobject.o \
291 Objects/enumobject.o \
292 Objects/exceptions.o \
293 Objects/genobject.o \
294 Objects/fileobject.o \
295 Objects/floatobject.o \
296 Objects/frameobject.o \
297 Objects/funcobject.o \
298 Objects/intobject.o \
299 Objects/iterobject.o \
300 Objects/listobject.o \
301 Objects/longobject.o \
302 Objects/dictobject.o \
303 Objects/methodobject.o \
304 Objects/moduleobject.o \
307 Objects/rangeobject.o \
308 Objects/setobject.o \
309 Objects/sliceobject.o \
310 Objects/stringobject.o \
311 Objects/structseq.o \
312 Objects/tupleobject.o \
313 Objects/typeobject.o \
314 Objects/weakrefobject.o \
318 ##########################################################################
319 # objects that get linked into the Python library
321 Modules/_typesmodule.o \
322 Modules/getbuildinfo.o \
330 #########################################################################
334 all: $(BUILDPYTHON) oldsharedmods sharedmods
336 # Build the interpreter
337 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
338 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
340 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
342 platform: $(BUILDPYTHON)
343 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
346 # Build the shared modules
347 sharedmods: $(BUILDPYTHON)
348 case $$MAKEFLAGS in \
349 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
350 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
353 # Build static library
354 # avoid long command lines, same as LIBRARY_OBJS
355 $(LIBRARY): $(LIBRARY_OBJS)
357 $(AR) cr $@ Modules/getbuildinfo.o
358 $(AR) cr $@ Modules/_typesmodule.o
359 $(AR) cr $@ $(PARSER_OBJS)
360 $(AR) cr $@ $(OBJECT_OBJS)
361 $(AR) cr $@ $(PYTHON_OBJS)
362 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
363 $(AR) cr $@ $(MODOBJS)
366 libpython$(VERSION).so: $(LIBRARY_OBJS)
367 if test $(INSTSONAME) != $(LDLIBRARY); then \
368 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
369 $(LN) -f $(INSTSONAME) $@; \
371 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
374 libpython$(VERSION).sl: $(LIBRARY_OBJS)
375 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
377 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
378 # minimal framework (not including the Lib directory and such) in the current
380 RESSRCDIR=$(srcdir)/Mac/Resources/framework
381 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
383 $(RESSRCDIR)/Info.plist \
384 $(RESSRCDIR)/version.plist \
385 $(RESSRCDIR)/English.lproj/InfoPlist.strings
386 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
387 if test "${UNIVERSALSDK}"; then \
388 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
389 -isysroot "${UNIVERSALSDK}" \
390 -all_load $(LIBRARY) -Wl,-single_module \
391 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
392 -compatibility_version $(VERSION) \
393 -current_version $(VERSION); \
395 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
398 $(INSTALL) -d -m $(DIRMODE) \
399 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
400 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
401 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
402 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
403 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
404 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
405 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
406 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
407 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
408 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
409 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
411 # This rule builds the Cygwin Python DLL and import library if configured
412 # for a shared core library; otherwise, this rule is a noop.
413 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
414 if test -n "$(DLLLIBRARY)"; then \
415 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
416 $(LIBS) $(MODLIBS) $(SYSLIBS); \
421 oldsharedmods: $(SHAREDMODS)
424 Makefile Modules/config.c: Makefile.pre \
425 $(srcdir)/Modules/config.c.in \
427 Modules/Setup.config \
430 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
432 Modules/Setup.config \
433 Modules/Setup.local \
436 @echo "The Makefile was updated, you may need to re-run make."
439 Modules/Setup: $(srcdir)/Modules/Setup.dist
440 @if test -f Modules/Setup; then \
441 echo "-----------------------------------------------"; \
442 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
443 echo "check to make sure you have all the updates you"; \
444 echo "need in your Modules/Setup file."; \
445 echo "Usually, copying Setup.dist to Setup will work."; \
446 echo "-----------------------------------------------"; \
449 ############################################################################
450 # Special rules for object files
452 Modules/getbuildinfo.o: $(PARSER_OBJS) \
458 $(srcdir)/Modules/getbuildinfo.c
459 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LANG=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
461 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
462 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
463 -DPREFIX='"$(prefix)"' \
464 -DEXEC_PREFIX='"$(exec_prefix)"' \
465 -DVERSION='"$(VERSION)"' \
466 -DVPATH='"$(VPATH)"' \
467 -o $@ $(srcdir)/Modules/getpath.c
469 Modules/python.o: $(srcdir)/Modules/python.c
470 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
473 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
474 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
477 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
479 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
480 $(srcdir)/Include/token.h \
481 $(srcdir)/Include/grammar.h
482 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
484 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
486 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
487 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
489 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
490 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
492 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
494 Python/getplatform.o: $(srcdir)/Python/getplatform.c
495 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
497 Python/importdl.o: $(srcdir)/Python/importdl.c
498 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
500 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
501 $(srcdir)/Objects/unicodetype_db.h
503 ############################################################################
508 Include/Python-ast.h \
511 Include/boolobject.h \
512 Include/bufferobject.h \
514 Include/classobject.h \
519 Include/complexobject.h \
520 Include/descrobject.h \
521 Include/dictobject.h \
522 Include/enumobject.h \
523 Include/genobject.h \
524 Include/fileobject.h \
525 Include/floatobject.h \
526 Include/funcobject.h \
528 Include/intobject.h \
529 Include/intrcheck.h \
530 Include/iterobject.h \
531 Include/listobject.h \
532 Include/longobject.h \
533 Include/methodobject.h \
534 Include/modsupport.h \
535 Include/moduleobject.h \
538 Include/patchlevel.h \
546 Include/pythonrun.h \
547 Include/rangeobject.h \
548 Include/setobject.h \
549 Include/sliceobject.h \
550 Include/stringobject.h \
551 Include/structseq.h \
552 Include/structmember.h \
554 Include/sysmodule.h \
555 Include/traceback.h \
556 Include/tupleobject.h \
557 Include/unicodeobject.h \
558 Include/weakrefobject.h \
561 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
564 ######################################################################
566 # Test the interpreter (twice, once without .pyc files, once with)
567 # In the past, we've had problems where bugs in the marshalling or
568 # elsewhere caused bytecode read from .pyc files to behave differently
569 # than bytecode generated directly from a .py source file. Sometimes
570 # the bytecode read from a .pyc file had the bug, somtimes the directly
571 # generated bytecode. This is sometimes a very shy bug needing a lot of
574 TESTOPTS= -l $(EXTRATESTOPTS)
575 TESTPROG= $(srcdir)/Lib/test/regrtest.py
576 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
578 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
579 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
580 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
582 testall: all platform
583 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
584 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
585 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
587 # Run the unitests for both architectures in a Universal build on OSX
588 # Must be run on an Intel box.
589 testuniversal: all platform
590 if [ `arch` != 'i386' ];then \
591 echo "This can only be used on OSX/i386" ;\
594 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
595 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
596 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
597 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
600 # Like testall, but with a single pass only
601 buildbottest: all platform
602 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
604 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
605 test_unicodedata test_re test_sre test_select test_poll \
606 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
607 quicktest: all platform
608 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
609 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
610 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
612 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
614 memtest: all platform
615 -rm -f $(srcdir)/Lib/test/*.py[co]
616 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
617 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
620 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
622 # Install almost everything without disturbing previous versions
623 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
624 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
626 # Install shared libraries enabled by Setup
627 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
629 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
630 @for i in X $(SHAREDMODS); do \
631 if test $$i != X; then \
632 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
633 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
638 @for i in $(DESTDIRS); \
640 if test ! -d $(DESTDIR)$$i; then \
641 echo "Creating directory $$i"; \
642 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
648 # Install the interpreter (by creating a hard link to python$(VERSION))
649 bininstall: altbininstall
650 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
651 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
654 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
655 (cd $(DESTDIR)$(BINDIR); $(LN) -sf python$(VERSION)-config python-config)
657 # Install the interpreter with $(VERSION) affixed
658 # This goes into $(exec_prefix)
659 altbininstall: $(BUILDPYTHON)
660 @for i in $(BINDIR) $(LIBDIR); \
662 if test ! -d $(DESTDIR)$$i; then \
663 echo "Creating directory $$i"; \
664 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
668 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
669 if test -f libpython$(VERSION)$(SO); then \
670 if test "$(SO)" = .dll; then \
671 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
673 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
674 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
675 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
681 # Install the manual page
683 @for i in $(MANDIR) $(MANDIR)/man1; \
685 if test ! -d $(DESTDIR)$$i; then \
686 echo "Creating directory $$i"; \
687 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
691 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
692 $(DESTDIR)$(MANDIR)/man1/python.1
694 # Install the library
695 PLATDIR= plat-$(MACHDEP)
696 EXTRAPLATDIR= @EXTRAPLATDIR@
697 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
698 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
699 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
700 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
701 plat-mac/lib-scriptpackages/_builtinSuites \
702 plat-mac/lib-scriptpackages/CodeWarrior \
703 plat-mac/lib-scriptpackages/Explorer \
704 plat-mac/lib-scriptpackages/Finder \
705 plat-mac/lib-scriptpackages/Netscape \
706 plat-mac/lib-scriptpackages/StdSuites \
707 plat-mac/lib-scriptpackages/SystemEvents \
708 plat-mac/lib-scriptpackages/Terminal
709 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
710 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
711 test/decimaltestdata \
712 encodings compiler hotshot \
713 email email/mime email/test email/test/data \
714 sqlite3 sqlite3/test \
715 logging bsddb bsddb/test csv wsgiref \
716 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
717 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
718 setuptools setuptools/command setuptools/tests setuptools.egg-info \
720 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
721 @for i in $(SCRIPTDIR) $(LIBDEST); \
723 if test ! -d $(DESTDIR)$$i; then \
724 echo "Creating directory $$i"; \
725 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
729 @for d in $(LIBSUBDIRS); \
731 a=$(srcdir)/Lib/$$d; \
732 if test ! -d $$a; then continue; else true; fi; \
734 if test ! -d $(DESTDIR)$$b; then \
735 echo "Creating directory $$b"; \
736 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
740 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
742 if test -x $$i; then \
743 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
744 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
746 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
747 echo $(INSTALL_DATA) $$i $(LIBDEST); \
750 @for d in $(LIBSUBDIRS); \
752 a=$(srcdir)/Lib/$$d; \
753 if test ! -d $$a; then continue; else true; fi; \
754 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
764 if test -d $$i; then continue; fi; \
765 if test -x $$i; then \
766 echo $(INSTALL_SCRIPT) $$i $$b; \
767 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
769 echo $(INSTALL_DATA) $$i $$b; \
770 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
775 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
776 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
777 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
779 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
780 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
781 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
783 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
784 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
785 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
786 -d $(LIBDEST)/site-packages -f \
787 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
788 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
789 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
790 -d $(LIBDEST)/site-packages -f \
791 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
793 # Create the PLATDIR source directory, if one wasn't distributed..
794 $(srcdir)/Lib/$(PLATDIR):
795 mkdir $(srcdir)/Lib/$(PLATDIR)
796 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
797 export PATH; PATH="`pwd`:$$PATH"; \
798 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
799 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
800 export EXE; EXE="$(BUILDEXE)"; \
801 cd $(srcdir)/Lib/$(PLATDIR); ./regen
803 # Install the include files
804 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
806 @for i in $(INCLDIRSTOMAKE); \
808 if test ! -d $(DESTDIR)$$i; then \
809 echo "Creating directory $$i"; \
810 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
814 @for i in $(srcdir)/Include/*.h; \
816 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
817 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
819 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
821 # Install the library and miscellaneous stuff needed for extending/embedding
822 # This goes into $(exec_prefix)
823 LIBPL= $(LIBP)/config
825 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
827 if test ! -d $(DESTDIR)$$i; then \
828 echo "Creating directory $$i"; \
829 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
833 @if test -d $(LIBRARY); then :; else \
834 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
835 if test "$(SO)" = .dll; then \
836 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
838 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
839 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
842 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
845 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
846 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
847 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
848 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
849 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
850 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
851 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
852 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
853 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
854 # Substitution happens here, as the completely-expanded BINDIR
855 # is not available in configure
856 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
857 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
859 @if [ -s Modules/python.exp -a \
860 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
861 echo; echo "Installing support files for building shared extension modules on AIX:"; \
862 $(INSTALL_DATA) Modules/python.exp \
863 $(DESTDIR)$(LIBPL)/python.exp; \
864 echo; echo "$(LIBPL)/python.exp"; \
865 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
866 $(DESTDIR)$(LIBPL)/makexp_aix; \
867 echo "$(LIBPL)/makexp_aix"; \
868 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
869 $(DESTDIR)$(LIBPL)/ld_so_aix; \
870 echo "$(LIBPL)/ld_so_aix"; \
871 echo; echo "See Misc/AIX-NOTES for details."; \
874 @case "$(MACHDEP)" in beos*) \
875 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
876 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
877 echo; echo "$(LIBPL)/README"; \
878 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
879 echo "$(LIBPL)/ar_beos"; \
880 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
881 echo "$(LIBPL)/ld_so_beos"; \
882 echo; echo "See Misc/BeOS-NOTES for details."; \
886 # Install the dynamically loadable modules
887 # This goes into $(exec_prefix)
889 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
891 --install-scripts=$(BINDIR) \
892 --install-platlib=$(DESTSHARED) \
895 # Here are a couple of targets for MacOSX again, to install a full
896 # framework-based Python. frameworkinstall installs everything, the
897 # subtargets install specific parts. Much of the actual work is offloaded to
898 # the Makefile in Mac
901 # This target is here for backward compatiblity, previous versions of Python
902 # hadn't integrated framework installation in the normal install process.
903 frameworkinstall: install
905 # On install, we re-make the framework
906 # structure in the install location, /Library/Frameworks/ or the argument to
907 # --enable-framework. If --enable-framework has been specified then we have
908 # automatically set prefix to the location deep down in the framework, so we
909 # only have to cater for the structural bits of the framework.
911 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
913 frameworkinstallstructure: $(LDLIBRARY)
914 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
915 echo Not configured with --enable-framework; \
919 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
920 if test ! -d $(DESTDIR)$$i; then \
921 echo "Creating directory $(DESTDIR)$$i"; \
922 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
926 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
927 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
928 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
929 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
930 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
931 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
932 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
933 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
934 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
935 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
937 # This installs Mac/Lib into the framework
938 # Install a number of symlinks to keep software that expects a normal unix
939 # install (which includes python-config) happy.
940 frameworkinstallmaclib:
941 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
942 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
944 # This installs the IDE, the Launcher and other apps into /Applications
945 frameworkinstallapps:
946 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
948 # This install the unix python and pythonw tools in /usr/local/bin
949 frameworkinstallunixtools:
950 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
952 frameworkaltinstallunixtools:
953 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
955 # This installs the Demos and Tools into the applications directory.
956 # It is not part of a normal frameworkinstall
957 frameworkinstallextras:
958 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
960 # This installs a few of the useful scripts in Tools/scripts
962 SRCDIR=$(srcdir) $(RUNSHARED) \
963 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
965 --install-scripts=$(BINDIR) \
968 # Build the toplevel Makefile
969 Makefile.pre: Makefile.pre.in config.status
970 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
971 $(MAKE) -f Makefile.pre Makefile
973 # Run the configure script.
974 config.status: $(srcdir)/configure
975 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
977 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
979 # Some make's put the object file in the current directory
981 $(CC) -c $(PY_CFLAGS) -o $@ $<
983 # Run reindent on the library
985 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
987 # Rerun configure with the same options as it was run last time,
988 # provided the config.status script exists
990 $(SHELL) config.status --recheck
991 $(SHELL) config.status
993 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
995 (cd $(srcdir); autoconf)
996 (cd $(srcdir); autoheader)
998 # Create a tags file for vi
1001 ctags -w -t Include/*.h; \
1002 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1006 # Create a tags file for GNU Emacs
1009 etags Include/*.h; \
1010 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1012 # Sanitation targets -- clean leaves libraries, executables and tags
1013 # files, which clobber removes those as well
1015 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1018 find . -name '*.o' -exec rm -f {} ';'
1019 find . -name '*.s[ol]' -exec rm -f {} ';'
1020 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1021 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1024 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1026 config.cache config.log pyconfig.h Modules/config.c
1027 -rm -rf build platform
1028 -rm -rf $(PYTHONFRAMEWORKDIR)
1030 # Make things extra clean, before making a distribution:
1031 # remove all generated files, even Makefile[.pre]
1032 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1034 -rm -f core Makefile Makefile.pre config.status \
1035 Modules/Setup Modules/Setup.local Modules/Setup.config
1036 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1037 -o -name '[@,#]*' -o -name '*.old' \
1038 -o -name '*.orig' -o -name '*.rej' \
1039 -o -name '*.bak' ')' \
1042 # Check for smelly exported symbols (not starting with Py/_Py)
1044 nm -p $(LIBRARY) | \
1045 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1047 # Find files with funny names
1049 find $(DISTDIRS) -type d \
1050 -o -name '*.[chs]' \
1060 -o -name '*,[vpt]' \
1062 -o -name 'Setup.*' \
1065 -o -name ChangeLog \
1066 -o -name Repository \
1072 -o -name .cvsignore \
1078 Python/thread.o: @THREADHEADERS@
1080 # Declare targets that aren't real files
1081 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1082 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1083 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1084 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1085 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1086 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1087 .PHONY: smelly funny
1089 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY