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 # Shell used by make (some versions default to the login shell, which is bad)
40 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
43 # Portable install script (configure doesn't always guess right)
45 INSTALL_PROGRAM=@INSTALL_PROGRAM@
46 INSTALL_SCRIPT= @INSTALL_SCRIPT@
47 INSTALL_DATA= @INSTALL_DATA@
48 # Shared libraries must be installed with executable mode on some systems;
49 # rather than figuring out exactly which, we always give them executable mode.
50 # Also, making them read-only seems to be a good idea...
51 INSTALL_SHARED= ${INSTALL} -m 555
53 MAKESETUP= $(srcdir)/Modules/makesetup
57 BASECFLAGS= @BASECFLAGS@
58 CFLAGS= $(BASECFLAGS) $(OPT)
59 CPPFLAGS= -I. -I$(srcdir)/Include
64 LINKFORSHARED= @LINKFORSHARED@
65 # Extra C flags added for building the interpreter object files.
66 CFLAGSFORSHARED=@CFLAGSFORSHARED@
67 # C flags used for building the interpreter object files
68 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
71 # Machine-dependent subdirectories
74 # Install prefix for architecture-independent files
77 # Install prefix for architecture-dependent files
78 exec_prefix= @exec_prefix@
80 # Expanded directories
81 BINDIR= $(exec_prefix)/bin
82 LIBDIR= $(exec_prefix)/lib
84 INCLUDEDIR= @includedir@
85 CONFINCLUDEDIR= $(exec_prefix)/include
86 SCRIPTDIR= $(prefix)/lib
88 # Detailed destination directories
89 BINLIBDEST= $(LIBDIR)/python$(VERSION)
90 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
91 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
92 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
93 LIBP= $(LIBDIR)/python$(VERSION)
95 # Symbols used for using shared libraries
98 BLDSHARED= @BLDSHARED@
99 DESTSHARED= $(BINLIBDEST)/lib-dynload
101 # Executable suffix (.exe on Windows and Mac OS X)
103 BUILDEXE= @BUILDEXEEXT@
105 # Short name and location for Mac OS X Python framework
106 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
107 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
108 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
109 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
110 # Deployment target selected during configure, to be checked
112 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
113 # Options to enable prebinding (for fast startup)
114 OTHER_LIBTOOL_OPT = -prebind -seg1addr 0x10000000
116 # Environment to run shared python without installed libraries
117 RUNSHARED= @RUNSHARED@
119 # Modes for directories, executables and data files created by the
120 # install process. Default to user-only-writable for all file types.
125 # configure script arguments
126 CONFIG_ARGS= @CONFIG_ARGS@
129 # Subdirectories with code
132 # Other subdirectories
133 SUBDIRSTOO= Include Lib Misc Demo
135 # Files and directories to be distributed
136 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
137 DISTFILES= README ChangeLog $(CONFIGFILES)
138 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
139 DIST= $(DISTFILES) $(DISTDIRS)
143 LDLIBRARY= @LDLIBRARY@
144 BLDLIBRARY= @BLDLIBRARY@
145 DLLLIBRARY= @DLLLIBRARY@
146 LDLIBRARYDIR= @LDLIBRARYDIR@
147 INSTSONAME= @INSTSONAME@
153 SYSLIBS= $(LIBM) $(LIBC)
157 THREADOBJ= @THREADOBJ@
158 DLINCLDIR= @DLINCLDIR@
159 DYNLOADFILE= @DYNLOADFILE@
160 MACHDEP_OBJS= @MACHDEP_OBJS@
161 UNICODE_OBJS= @UNICODE_OBJS@
164 BUILDPYTHON= python$(BUILDEXE)
166 # === Definitions added by makesetup ===
169 ##########################################################################
177 # Used of signalmodule.o is not available
178 SIGNAL_OBJS= @SIGNAL_OBJS@
181 ##########################################################################
183 GRAMMAR_H= $(srcdir)/Include/graminit.h
184 GRAMMAR_C= $(srcdir)/Python/graminit.c
185 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
188 ##########################################################################
190 PGEN= Parser/pgen$(EXE)
200 Parser/metagrammar.o \
205 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
209 Python/mysnprintf.o \
210 Parser/tokenizer_pgen.o \
211 Parser/printgrammar.o \
214 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
217 ##########################################################################
220 Python/bltinmodule.o \
221 Python/exceptions.o \
227 Python/frozenmain.o \
230 Python/getcompiler.o \
231 Python/getcopyright.o \
233 Python/getplatform.o \
234 Python/getversion.o \
239 Python/modsupport.o \
241 Python/mysnprintf.o \
245 Python/structmember.o \
251 Python/$(DYNLOADFILE) \
256 ##########################################################################
260 Objects/boolobject.o \
261 Objects/bufferobject.o \
262 Objects/cellobject.o \
263 Objects/classobject.o \
265 Objects/complexobject.o \
266 Objects/descrobject.o \
267 Objects/enumobject.o \
268 Objects/genobject.o \
269 Objects/fileobject.o \
270 Objects/floatobject.o \
271 Objects/frameobject.o \
272 Objects/funcobject.o \
273 Objects/intobject.o \
274 Objects/iterobject.o \
275 Objects/listobject.o \
276 Objects/longobject.o \
277 Objects/dictobject.o \
278 Objects/methodobject.o \
279 Objects/moduleobject.o \
282 Objects/rangeobject.o \
283 Objects/setobject.o \
284 Objects/sliceobject.o \
285 Objects/stringobject.o \
286 Objects/structseq.o \
287 Objects/tupleobject.o \
288 Objects/typeobject.o \
289 Objects/weakrefobject.o \
293 ##########################################################################
294 # objects that get linked into the Python library
296 Modules/getbuildinfo.o \
304 #########################################################################
308 all: $(BUILDPYTHON) oldsharedmods sharedmods
310 # Build the interpreter
311 $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
312 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
314 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
316 platform: $(BUILDPYTHON)
317 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
320 # Build the shared modules
321 sharedmods: $(BUILDPYTHON)
322 case $$MAKEFLAGS in \
323 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
324 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
327 # buildno should really depend on something like LIBRARY_SRC
328 buildno: $(PARSER_OBJS) \
334 $(srcdir)/Modules/getbuildinfo.c
335 if test -f buildno; then \
336 expr `cat buildno` + 1 >buildno1; \
337 mv -f buildno1 buildno; \
338 else echo 1 >buildno; fi
340 # Build static library
341 # avoid long command lines, same as LIBRARY_OBJS
342 $(LIBRARY): $(LIBRARY_OBJS)
344 $(AR) cr $@ Modules/getbuildinfo.o
345 $(AR) cr $@ $(PARSER_OBJS)
346 $(AR) cr $@ $(OBJECT_OBJS)
347 $(AR) cr $@ $(PYTHON_OBJS)
348 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
349 $(AR) cr $@ $(MODOBJS)
352 libpython$(VERSION).so: $(LIBRARY_OBJS)
353 if test $(INSTSONAME) != $(LDLIBRARY); then \
354 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
355 $(LN) -f $(INSTSONAME) $@; \
357 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
360 libpython$(VERSION).sl: $(LIBRARY_OBJS)
361 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
363 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
364 # minimal framework (not including the Lib directory and such) in the current
366 RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
367 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
369 $(RESSRCDIR)/Info.plist \
370 $(RESSRCDIR)/version.plist \
371 $(RESSRCDIR)/English.lproj/InfoPlist.strings
372 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
373 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
374 -framework System @LIBTOOL_CRUFT@
375 $(INSTALL) -d -m $(DIRMODE) \
376 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
377 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
378 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
379 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
380 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
381 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
382 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
383 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
384 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
385 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
386 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
388 # This rule builds the Cygwin Python DLL and import library if configured
389 # for a shared core library; otherwise, this rule is a noop.
390 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
391 if test -n "$(DLLLIBRARY)"; then \
392 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
393 $(LIBS) $(MODLIBS) $(SYSLIBS); \
398 oldsharedmods: $(SHAREDMODS)
401 Makefile Modules/config.c: Makefile.pre \
402 $(srcdir)/Modules/config.c.in \
404 Modules/Setup.config \
407 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
409 Modules/Setup.config \
410 Modules/Setup.local \
413 @echo "The Makefile was updated, you may need to re-run make."
416 Modules/Setup: $(srcdir)/Modules/Setup.dist
417 @if test -f Modules/Setup; then \
418 echo "-----------------------------------------------"; \
419 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
420 echo "check to make sure you have all the updates you"; \
421 echo "need in your Modules/Setup file."; \
422 echo "Usually, copying Setup.dist to Setup will work."; \
423 echo "-----------------------------------------------"; \
426 ############################################################################
427 # Special rules for object files
429 Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
430 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
432 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
433 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
434 -DPREFIX='"$(prefix)"' \
435 -DEXEC_PREFIX='"$(exec_prefix)"' \
436 -DVERSION='"$(VERSION)"' \
437 -DVPATH='"$(VPATH)"' \
438 -o $@ $(srcdir)/Modules/getpath.c
440 Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
441 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
444 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
445 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
448 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
450 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
451 $(srcdir)/Include/token.h \
452 $(srcdir)/Include/grammar.h
453 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
455 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
458 Python/compile.o Python/symtable.o: $(GRAMMAR_H)
460 Python/getplatform.o: $(srcdir)/Python/getplatform.c
461 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
463 Python/importdl.o: $(srcdir)/Python/importdl.c
464 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
466 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
467 $(srcdir)/Objects/unicodetype_db.h
469 ############################################################################
475 Include/boolobject.h \
476 Include/bufferobject.h \
478 Include/classobject.h \
482 Include/complexobject.h \
483 Include/descrobject.h \
484 Include/dictobject.h \
485 Include/enumobject.h \
486 Include/genobject.h \
487 Include/fileobject.h \
488 Include/floatobject.h \
489 Include/funcobject.h \
491 Include/intobject.h \
492 Include/intrcheck.h \
493 Include/iterobject.h \
494 Include/listobject.h \
495 Include/longobject.h \
496 Include/methodobject.h \
497 Include/modsupport.h \
498 Include/moduleobject.h \
501 Include/patchlevel.h \
508 Include/pythonrun.h \
509 Include/rangeobject.h \
510 Include/setobject.h \
511 Include/sliceobject.h \
512 Include/stringobject.h \
513 Include/structseq.h \
514 Include/structmember.h \
516 Include/sysmodule.h \
517 Include/traceback.h \
518 Include/tupleobject.h \
519 Include/unicodeobject.h \
520 Include/weakrefobject.h \
523 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
526 ######################################################################
528 # Test the interpreter (twice, once without .pyc files, once with)
529 # In the past, we've had problems where bugs in the marshalling or
530 # elsewhere caused bytecode read from .pyc files to behave differently
531 # than bytecode generated directly from a .py source file. Sometimes
532 # the bytecode read from a .pyc file had the bug, somtimes the directly
533 # generated bytecode. This is sometimes a very shy bug needing a lot of
537 TESTPROG= $(srcdir)/Lib/test/regrtest.py
538 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
540 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
541 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
542 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
544 testall: all platform
545 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
546 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
547 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
549 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
550 test_unicodedata test_re test_sre test_select test_poll \
551 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
552 quicktest: all platform
553 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
554 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
555 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
557 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
559 memtest: all platform
560 -rm -f $(srcdir)/Lib/test/*.py[co]
561 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
562 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
565 install: altinstall bininstall maninstall
567 # Install almost everything without disturbing previous versions
568 altinstall: altbininstall libinstall inclinstall libainstall \
569 sharedinstall oldsharedinstall
571 # Install shared libraries enabled by Setup
572 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
574 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
575 @for i in X $(SHAREDMODS); do \
576 if test $$i != X; then \
577 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
578 $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
583 @for i in $(DESTDIRS); \
585 if test ! -d $(DESTDIR)$$i; then \
586 echo "Creating directory $$i"; \
587 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
593 # Install the interpreter (by creating a hard link to python$(VERSION))
594 bininstall: altbininstall
595 -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
596 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
599 (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
601 # Install the interpreter with $(VERSION) affixed
602 # This goes into $(exec_prefix)
603 altbininstall: $(BUILDPYTHON)
604 @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \
605 if test ! -f $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
606 echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \
610 @for i in $(BINDIR) $(LIBDIR); \
612 if test ! -d $(DESTDIR)$$i; then \
613 echo "Creating directory $$i"; \
614 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
618 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
619 if test -f libpython$(VERSION)$(SO); then \
620 if test "$(SO)" = .dll; then \
621 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
623 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
624 if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
625 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
631 # Install the manual page
633 @for i in $(MANDIR) $(MANDIR)/man1; \
635 if test ! -d $(DESTDIR)$$i; then \
636 echo "Creating directory $$i"; \
637 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
641 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
642 $(DESTDIR)$(MANDIR)/man1/python.1
644 # Install the library
645 PLATDIR= plat-$(MACHDEP)
646 EXTRAPLATDIR= @EXTRAPLATDIR@
647 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
648 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
649 XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
650 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
651 plat-mac/lib-scriptpackages/_builtinSuites \
652 plat-mac/lib-scriptpackages/CodeWarrior \
653 plat-mac/lib-scriptpackages/Explorer \
654 plat-mac/lib-scriptpackages/Finder \
655 plat-mac/lib-scriptpackages/Netscape \
656 plat-mac/lib-scriptpackages/StdSuites \
657 plat-mac/lib-scriptpackages/SystemEvents \
658 plat-mac/lib-scriptpackages/Terminal
659 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
660 LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \
661 test/decimaltestdata \
662 encodings email email/test email/test/data compiler hotshot \
663 logging bsddb bsddb/test csv idlelib idlelib/Icons \
664 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
665 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
666 @for i in $(SCRIPTDIR) $(LIBDEST); \
668 if test ! -d $(DESTDIR)$$i; then \
669 echo "Creating directory $$i"; \
670 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
674 @for d in $(LIBSUBDIRS); \
676 a=$(srcdir)/Lib/$$d; \
677 if test ! -d $$a; then continue; else true; fi; \
679 if test ! -d $(DESTDIR)$$b; then \
680 echo "Creating directory $$b"; \
681 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
685 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
687 if test -x $$i; then \
688 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
689 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
691 $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
692 echo $(INSTALL_DATA) $$i $(LIBDEST); \
695 @for d in $(LIBSUBDIRS); \
697 a=$(srcdir)/Lib/$$d; \
698 if test ! -d $$a; then continue; else true; fi; \
708 if test -d $$i; then continue; fi; \
709 if test -x $$i; then \
710 echo $(INSTALL_SCRIPT) $$i $$b; \
711 $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
713 echo $(INSTALL_DATA) $$i $$b; \
714 $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
719 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
720 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
721 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
723 -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
724 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
725 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
727 -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
728 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
729 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
730 -d $(LIBDEST)/site-packages -f \
731 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
732 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
733 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
734 -d $(LIBDEST)/site-packages -f \
735 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
737 # Create the PLATDIR source directory, if one wasn't distributed..
738 $(srcdir)/Lib/$(PLATDIR):
739 mkdir $(srcdir)/Lib/$(PLATDIR)
740 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
741 export PATH; PATH="`pwd`:$$PATH"; \
742 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
743 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
744 export EXE; EXE="$(BUILDEXE)"; \
745 cd $(srcdir)/Lib/$(PLATDIR); ./regen
747 # Install the include files
748 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
750 @for i in $(INCLDIRSTOMAKE); \
752 if test ! -d $(DESTDIR)$$i; then \
753 echo "Creating directory $$i"; \
754 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
758 @for i in $(srcdir)/Include/*.h; \
760 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
761 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
763 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
765 # Install the library and miscellaneous stuff needed for extending/embedding
766 # This goes into $(exec_prefix)
767 LIBPL= $(LIBP)/config
769 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
771 if test ! -d $(DESTDIR)$$i; then \
772 echo "Creating directory $$i"; \
773 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
777 @if test -d $(LIBRARY); then :; else \
778 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
779 if test "$(SO)" = .dll; then \
780 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
782 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
783 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
786 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
789 $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
790 $(INSTALL_DATA) Modules/$(MAINOBJ) $(DESTDIR)$(LIBPL)/$(MAINOBJ)
791 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
792 $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
793 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
794 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
795 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
796 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
797 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
798 @if [ -s Modules/python.exp -a \
799 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
800 echo; echo "Installing support files for building shared extension modules on AIX:"; \
801 $(INSTALL_DATA) Modules/python.exp \
802 $(DESTDIR)$(LIBPL)/python.exp; \
803 echo; echo "$(LIBPL)/python.exp"; \
804 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
805 $(DESTDIR)$(LIBPL)/makexp_aix; \
806 echo "$(LIBPL)/makexp_aix"; \
807 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
808 $(DESTDIR)$(LIBPL)/ld_so_aix; \
809 echo "$(LIBPL)/ld_so_aix"; \
810 echo; echo "See Misc/AIX-NOTES for details."; \
813 @case "$(MACHDEP)" in beos*) \
814 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
815 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
816 echo; echo "$(LIBPL)/README"; \
817 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
818 echo "$(LIBPL)/ar_beos"; \
819 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
820 echo "$(LIBPL)/ld_so_beos"; \
821 echo; echo "See Misc/BeOS-NOTES for details."; \
825 # Install the dynamically loadable modules
826 # This goes into $(exec_prefix)
828 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
830 --install-scripts=$(BINDIR) \
831 --install-platlib=$(DESTSHARED) \
834 # Here are a couple of targets for MacOSX again, to install a full
835 # framework-based Python. frameworkinstall installs everything, the
836 # subtargets install specific parts. Much of the actual work is offloaded to
837 # the Makefile in Mac/OSX
839 frameworkinstall: frameworkinstallframework \
840 frameworkinstallapps frameworkinstallunixtools
842 # On install, we re-make the framework
843 # structure in the install location, /Library/Frameworks/ or the argument to
844 # --enable-framework. If --enable-framework has been specified then we have
845 # automatically set prefix to the location deep down in the framework, so we
846 # only have to cater for the structural bits of the framework.
848 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
850 frameworkinstallstructure: $(LDLIBRARY)
851 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
852 echo Not configured with --enable-framework; \
856 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
857 if test ! -d $(DESTDIR)$$i; then \
858 echo "Creating directory $(DESTDIR)$$i"; \
859 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
863 $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
864 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
865 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
866 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
867 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
868 $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
869 $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
870 $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
871 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
872 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
874 # This installs Mac/Lib into the framework
875 frameworkinstallmaclib:
876 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \
877 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
878 srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) \
881 # This installs the IDE, the Launcher and other apps into /Applications
882 frameworkinstallapps:
883 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \
884 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
885 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix)
887 # This install the unix python and pythonw tools in /usr/local/bin
888 frameworkinstallunixtools:
889 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
890 DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
891 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix)
893 # This installs the Demos and Tools into the applications directory.
894 # It is not part of a normal frameworkinstall
895 frameworkinstallextras:
896 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installextras \
897 $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \
898 srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR)
900 # This installs a few of the useful scripts in Tools/scripts
902 SRCDIR=$(srcdir) $(RUNSHARED) \
903 ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
905 --install-scripts=$(BINDIR) \
908 # Build the toplevel Makefile
909 Makefile.pre: Makefile.pre.in config.status
910 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
911 $(MAKE) -f Makefile.pre Makefile
913 # Run the configure script.
914 config.status: $(srcdir)/configure
915 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
917 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
919 # Some make's put the object file in the current directory
921 $(CC) -c $(PY_CFLAGS) -o $@ $<
923 # Rerun configure with the same options as it was run last time,
924 # provided the config.status script exists
926 $(SHELL) config.status --recheck
927 $(SHELL) config.status
929 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
931 (cd $(srcdir); autoconf)
932 (cd $(srcdir); autoheader)
934 # Create a tags file for vi
937 ctags -w -t Include/*.h; \
938 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
942 # Create a tags file for GNU Emacs
946 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
948 # Sanitation targets -- clean leaves libraries, executables and tags
949 # files, which clobber removes those as well
952 find . -name '*.o' -exec rm -f {} ';'
953 find . -name '*.s[ol]' -exec rm -f {} ';'
954 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
957 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
959 config.cache config.log pyconfig.h Modules/config.c
960 -rm -rf build platform
961 -rm -rf $(PYTHONFRAMEWORKDIR)
963 # Make things extra clean, before making a distribution:
964 # remove all generated files, even Makefile[.pre]
966 -rm -f core Makefile Makefile.pre buildno config.status \
967 Modules/Setup Modules/Setup.local Modules/Setup.config
968 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
969 -o -name '[@,#]*' -o -name '*.old' \
970 -o -name '*.orig' -o -name '*.rej' \
971 -o -name '*.bak' ')' \
974 # Check for smelly exported symbols (not starting with Py/_Py)
977 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
979 # Find files with funny names
981 find $(DISTDIRS) -type d \
998 -o -name Repository \
1004 -o -name .cvsignore \
1010 Python/thread.o: @THREADHEADERS@
1012 # Declare targets that aren't real files
1013 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1014 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1015 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1016 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1017 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1018 .PHONY: recheck autoconf clean clobber distclean smelly funny
1020 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY