1 # Top-level Makefile for Python
3 # As distributed, this file is called Makefile.pre.in; it is processed
4 # into the real Makefile by running the script ./configure, which
5 # replaces things like @spam@ with values appropriate for your system.
6 # This means that if you edit Makefile, your changes get lost the next
7 # time you run the configure script. Ideally, you can do:
14 # If you have a previous version of Python installed that you don't
15 # want to overwrite, you can use "make altinstall" instead of "make
16 # install". Refer to the "Installing" section in the README file for
19 # See also the section "Build instructions" in the README file.
21 # === Variables set by makesetup ===
26 # === Variables set by configure
37 SVNVERSION= @SVNVERSION@
39 # Shell used by make (some versions default to the login shell, which is bad)
42 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
45 # Portable install script (configure doesn't always guess right)
47 INSTALL_PROGRAM=@INSTALL_PROGRAM@
48 INSTALL_SCRIPT= @INSTALL_SCRIPT@
49 INSTALL_DATA= @INSTALL_DATA@
50 # Shared libraries must be installed with executable mode on some systems;
51 # rather than figuring out exactly which, we always give them executable mode.
52 # Also, making them read-only seems to be a good idea...
53 INSTALL_SHARED= ${INSTALL} -m 555
55 MAKESETUP= $(srcdir)/Modules/makesetup
59 BASECFLAGS= @BASECFLAGS@
60 CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
61 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
62 # be able to build extension modules using the directories specified in the
63 # environment variables
64 CPPFLAGS= -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
69 LINKFORSHARED= @LINKFORSHARED@
70 # Extra C flags added for building the interpreter object files.
71 CFLAGSFORSHARED=@CFLAGSFORSHARED@
72 # C flags used for building the interpreter object files
73 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
76 # Machine-dependent subdirectories
79 # Install prefix for architecture-independent files
82 # Install prefix for architecture-dependent files
83 exec_prefix= @exec_prefix@
85 # Install prefix for data files
86 datarootdir= @datarootdir@
88 # Expanded directories
89 BINDIR= $(exec_prefix)/bin
90 LIBDIR= $(exec_prefix)/lib
92 INCLUDEDIR= @includedir@
93 CONFINCLUDEDIR= $(exec_prefix)/include
94 SCRIPTDIR= $(prefix)/lib
96 # Detailed destination directories
97 BINLIBDEST= $(LIBDIR)/python$(VERSION)
98 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
99 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
100 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
101 LIBP= $(LIBDIR)/python$(VERSION)
103 # Symbols used for using shared libraries
106 BLDSHARED= @BLDSHARED@
107 DESTSHARED= $(BINLIBDEST)/lib-dynload
109 # Executable suffix (.exe on Windows and Mac OS X)
111 BUILDEXE= @BUILDEXEEXT@
113 # Short name and location for Mac OS X Python framework
114 UNIVERSALSDK=@UNIVERSALSDK@
115 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
116 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
117 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
118 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
119 # Deployment target selected during configure, to be checked
120 # by distutils. The export statement is needed to ensure that the
121 # deployment target is active during build.
122 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
123 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
125 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
126 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
128 # Environment to run shared python without installed libraries
129 RUNSHARED= @RUNSHARED@
131 # Modes for directories, executables and data files created by the
132 # install process. Default to user-only-writable for all file types.
137 # configure script arguments
138 CONFIG_ARGS= @CONFIG_ARGS@
141 # Subdirectories with code
144 # Other subdirectories
145 SUBDIRSTOO= Include Lib Misc Demo
147 # Files and directories to be distributed
148 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
149 DISTFILES= README ChangeLog $(CONFIGFILES)
150 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
151 DIST= $(DISTFILES) $(DISTDIRS)
155 LDLIBRARY= @LDLIBRARY@
156 BLDLIBRARY= @BLDLIBRARY@
157 DLLLIBRARY= @DLLLIBRARY@
158 LDLIBRARYDIR= @LDLIBRARYDIR@
159 INSTSONAME= @INSTSONAME@
165 SYSLIBS= $(LIBM) $(LIBC)
168 THREADOBJ= @THREADOBJ@
169 DLINCLDIR= @DLINCLDIR@
170 DYNLOADFILE= @DYNLOADFILE@
171 MACHDEP_OBJS= @MACHDEP_OBJS@
174 UNICODE_OBJS= @UNICODE_OBJS@
177 BUILDPYTHON= python$(BUILDEXE)
179 # === Definitions added by makesetup ===
182 ##########################################################################
190 # Used of signalmodule.o is not available
191 SIGNAL_OBJS= @SIGNAL_OBJS@
194 ##########################################################################
196 GRAMMAR_H= $(srcdir)/Include/graminit.h
197 GRAMMAR_C= $(srcdir)/Python/graminit.c
198 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
201 ##########################################################################
203 PGEN= Parser/pgen$(EXE)
213 Parser/metagrammar.o \
218 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
222 Python/mysnprintf.o \
223 Parser/tokenizer_pgen.o \
224 Parser/printgrammar.o \
227 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
229 ##########################################################################
231 AST_H_DIR= $(srcdir)/Include
232 AST_H= $(AST_H_DIR)/Python-ast.h
233 AST_C_DIR= $(srcdir)/Python
234 AST_C= $(AST_C_DIR)/Python-ast.c
235 AST_ASDL= $(srcdir)/Parser/Python.asdl
237 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
238 # XXX Note that a build now requires Python exist before the build starts
239 ASDLGEN= $(srcdir)/Parser/asdl_c.py
241 ##########################################################################
244 Python/Python-ast.o \
247 Python/bltinmodule.o \
253 Python/frozenmain.o \
256 Python/getcompiler.o \
257 Python/getcopyright.o \
259 Python/getplatform.o \
260 Python/getversion.o \
265 Python/modsupport.o \
267 Python/mysnprintf.o \
273 Python/structmember.o \
280 Python/$(DYNLOADFILE) \
286 ##########################################################################
290 Objects/boolobject.o \
291 Objects/bufferobject.o \
292 Objects/cellobject.o \
293 Objects/classobject.o \
295 Objects/codeobject.o \
296 Objects/complexobject.o \
297 Objects/descrobject.o \
298 Objects/enumobject.o \
299 Objects/exceptions.o \
300 Objects/genobject.o \
301 Objects/fileobject.o \
302 Objects/floatobject.o \
303 Objects/frameobject.o \
304 Objects/funcobject.o \
305 Objects/intobject.o \
306 Objects/iterobject.o \
307 Objects/listobject.o \
308 Objects/longobject.o \
309 Objects/dictobject.o \
310 Objects/methodobject.o \
311 Objects/moduleobject.o \
314 Objects/rangeobject.o \
315 Objects/setobject.o \
316 Objects/sliceobject.o \
317 Objects/stringobject.o \
318 Objects/structseq.o \
319 Objects/tupleobject.o \
320 Objects/typeobject.o \
321 Objects/weakrefobject.o \
325 ##########################################################################
326 # objects that get linked into the Python library
328 Modules/_typesmodule.o \
329 Modules/getbuildinfo.o \
337 #########################################################################
342 build_all: $(BUILDPYTHON) oldsharedmods sharedmods
344 # Build the interpreter
345 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
346 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
348 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
350 platform: $(BUILDPYTHON)
351 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
354 # Build the shared modules
355 sharedmods: $(BUILDPYTHON)
356 @case $$MAKEFLAGS in \
357 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
358 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
361 # Build static library
362 # avoid long command lines, same as LIBRARY_OBJS
363 $(LIBRARY): $(LIBRARY_OBJS)
365 $(AR) cr $@ Modules/getbuildinfo.o
366 $(AR) cr $@ Modules/_typesmodule.o
367 $(AR) cr $@ $(PARSER_OBJS)
368 $(AR) cr $@ $(OBJECT_OBJS)
369 $(AR) cr $@ $(PYTHON_OBJS)
370 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
371 $(AR) cr $@ $(MODOBJS)
374 libpython$(VERSION).so: $(LIBRARY_OBJS)
375 if test $(INSTSONAME) != $(LDLIBRARY); then \
376 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
377 $(LN) -f $(INSTSONAME) $@; \
379 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
382 libpython$(VERSION).sl: $(LIBRARY_OBJS)
383 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
385 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
386 # minimal framework (not including the Lib directory and such) in the current
388 RESSRCDIR=$(srcdir)/Mac/Resources/framework
389 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
391 $(RESSRCDIR)/Info.plist \
392 $(RESSRCDIR)/version.plist \
393 $(RESSRCDIR)/English.lproj/InfoPlist.strings
394 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
395 if test "${UNIVERSALSDK}"; then \
396 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
397 -isysroot "${UNIVERSALSDK}" \
398 -all_load $(LIBRARY) -Wl,-single_module \
399 -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
400 -compatibility_version $(VERSION) \
401 -current_version $(VERSION); \
403 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
406 $(INSTALL) -d -m $(DIRMODE) \
407 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
408 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
409 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
410 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
411 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
412 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
413 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
414 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
415 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
416 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
417 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
419 # This rule builds the Cygwin Python DLL and import library if configured
420 # for a shared core library; otherwise, this rule is a noop.
421 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
422 if test -n "$(DLLLIBRARY)"; then \
423 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
424 $(LIBS) $(MODLIBS) $(SYSLIBS); \
429 oldsharedmods: $(SHAREDMODS)
432 Makefile Modules/config.c: Makefile.pre \
433 $(srcdir)/Modules/config.c.in \
435 Modules/Setup.config \
438 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
440 Modules/Setup.config \
441 Modules/Setup.local \
444 @echo "The Makefile was updated, you may need to re-run make."
447 Modules/Setup: $(srcdir)/Modules/Setup.dist
448 @if test -f Modules/Setup; then \
449 echo "-----------------------------------------------"; \
450 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
451 echo "check to make sure you have all the updates you"; \
452 echo "need in your Modules/Setup file."; \
453 echo "Usually, copying Setup.dist to Setup will work."; \
454 echo "-----------------------------------------------"; \
457 ############################################################################
458 # Special rules for object files
460 Modules/getbuildinfo.o: $(PARSER_OBJS) \
466 $(srcdir)/Modules/getbuildinfo.c
467 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
469 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
470 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
471 -DPREFIX='"$(prefix)"' \
472 -DEXEC_PREFIX='"$(exec_prefix)"' \
473 -DVERSION='"$(VERSION)"' \
474 -DVPATH='"$(VPATH)"' \
475 -o $@ $(srcdir)/Modules/getpath.c
477 Modules/python.o: $(srcdir)/Modules/python.c
478 $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
481 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
482 -@$(INSTALL) -d Include
483 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
486 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
488 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
489 $(srcdir)/Include/token.h \
490 $(srcdir)/Include/grammar.h
491 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
493 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
495 Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
497 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
498 $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
500 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
501 $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
503 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
505 Python/getplatform.o: $(srcdir)/Python/getplatform.c
506 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
508 Python/importdl.o: $(srcdir)/Python/importdl.c
509 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
511 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
512 $(srcdir)/Objects/unicodetype_db.h
514 ############################################################################
519 Include/Python-ast.h \
522 Include/boolobject.h \
523 Include/bufferobject.h \
525 Include/classobject.h \
530 Include/complexobject.h \
531 Include/descrobject.h \
532 Include/dictobject.h \
533 Include/enumobject.h \
534 Include/genobject.h \
535 Include/fileobject.h \
536 Include/floatobject.h \
537 Include/funcobject.h \
539 Include/intobject.h \
540 Include/intrcheck.h \
541 Include/iterobject.h \
542 Include/listobject.h \
543 Include/longobject.h \
544 Include/methodobject.h \
545 Include/modsupport.h \
546 Include/moduleobject.h \
550 Include/patchlevel.h \
560 Include/pythonrun.h \
561 Include/rangeobject.h \
562 Include/setobject.h \
563 Include/sliceobject.h \
564 Include/stringobject.h \
565 Include/structseq.h \
566 Include/structmember.h \
568 Include/sysmodule.h \
569 Include/traceback.h \
570 Include/tupleobject.h \
571 Include/unicodeobject.h \
572 Include/weakrefobject.h \
575 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
578 ######################################################################
580 # Test the interpreter (twice, once without .pyc files, once with)
581 # In the past, we've had problems where bugs in the marshalling or
582 # elsewhere caused bytecode read from .pyc files to behave differently
583 # than bytecode generated directly from a .py source file. Sometimes
584 # the bytecode read from a .pyc file had the bug, somtimes the directly
585 # generated bytecode. This is sometimes a very shy bug needing a lot of
588 TESTOPTS= -l $(EXTRATESTOPTS)
589 TESTPROG= $(srcdir)/Lib/test/regrtest.py
590 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
592 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
593 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
594 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
596 testall: all platform
597 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
598 $(TESTPYTHON) Lib/compileall.py
599 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
600 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
601 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
603 # Run the unitests for both architectures in a Universal build on OSX
604 # Must be run on an Intel box.
605 testuniversal: all platform
606 if [ `arch` != 'i386' ];then \
607 echo "This can only be used on OSX/i386" ;\
610 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
611 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
612 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
613 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
616 # Like testall, but with a single pass only
617 # run an optional script to include some information about the build environment
618 buildbottest: all platform
619 -@if which pybuildbot.identify >/dev/null 2>&1; then \
620 pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
622 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
624 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
625 test_unicodedata test_re test_sre test_select test_poll \
626 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
627 quicktest: all platform
628 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
629 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
630 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
632 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
634 memtest: all platform
635 -rm -f $(srcdir)/Lib/test/*.py[co]
636 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
637 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
640 install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
642 # Install almost everything without disturbing previous versions
643 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
644 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
646 # Install shared libraries enabled by Setup
647 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
649 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
650 @for i in X $(SHAREDMODS); do \
651 if test $$i != X; then \
652 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
653 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
658 @for i in $(DESTDIRS); \
660 if test ! -d $(DESTDIR)$$i; then \
661 echo "Creating directory $$i"; \
662 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
668 # Install the interpreter (by creating a hard link to python$(VERSION))
669 bininstall: altbininstall
670 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
671 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
674 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
675 -rm -f $(DESTDIR)$(BINDIR)/python-config
676 (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
678 # Install the interpreter with $(VERSION) affixed
679 # This goes into $(exec_prefix)
680 altbininstall: $(BUILDPYTHON)
681 @for i in $(BINDIR) $(LIBDIR); \
683 if test ! -d $(DESTDIR)$$i; then \
684 echo "Creating directory $$i"; \
685 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
689 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
690 if test -f libpython$(VERSION)$(SO); then \
691 if test "$(SO)" = .dll; then \
692 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
694 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
695 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
696 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
702 # Install the manual page
704 @for i in $(MANDIR) $(MANDIR)/man1; \
706 if test ! -d $(DESTDIR)$$i; then \
707 echo "Creating directory $$i"; \
708 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
712 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
713 $(DESTDIR)$(MANDIR)/man1/python.1
715 # Install the library
716 PLATDIR= plat-$(MACHDEP)
717 EXTRAPLATDIR= @EXTRAPLATDIR@
718 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
719 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
720 XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
721 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
722 plat-mac/lib-scriptpackages/_builtinSuites \
723 plat-mac/lib-scriptpackages/CodeWarrior \
724 plat-mac/lib-scriptpackages/Explorer \
725 plat-mac/lib-scriptpackages/Finder \
726 plat-mac/lib-scriptpackages/Netscape \
727 plat-mac/lib-scriptpackages/StdSuites \
728 plat-mac/lib-scriptpackages/SystemEvents \
729 plat-mac/lib-scriptpackages/Terminal
730 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
731 LIBSUBDIRS= lib-tk site-packages test test/output test/data \
732 test/decimaltestdata \
733 encodings compiler hotshot \
734 email email/mime email/test email/test/data \
735 sqlite3 sqlite3/test \
736 logging bsddb bsddb/test csv wsgiref \
737 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
738 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
739 setuptools setuptools/command setuptools/tests setuptools.egg-info \
741 libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
742 @for i in $(SCRIPTDIR) $(LIBDEST); \
744 if test ! -d $(DESTDIR)$$i; then \
745 echo "Creating directory $$i"; \
746 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
750 @for d in $(LIBSUBDIRS); \
752 a=$(srcdir)/Lib/$$d; \
753 if test ! -d $$a; then continue; else true; fi; \
755 if test ! -d $(DESTDIR)$$b; then \
756 echo "Creating directory $$b"; \
757 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
761 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
763 if test -x $$i; then \
764 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
765 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
767 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
768 echo $(INSTALL_DATA) $$i $(LIBDEST); \
771 @for d in $(LIBSUBDIRS); \
773 a=$(srcdir)/Lib/$$d; \
774 if test ! -d $$a; then continue; else true; fi; \
775 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
785 if test -d $$i; then continue; fi; \
786 if test -x $$i; then \
787 echo $(INSTALL_SCRIPT) $$i $$b; \
788 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
790 echo $(INSTALL_DATA) $$i $$b; \
791 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
796 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
797 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
798 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
800 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
801 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
802 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
804 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
805 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
806 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
807 -d $(LIBDEST)/site-packages -f \
808 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
809 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
810 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
811 -d $(LIBDEST)/site-packages -f \
812 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
814 # Create the PLATDIR source directory, if one wasn't distributed..
815 $(srcdir)/Lib/$(PLATDIR):
816 mkdir $(srcdir)/Lib/$(PLATDIR)
817 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
818 export PATH; PATH="`pwd`:$$PATH"; \
819 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
820 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
821 export EXE; EXE="$(BUILDEXE)"; \
822 cd $(srcdir)/Lib/$(PLATDIR); ./regen
824 # Install the include files
825 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
827 @for i in $(INCLDIRSTOMAKE); \
829 if test ! -d $(DESTDIR)$$i; then \
830 echo "Creating directory $$i"; \
831 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
835 @for i in $(srcdir)/Include/*.h; \
837 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
838 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
840 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
842 # Install the library and miscellaneous stuff needed for extending/embedding
843 # This goes into $(exec_prefix)
844 LIBPL= $(LIBP)/config
846 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
848 if test ! -d $(DESTDIR)$$i; then \
849 echo "Creating directory $$i"; \
850 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
854 @if test -d $(LIBRARY); then :; else \
855 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
856 if test "$(SO)" = .dll; then \
857 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
859 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
860 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
863 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
866 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
867 $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
868 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
869 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
870 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
871 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
872 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
873 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
874 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
875 # Substitution happens here, as the completely-expanded BINDIR
876 # is not available in configure
877 sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
878 $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
880 @if [ -s Modules/python.exp -a \
881 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
882 echo; echo "Installing support files for building shared extension modules on AIX:"; \
883 $(INSTALL_DATA) Modules/python.exp \
884 $(DESTDIR)$(LIBPL)/python.exp; \
885 echo; echo "$(LIBPL)/python.exp"; \
886 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
887 $(DESTDIR)$(LIBPL)/makexp_aix; \
888 echo "$(LIBPL)/makexp_aix"; \
889 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
890 $(DESTDIR)$(LIBPL)/ld_so_aix; \
891 echo "$(LIBPL)/ld_so_aix"; \
892 echo; echo "See Misc/AIX-NOTES for details."; \
895 @case "$(MACHDEP)" in beos*) \
896 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
897 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
898 echo; echo "$(LIBPL)/README"; \
899 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
900 echo "$(LIBPL)/ar_beos"; \
901 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
902 echo "$(LIBPL)/ld_so_beos"; \
903 echo; echo "See Misc/BeOS-NOTES for details."; \
907 # Install the dynamically loadable modules
908 # This goes into $(exec_prefix)
910 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
912 --install-scripts=$(BINDIR) \
913 --install-platlib=$(DESTSHARED) \
916 # Here are a couple of targets for MacOSX again, to install a full
917 # framework-based Python. frameworkinstall installs everything, the
918 # subtargets install specific parts. Much of the actual work is offloaded to
919 # the Makefile in Mac
922 # This target is here for backward compatiblity, previous versions of Python
923 # hadn't integrated framework installation in the normal install process.
924 frameworkinstall: install
926 # On install, we re-make the framework
927 # structure in the install location, /Library/Frameworks/ or the argument to
928 # --enable-framework. If --enable-framework has been specified then we have
929 # automatically set prefix to the location deep down in the framework, so we
930 # only have to cater for the structural bits of the framework.
932 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
934 frameworkinstallstructure: $(LDLIBRARY)
935 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
936 echo Not configured with --enable-framework; \
940 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
941 if test ! -d $(DESTDIR)$$i; then \
942 echo "Creating directory $(DESTDIR)$$i"; \
943 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
947 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
948 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
949 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
950 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
951 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
952 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
953 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
954 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
955 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
956 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
958 # This installs Mac/Lib into the framework
959 # Install a number of symlinks to keep software that expects a normal unix
960 # install (which includes python-config) happy.
961 frameworkinstallmaclib:
962 ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
963 cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
965 # This installs the IDE, the Launcher and other apps into /Applications
966 frameworkinstallapps:
967 cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
969 # This install the unix python and pythonw tools in /usr/local/bin
970 frameworkinstallunixtools:
971 cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
973 frameworkaltinstallunixtools:
974 cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
976 # This installs the Demos and Tools into the applications directory.
977 # It is not part of a normal frameworkinstall
978 frameworkinstallextras:
979 cd Mac && Make installextras DESTDIR="$(DESTDIR)"
981 # This installs a few of the useful scripts in Tools/scripts
983 SRCDIR=$(srcdir) $(RUNSHARED) \
984 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
986 --install-scripts=$(BINDIR) \
989 # Build the toplevel Makefile
990 Makefile.pre: Makefile.pre.in config.status
991 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
992 $(MAKE) -f Makefile.pre Makefile
994 # Run the configure script.
995 config.status: $(srcdir)/configure
996 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
998 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1000 # Some make's put the object file in the current directory
1002 $(CC) -c $(PY_CFLAGS) -o $@ $<
1004 # Run reindent on the library
1006 ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1008 # Rerun configure with the same options as it was run last time,
1009 # provided the config.status script exists
1011 $(SHELL) config.status --recheck
1012 $(SHELL) config.status
1014 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1016 (cd $(srcdir); autoconf)
1017 (cd $(srcdir); autoheader)
1019 # Create a tags file for vi
1022 ctags -w -t Include/*.h; \
1023 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1027 # Create a tags file for GNU Emacs
1030 etags Include/*.h; \
1031 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1033 # Sanitation targets -- clean leaves libraries, executables and tags
1034 # files, which clobber removes those as well
1036 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1039 find . -name '*.o' -exec rm -f {} ';'
1040 find . -name '*.s[ol]' -exec rm -f {} ';'
1041 find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1042 find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1045 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1047 config.cache config.log pyconfig.h Modules/config.c
1048 -rm -rf build platform
1049 -rm -rf $(PYTHONFRAMEWORKDIR)
1051 # Make things extra clean, before making a distribution:
1052 # remove all generated files, even Makefile[.pre]
1053 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1055 -rm -f core Makefile Makefile.pre config.status \
1056 Modules/Setup Modules/Setup.local Modules/Setup.config
1057 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1058 -o -name '[@,#]*' -o -name '*.old' \
1059 -o -name '*.orig' -o -name '*.rej' \
1060 -o -name '*.bak' ')' \
1063 # Check for smelly exported symbols (not starting with Py/_Py)
1065 nm -p $(LIBRARY) | \
1066 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1068 # Find files with funny names
1070 find $(DISTDIRS) -type d \
1071 -o -name '*.[chs]' \
1081 -o -name '*,[vpt]' \
1083 -o -name 'Setup.*' \
1086 -o -name ChangeLog \
1087 -o -name Repository \
1093 -o -name .cvsignore \
1099 Python/thread.o: @THREADHEADERS@
1101 # Declare targets that aren't real files
1102 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1103 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1104 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1105 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1106 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1107 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1108 .PHONY: smelly funny
1110 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY