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
36 SVNVERSION= @SVNVERSION@
38 # Shell used by make (some versions default to the login shell, which is bad)
41 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
44 # Portable install script (configure doesn't always guess right)
46 INSTALL_PROGRAM=@INSTALL_PROGRAM@
47 INSTALL_SCRIPT= @INSTALL_SCRIPT@
48 INSTALL_DATA= @INSTALL_DATA@
49 # Shared libraries must be installed with executable mode on some systems;
50 # rather than figuring out exactly which, we always give them executable mode.
51 # Also, making them read-only seems to be a good idea...
52 INSTALL_SHARED= ${INSTALL} -m 555
54 MAKESETUP= $(srcdir)/Modules/makesetup
58 BASECFLAGS= @BASECFLAGS@
59 CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
60 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
61 # be able to build extension modules using the directories specified in the
62 # environment variables
63 CPPFLAGS= -I. -I$(srcdir)/Include @CPPFLAGS@
68 LINKFORSHARED= @LINKFORSHARED@
69 # Extra C flags added for building the interpreter object files.
70 CFLAGSFORSHARED=@CFLAGSFORSHARED@
71 # C flags used for building the interpreter object files
72 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
75 # Machine-dependent subdirectories
78 # Install prefix for architecture-independent files
81 # Install prefix for architecture-dependent files
82 exec_prefix= @exec_prefix@
84 # Expanded directories
85 BINDIR= $(exec_prefix)/bin
86 LIBDIR= $(exec_prefix)/lib
88 INCLUDEDIR= @includedir@
89 CONFINCLUDEDIR= $(exec_prefix)/include
90 SCRIPTDIR= $(prefix)/lib
92 # Detailed destination directories
93 BINLIBDEST= $(LIBDIR)/python$(VERSION)
94 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
95 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
96 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
97 LIBP= $(LIBDIR)/python$(VERSION)
99 # Symbols used for using shared libraries
102 BLDSHARED= @BLDSHARED@
103 DESTSHARED= $(BINLIBDEST)/lib-dynload
105 # Executable suffix (.exe on Windows and Mac OS X)
107 BUILDEXE= @BUILDEXEEXT@
109 # Short name and location for Mac OS X Python framework
110 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
111 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
112 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
113 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
114 # Deployment target selected during configure, to be checked
116 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
117 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
118 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
120 # Environment to run shared python without installed libraries
121 RUNSHARED= @RUNSHARED@
123 # Modes for directories, executables and data files created by the
124 # install process. Default to user-only-writable for all file types.
129 # configure script arguments
130 CONFIG_ARGS= @CONFIG_ARGS@
133 # Subdirectories with code
136 # Other subdirectories
137 SUBDIRSTOO= Include Lib Misc Demo
139 # Files and directories to be distributed
140 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
141 DISTFILES= README ChangeLog $(CONFIGFILES)
142 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
143 DIST= $(DISTFILES) $(DISTDIRS)
147 LDLIBRARY= @LDLIBRARY@
148 BLDLIBRARY= @BLDLIBRARY@
149 DLLLIBRARY= @DLLLIBRARY@
150 LDLIBRARYDIR= @LDLIBRARYDIR@
151 INSTSONAME= @INSTSONAME@
157 SYSLIBS= $(LIBM) $(LIBC)
161 THREADOBJ= @THREADOBJ@
162 DLINCLDIR= @DLINCLDIR@
163 DYNLOADFILE= @DYNLOADFILE@
164 MACHDEP_OBJS= @MACHDEP_OBJS@
165 UNICODE_OBJS= @UNICODE_OBJS@
168 BUILDPYTHON= python$(BUILDEXE)
170 # === Definitions added by makesetup ===
173 ##########################################################################
181 # Used of signalmodule.o is not available
182 SIGNAL_OBJS= @SIGNAL_OBJS@
185 ##########################################################################
187 GRAMMAR_H= $(srcdir)/Include/graminit.h
188 GRAMMAR_C= $(srcdir)/Python/graminit.c
189 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
192 ##########################################################################
194 PGEN= Parser/pgen$(EXE)
204 Parser/metagrammar.o \
209 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
213 Python/mysnprintf.o \
214 Parser/tokenizer_pgen.o \
215 Parser/printgrammar.o \
218 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
220 ##########################################################################
222 AST_H= $(srcdir)/Include/Python-ast.h
223 AST_C= $(srcdir)/Python/Python-ast.c
224 AST_ASDL= $(srcdir)/Parser/Python.asdl
226 ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
227 # XXX Note that a build now requires Python exist before the build starts
228 ASDLGEN= $(srcdir)/Parser/asdl_c.py -h $(srcdir)/Include -c $(srcdir)/Python
230 ##########################################################################
233 Python/Python-ast.o \
236 Python/bltinmodule.o \
237 Python/exceptions.o \
243 Python/frozenmain.o \
246 Python/getcompiler.o \
247 Python/getcopyright.o \
249 Python/getplatform.o \
250 Python/getversion.o \
255 Python/modsupport.o \
257 Python/mysnprintf.o \
262 Python/structmember.o \
268 Python/$(DYNLOADFILE) \
273 ##########################################################################
277 Objects/boolobject.o \
278 Objects/bufferobject.o \
279 Objects/cellobject.o \
280 Objects/classobject.o \
282 Objects/codeobject.o \
283 Objects/complexobject.o \
284 Objects/descrobject.o \
285 Objects/enumobject.o \
286 Objects/genobject.o \
287 Objects/fileobject.o \
288 Objects/floatobject.o \
289 Objects/frameobject.o \
290 Objects/funcobject.o \
291 Objects/intobject.o \
292 Objects/iterobject.o \
293 Objects/listobject.o \
294 Objects/longobject.o \
295 Objects/dictobject.o \
296 Objects/methodobject.o \
297 Objects/moduleobject.o \
300 Objects/rangeobject.o \
301 Objects/setobject.o \
302 Objects/sliceobject.o \
303 Objects/stringobject.o \
304 Objects/structseq.o \
305 Objects/tupleobject.o \
306 Objects/typeobject.o \
307 Objects/weakrefobject.o \
311 ##########################################################################
312 # objects that get linked into the Python library
314 Modules/getbuildinfo.o \
322 #########################################################################
326 all: $(BUILDPYTHON) oldsharedmods sharedmods
328 # Build the interpreter
329 $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
330 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
332 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
334 platform: $(BUILDPYTHON)
335 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
338 # Build the shared modules
339 sharedmods: $(BUILDPYTHON)
340 case $$MAKEFLAGS in \
341 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
342 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
345 # Build static library
346 # avoid long command lines, same as LIBRARY_OBJS
347 $(LIBRARY): $(LIBRARY_OBJS)
349 $(AR) cr $@ Modules/getbuildinfo.o
350 $(AR) cr $@ $(PARSER_OBJS)
351 $(AR) cr $@ $(OBJECT_OBJS)
352 $(AR) cr $@ $(PYTHON_OBJS)
353 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
354 $(AR) cr $@ $(MODOBJS)
357 libpython$(VERSION).so: $(LIBRARY_OBJS)
358 if test $(INSTSONAME) != $(LDLIBRARY); then \
359 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
360 $(LN) -f $(INSTSONAME) $@; \
362 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
365 libpython$(VERSION).sl: $(LIBRARY_OBJS)
366 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
368 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
369 # minimal framework (not including the Lib directory and such) in the current
371 RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
372 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
374 $(RESSRCDIR)/Info.plist \
375 $(RESSRCDIR)/version.plist \
376 $(RESSRCDIR)/English.lproj/InfoPlist.strings
377 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
378 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
380 $(INSTALL) -d -m $(DIRMODE) \
381 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
382 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
383 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
384 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
385 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
386 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
387 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
388 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
389 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
390 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
391 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
393 # This rule builds the Cygwin Python DLL and import library if configured
394 # for a shared core library; otherwise, this rule is a noop.
395 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
396 if test -n "$(DLLLIBRARY)"; then \
397 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
398 $(LIBS) $(MODLIBS) $(SYSLIBS); \
403 oldsharedmods: $(SHAREDMODS)
406 Makefile Modules/config.c: Makefile.pre \
407 $(srcdir)/Modules/config.c.in \
409 Modules/Setup.config \
412 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
414 Modules/Setup.config \
415 Modules/Setup.local \
418 @echo "The Makefile was updated, you may need to re-run make."
421 Modules/Setup: $(srcdir)/Modules/Setup.dist
422 @if test -f Modules/Setup; then \
423 echo "-----------------------------------------------"; \
424 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
425 echo "check to make sure you have all the updates you"; \
426 echo "need in your Modules/Setup file."; \
427 echo "Usually, copying Setup.dist to Setup will work."; \
428 echo "-----------------------------------------------"; \
431 ############################################################################
432 # Special rules for object files
434 Modules/getbuildinfo.o: $(PARSER_OBJS) \
440 $(srcdir)/Modules/getbuildinfo.c
441 $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LANG=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
443 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
444 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
445 -DPREFIX='"$(prefix)"' \
446 -DEXEC_PREFIX='"$(exec_prefix)"' \
447 -DVERSION='"$(VERSION)"' \
448 -DVPATH='"$(VPATH)"' \
449 -o $@ $(srcdir)/Modules/getpath.c
451 Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
452 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
455 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
456 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
459 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
461 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
462 $(srcdir)/Include/token.h \
463 $(srcdir)/Include/grammar.h
464 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
466 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
468 $(AST_H) $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
469 $(ASDLGEN) $(AST_ASDL)
471 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
473 Python/getplatform.o: $(srcdir)/Python/getplatform.c
474 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
476 Python/importdl.o: $(srcdir)/Python/importdl.c
477 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
479 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
480 $(srcdir)/Objects/unicodetype_db.h
482 ############################################################################
487 Include/Python-ast.h \
490 Include/boolobject.h \
491 Include/bufferobject.h \
493 Include/classobject.h \
498 Include/complexobject.h \
499 Include/descrobject.h \
500 Include/dictobject.h \
501 Include/enumobject.h \
502 Include/genobject.h \
503 Include/fileobject.h \
504 Include/floatobject.h \
505 Include/funcobject.h \
507 Include/intobject.h \
508 Include/intrcheck.h \
509 Include/iterobject.h \
510 Include/listobject.h \
511 Include/longobject.h \
512 Include/methodobject.h \
513 Include/modsupport.h \
514 Include/moduleobject.h \
517 Include/patchlevel.h \
525 Include/pythonrun.h \
526 Include/rangeobject.h \
527 Include/setobject.h \
528 Include/sliceobject.h \
529 Include/stringobject.h \
530 Include/structseq.h \
531 Include/structmember.h \
533 Include/sysmodule.h \
534 Include/traceback.h \
535 Include/tupleobject.h \
536 Include/unicodeobject.h \
537 Include/weakrefobject.h \
540 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
543 ######################################################################
545 # Test the interpreter (twice, once without .pyc files, once with)
546 # In the past, we've had problems where bugs in the marshalling or
547 # elsewhere caused bytecode read from .pyc files to behave differently
548 # than bytecode generated directly from a .py source file. Sometimes
549 # the bytecode read from a .pyc file had the bug, somtimes the directly
550 # generated bytecode. This is sometimes a very shy bug needing a lot of
554 TESTPROG= $(srcdir)/Lib/test/regrtest.py
555 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
557 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
558 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
559 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
561 testall: all platform
562 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
563 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
564 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
566 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
567 test_unicodedata test_re test_sre test_select test_poll \
568 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
569 quicktest: all platform
570 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
571 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
572 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
574 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
576 memtest: all platform
577 -rm -f $(srcdir)/Lib/test/*.py[co]
578 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
579 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
582 install: altinstall bininstall maninstall
584 # Install almost everything without disturbing previous versions
585 altinstall: altbininstall libinstall inclinstall libainstall \
586 sharedinstall oldsharedinstall
588 # Install shared libraries enabled by Setup
589 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
591 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
592 @for i in X $(SHAREDMODS); do \
593 if test $$i != X; then \
594 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
595 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
600 @for i in $(DESTDIRS); \
602 if test ! -d $(DESTDIR)$$i; then \
603 echo "Creating directory $$i"; \
604 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
610 # Install the interpreter (by creating a hard link to python$(VERSION))
611 bininstall: altbininstall
612 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
613 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
616 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
618 # Install the interpreter with $(VERSION) affixed
619 # This goes into $(exec_prefix)
620 altbininstall: $(BUILDPYTHON)
621 @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \
622 if test ! -f $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
623 echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \
627 @for i in $(BINDIR) $(LIBDIR); \
629 if test ! -d $(DESTDIR)$$i; then \
630 echo "Creating directory $$i"; \
631 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
635 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
636 if test -f libpython$(VERSION)$(SO); then \
637 if test "$(SO)" = .dll; then \
638 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
640 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
641 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
642 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
648 # Install the manual page
650 @for i in $(MANDIR) $(MANDIR)/man1; \
652 if test ! -d $(DESTDIR)$$i; then \
653 echo "Creating directory $$i"; \
654 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
658 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
659 $(DESTDIR)$(MANDIR)/man1/python.1
661 # Install the library
662 PLATDIR= plat-$(MACHDEP)
663 EXTRAPLATDIR= @EXTRAPLATDIR@
664 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
665 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
666 XMLLIBSUBDIRS= xmlcore xmlcore/dom xmlcore/etree xmlcore/parsers xmlcore/sax
667 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
668 plat-mac/lib-scriptpackages/_builtinSuites \
669 plat-mac/lib-scriptpackages/CodeWarrior \
670 plat-mac/lib-scriptpackages/Explorer \
671 plat-mac/lib-scriptpackages/Finder \
672 plat-mac/lib-scriptpackages/Netscape \
673 plat-mac/lib-scriptpackages/StdSuites \
674 plat-mac/lib-scriptpackages/SystemEvents \
675 plat-mac/lib-scriptpackages/Terminal
676 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
677 LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \
678 test/decimaltestdata \
679 encodings email email/test email/test/data compiler hotshot \
680 logging bsddb bsddb/test csv idlelib idlelib/Icons \
681 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
683 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
684 @for i in $(SCRIPTDIR) $(LIBDEST); \
686 if test ! -d $(DESTDIR)$$i; then \
687 echo "Creating directory $$i"; \
688 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
692 @for d in $(LIBSUBDIRS); \
694 a=$(srcdir)/Lib/$$d; \
695 if test ! -d $$a; then continue; else true; fi; \
697 if test ! -d $(DESTDIR)$$b; then \
698 echo "Creating directory $$b"; \
699 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
703 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
705 if test -x $$i; then \
706 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
707 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
709 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
710 echo $(INSTALL_DATA) $$i $(LIBDEST); \
713 @for d in $(LIBSUBDIRS); \
715 a=$(srcdir)/Lib/$$d; \
716 if test ! -d $$a; then continue; else true; fi; \
726 if test -d $$i; then continue; fi; \
727 if test -x $$i; then \
728 echo $(INSTALL_SCRIPT) $$i $$b; \
729 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
731 echo $(INSTALL_DATA) $$i $$b; \
732 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
737 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
738 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
739 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
741 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
742 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
743 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
745 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
746 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
747 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
748 -d $(LIBDEST)/site-packages -f \
749 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
750 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
751 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
752 -d $(LIBDEST)/site-packages -f \
753 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
755 # Create the PLATDIR source directory, if one wasn't distributed..
756 $(srcdir)/Lib/$(PLATDIR):
757 mkdir $(srcdir)/Lib/$(PLATDIR)
758 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
759 export PATH; PATH="`pwd`:$$PATH"; \
760 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
761 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
762 export EXE; EXE="$(BUILDEXE)"; \
763 cd $(srcdir)/Lib/$(PLATDIR); ./regen
765 # Install the include files
766 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
768 @for i in $(INCLDIRSTOMAKE); \
770 if test ! -d $(DESTDIR)$$i; then \
771 echo "Creating directory $$i"; \
772 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
776 @for i in $(srcdir)/Include/*.h; \
778 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
779 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
781 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
783 # Install the library and miscellaneous stuff needed for extending/embedding
784 # This goes into $(exec_prefix)
785 LIBPL= $(LIBP)/config
787 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
789 if test ! -d $(DESTDIR)$$i; then \
790 echo "Creating directory $$i"; \
791 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
795 @if test -d $(LIBRARY); then :; else \
796 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
797 if test "$(SO)" = .dll; then \
798 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
800 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
801 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
804 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
807 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
808 $(INSTALL_DATA) Modules/$(MAINOBJ) $(DESTDIR)$(LIBPL)/$(MAINOBJ)
809 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
810 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
811 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
812 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
813 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
814 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
815 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
816 @if [ -s Modules/python.exp -a \
817 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
818 echo; echo "Installing support files for building shared extension modules on AIX:"; \
819 $(INSTALL_DATA) Modules/python.exp \
820 $(DESTDIR)$(LIBPL)/python.exp; \
821 echo; echo "$(LIBPL)/python.exp"; \
822 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
823 $(DESTDIR)$(LIBPL)/makexp_aix; \
824 echo "$(LIBPL)/makexp_aix"; \
825 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
826 $(DESTDIR)$(LIBPL)/ld_so_aix; \
827 echo "$(LIBPL)/ld_so_aix"; \
828 echo; echo "See Misc/AIX-NOTES for details."; \
831 @case "$(MACHDEP)" in beos*) \
832 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
833 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
834 echo; echo "$(LIBPL)/README"; \
835 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
836 echo "$(LIBPL)/ar_beos"; \
837 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
838 echo "$(LIBPL)/ld_so_beos"; \
839 echo; echo "See Misc/BeOS-NOTES for details."; \
843 # Install the dynamically loadable modules
844 # This goes into $(exec_prefix)
846 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
848 --install-scripts=$(BINDIR) \
849 --install-platlib=$(DESTSHARED) \
852 # Here are a couple of targets for MacOSX again, to install a full
853 # framework-based Python. frameworkinstall installs everything, the
854 # subtargets install specific parts. Much of the actual work is offloaded to
855 # the Makefile in Mac/OSX
857 frameworkinstall: frameworkinstallframework \
858 frameworkinstallapps frameworkinstallunixtools
860 # On install, we re-make the framework
861 # structure in the install location, /Library/Frameworks/ or the argument to
862 # --enable-framework. If --enable-framework has been specified then we have
863 # automatically set prefix to the location deep down in the framework, so we
864 # only have to cater for the structural bits of the framework.
866 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
868 frameworkinstallstructure: $(LDLIBRARY)
869 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
870 echo Not configured with --enable-framework; \
874 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
875 if test ! -d $(DESTDIR)$$i; then \
876 echo "Creating directory $(DESTDIR)$$i"; \
877 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
881 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
882 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
883 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
884 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
885 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
886 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
887 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
888 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
889 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
890 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
892 # This installs Mac/Lib into the framework
893 frameworkinstallmaclib:
894 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \
895 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
896 srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) \
899 # This installs the IDE, the Launcher and other apps into /Applications
900 frameworkinstallapps:
901 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \
902 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
903 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix)
905 # This install the unix python and pythonw tools in /usr/local/bin
906 frameworkinstallunixtools:
907 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
908 DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
909 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix)
911 # This installs the Demos and Tools into the applications directory.
912 # It is not part of a normal frameworkinstall
913 frameworkinstallextras:
914 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installextras \
915 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
916 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR)
918 # This installs a few of the useful scripts in Tools/scripts
920 SRCDIR=$(srcdir) $(RUNSHARED) \
921 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
923 --install-scripts=$(BINDIR) \
926 # Build the toplevel Makefile
927 Makefile.pre: Makefile.pre.in config.status
928 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
929 $(MAKE) -f Makefile.pre Makefile
931 # Run the configure script.
932 config.status: $(srcdir)/configure
933 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
935 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
937 # Some make's put the object file in the current directory
939 $(CC) -c $(PY_CFLAGS) -o $@ $<
941 # Rerun configure with the same options as it was run last time,
942 # provided the config.status script exists
944 $(SHELL) config.status --recheck
945 $(SHELL) config.status
947 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
949 (cd $(srcdir); autoconf)
950 (cd $(srcdir); autoheader)
952 # Create a tags file for vi
955 ctags -w -t Include/*.h; \
956 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
960 # Create a tags file for GNU Emacs
964 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
966 # Sanitation targets -- clean leaves libraries, executables and tags
967 # files, which clobber removes those as well
970 find . -name '*.o' -exec rm -f {} ';'
971 find . -name '*.s[ol]' -exec rm -f {} ';'
972 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
975 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
977 config.cache config.log pyconfig.h Modules/config.c
978 -rm -rf build platform
979 -rm -rf $(PYTHONFRAMEWORKDIR)
981 # Make things extra clean, before making a distribution:
982 # remove all generated files, even Makefile[.pre]
983 # Keep configure and Python-ast.[ch], it's possible they can't be generated
985 -rm -f core Makefile Makefile.pre config.status \
986 Modules/Setup Modules/Setup.local Modules/Setup.config
987 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
988 -o -name '[@,#]*' -o -name '*.old' \
989 -o -name '*.orig' -o -name '*.rej' \
990 -o -name '*.bak' ')' \
993 # Check for smelly exported symbols (not starting with Py/_Py)
996 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
998 # Find files with funny names
1000 find $(DISTDIRS) -type d \
1001 -o -name '*.[chs]' \
1011 -o -name '*,[vpt]' \
1013 -o -name 'Setup.*' \
1016 -o -name ChangeLog \
1017 -o -name Repository \
1023 -o -name .cvsignore \
1029 Python/thread.o: @THREADHEADERS@
1031 # Declare targets that aren't real files
1032 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1033 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1034 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1035 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1036 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1037 .PHONY: recheck autoconf clean clobber distclean smelly funny
1039 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY