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
58 CPPFLAGS= -I. -I$(srcdir)/Include
63 LINKFORSHARED= @LINKFORSHARED@
64 # Extra C flags added for building the interpreter object files.
65 CFLAGSFORSHARED=@CFLAGSFORSHARED@
66 # C flags used for building the interpreter object files
67 PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
70 # Machine-dependent subdirectories
73 # Install prefix for architecture-independent files
76 # Install prefix for architecture-dependent files
77 exec_prefix= @exec_prefix@
79 # Expanded directories
80 BINDIR= $(exec_prefix)/bin
81 LIBDIR= $(exec_prefix)/lib
83 INCLUDEDIR= @includedir@
84 CONFINCLUDEDIR= $(exec_prefix)/include
85 SCRIPTDIR= $(prefix)/lib
87 # Detailed destination directories
88 BINLIBDEST= $(LIBDIR)/python$(VERSION)
89 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
90 INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
91 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
92 LIBP= $(LIBDIR)/python$(VERSION)
94 # Symbols used for using shared libraries
97 BLDSHARED= @BLDSHARED@
98 DESTSHARED= $(BINLIBDEST)/lib-dynload
100 # Executable suffix (.exe on Windows and Mac OS X)
102 BUILDEXE= @BUILDEXEEXT@
104 # Short name and location for Mac OS X Python framework
105 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
106 PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
107 PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
108 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
110 # Environment to run shared python without installed libraries
111 RUNSHARED= @RUNSHARED@
113 # Modes for directories, executables and data files created by the
114 # install process. Default to user-only-writable for all file types.
119 # configure script arguments
120 CONFIG_ARGS= @CONFIG_ARGS@
123 # Subdirectories with code
126 # Other subdirectories
127 SUBDIRSTOO= Include Lib Misc Demo
129 # Files and directories to be distributed
130 CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
131 DISTFILES= README ChangeLog $(CONFIGFILES)
132 DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
133 DIST= $(DISTFILES) $(DISTDIRS)
137 LDLIBRARY= @LDLIBRARY@
138 BLDLIBRARY= @BLDLIBRARY@
139 DLLLIBRARY= @DLLLIBRARY@
140 LDLIBRARYDIR= @LDLIBRARYDIR@
141 INSTSONAME= @INSTSONAME@
147 SYSLIBS= $(LIBM) $(LIBC)
151 THREADOBJ= @THREADOBJ@
152 DLINCLDIR= @DLINCLDIR@
153 DYNLOADFILE= @DYNLOADFILE@
154 MACHDEP_OBJS= @MACHDEP_OBJS@
155 UNICODE_OBJS= @UNICODE_OBJS@
158 BUILDPYTHON= python$(BUILDEXE)
160 # === Definitions added by makesetup ===
163 ##########################################################################
171 # Used of signalmodule.o is not available
172 SIGNAL_OBJS= @SIGNAL_OBJS@
175 ##########################################################################
177 GRAMMAR_H= $(srcdir)/Include/graminit.h
178 GRAMMAR_C= $(srcdir)/Python/graminit.c
179 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
182 ##########################################################################
184 PGEN= Parser/pgen$(EXE)
196 PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
200 Python/mysnprintf.o \
201 Parser/tokenizer_pgen.o \
205 Parser/printgrammar.o \
208 PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
211 ##########################################################################
214 Python/bltinmodule.o \
215 Python/exceptions.o \
221 Python/frozenmain.o \
224 Python/getcompiler.o \
225 Python/getcopyright.o \
227 Python/getplatform.o \
228 Python/getversion.o \
233 Python/modsupport.o \
235 Python/mysnprintf.o \
239 Python/structmember.o \
244 Python/$(DYNLOADFILE) \
249 ##########################################################################
253 Objects/boolobject.o \
254 Objects/bufferobject.o \
255 Objects/cellobject.o \
256 Objects/classobject.o \
258 Objects/complexobject.o \
259 Objects/descrobject.o \
260 Objects/enumobject.o \
261 Objects/fileobject.o \
262 Objects/floatobject.o \
263 Objects/frameobject.o \
264 Objects/funcobject.o \
265 Objects/intobject.o \
266 Objects/iterobject.o \
267 Objects/listobject.o \
268 Objects/longobject.o \
269 Objects/dictobject.o \
270 Objects/methodobject.o \
271 Objects/moduleobject.o \
274 Objects/rangeobject.o \
275 Objects/sliceobject.o \
276 Objects/stringobject.o \
277 Objects/structseq.o \
278 Objects/tupleobject.o \
279 Objects/typeobject.o \
280 Objects/weakrefobject.o \
284 ##########################################################################
285 # objects that get linked into the Python library
287 Modules/getbuildinfo.o \
295 #########################################################################
299 all: $(BUILDPYTHON) oldsharedmods sharedmods
301 # Build the interpreter
302 $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
303 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
305 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
307 platform: $(BUILDPYTHON)
308 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
311 # Build the shared modules
312 sharedmods: $(BUILDPYTHON)
313 case $$MAKEFLAGS in \
314 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
315 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
318 # buildno should really depend on something like LIBRARY_SRC
319 buildno: $(PARSER_OBJS) \
325 $(srcdir)/Modules/getbuildinfo.c
326 if test -f buildno; then \
327 expr `cat buildno` + 1 >buildno1; \
328 mv -f buildno1 buildno; \
329 else echo 1 >buildno; fi
331 # Build static library
332 # avoid long command lines, same as LIBRARY_OBJS
333 $(LIBRARY): $(LIBRARY_OBJS)
335 $(AR) cr $@ Modules/getbuildinfo.o
336 $(AR) cr $@ $(PARSER_OBJS)
337 $(AR) cr $@ $(OBJECT_OBJS)
338 $(AR) cr $@ $(PYTHON_OBJS)
339 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
340 $(AR) cr $@ $(MODOBJS)
343 libpython$(VERSION).so: $(LIBRARY_OBJS)
344 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
346 libpython$(VERSION).sl: $(LIBRARY_OBJS)
347 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
349 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
350 # minimal framework (not including the Lib directory and such) in the current
352 RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
353 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
355 $(RESSRCDIR)/Info.plist \
356 $(RESSRCDIR)/version.plist \
357 $(RESSRCDIR)/English.lproj/InfoPlist.strings
358 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
359 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
360 -framework System @LIBTOOL_CRUFT@
361 $(INSTALL) -d -m $(DIRMODE) \
362 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
363 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
364 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
365 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
366 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
367 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
368 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
369 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
370 $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
371 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
372 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
374 # This rule builds the Cygwin Python DLL
375 libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
376 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
377 $(LIBS) $(MODLIBS) $(SYSLIBS)
380 oldsharedmods: $(SHAREDMODS)
383 Makefile Modules/config.c: Makefile.pre \
384 $(srcdir)/Modules/config.c.in \
386 Modules/Setup.config \
389 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
391 Modules/Setup.config \
392 Modules/Setup.local \
395 @echo "The Makefile was updated, you may need to re-run make."
398 Modules/Setup: $(srcdir)/Modules/Setup.dist
399 @if test -f Modules/Setup; then \
400 echo "-----------------------------------------------"; \
401 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
402 echo "check to make sure you have all the updates you"; \
403 echo "need in your Modules/Setup file."; \
404 echo "Usually, copying Setup.dist to Setup will work."; \
405 echo "-----------------------------------------------"; \
408 ############################################################################
409 # Special rules for object files
411 Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
412 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
414 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
415 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
416 -DPREFIX='"$(prefix)"' \
417 -DEXEC_PREFIX='"$(exec_prefix)"' \
418 -DVERSION='"$(VERSION)"' \
419 -DVPATH='"$(VPATH)"' \
420 -o $@ $(srcdir)/Modules/getpath.c
422 Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
423 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
426 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
427 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
430 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
432 Parser/grammar.o: $(srcdir)/Parser/grammar.c \
433 $(srcdir)/Include/token.h \
434 $(srcdir)/Include/grammar.h
435 Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
437 Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
440 Python/compile.o Python/symtable.o: $(GRAMMAR_H)
442 Python/getplatform.o: $(srcdir)/Python/getplatform.c
443 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
445 Python/importdl.o: $(srcdir)/Python/importdl.c
446 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
448 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
449 $(srcdir)/Objects/unicodetype_db.h
451 ############################################################################
457 Include/boolobject.h \
458 Include/bufferobject.h \
460 Include/classobject.h \
464 Include/complexobject.h \
465 Include/descrobject.h \
466 Include/dictobject.h \
467 Include/enumobject.h \
468 Include/fileobject.h \
469 Include/floatobject.h \
470 Include/funcobject.h \
472 Include/intobject.h \
473 Include/intrcheck.h \
474 Include/iterobject.h \
475 Include/listobject.h \
476 Include/longobject.h \
477 Include/methodobject.h \
478 Include/modsupport.h \
479 Include/moduleobject.h \
482 Include/patchlevel.h \
489 Include/pythonrun.h \
490 Include/rangeobject.h \
491 Include/sliceobject.h \
492 Include/stringobject.h \
493 Include/structseq.h \
494 Include/structmember.h \
496 Include/sysmodule.h \
497 Include/traceback.h \
498 Include/tupleobject.h \
499 Include/unicodeobject.h \
500 Include/weakrefobject.h \
503 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
506 ######################################################################
508 # Test the interpreter (twice, once without .pyc files, once with)
510 TESTPROG= $(srcdir)/Lib/test/regrtest.py
511 TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
513 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
514 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
515 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
517 QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
518 test_unicodedata test_re test_sre test_select test_poll \
519 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
520 quicktest: all platform
521 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
522 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
523 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
525 MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
527 memtest: all platform
528 -rm -f $(srcdir)/Lib/test/*.py[co]
529 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
530 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
533 install: altinstall bininstall maninstall idleinstall
535 # Install almost everything without disturbing previous versions
536 altinstall: altbininstall libinstall inclinstall libainstall \
537 sharedinstall oldsharedinstall
539 # Install shared libraries enabled by Setup
540 DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
542 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
543 @for i in X $(SHAREDMODS); do \
544 if test $$i != X; then \
545 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
546 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
551 @for i in $(DESTDIRS); \
553 if test ! -d $$i; then \
554 echo "Creating directory $$i"; \
555 $(INSTALL) -d -m $(DIRMODE) $$i; \
561 # Install the interpreter (by creating a hard link to python$(VERSION))
562 bininstall: altbininstall
563 -if test -f $(BINDIR)/$(PYTHON) -o -L $(BINDIR)/$(PYTHON); \
564 then rm -f $(BINDIR)/$(PYTHON); \
567 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
569 # Install the interpreter with $(VERSION) affixed
570 # This goes into $(exec_prefix)
571 altbininstall: $(BUILDPYTHON)
572 @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \
573 if test ! -f $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
574 echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \
578 @for i in $(BINDIR) $(LIBDIR); \
580 if test ! -d $$i; then \
581 echo "Creating directory $$i"; \
582 $(INSTALL) -d -m $(DIRMODE) $$i; \
586 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE)
587 if test -f libpython$(VERSION)$(SO); then \
588 if test "$(SO)" = .dll; then \
589 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(BINDIR); \
591 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \
596 # Install the manual page
598 @for i in $(MANDIR) $(MANDIR)/man1; \
600 if test ! -d $$i; then \
601 echo "Creating directory $$i"; \
602 $(INSTALL) -d -m $(DIRMODE) $$i; \
606 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
607 $(MANDIR)/man1/python.1
609 # Install the library
610 PLATDIR= plat-$(MACHDEP)
611 EXTRAPLATDIR= @EXTRAPLATDIR@
612 MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
613 XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
614 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
615 plat-mac/lib-scriptpackages/_BuiltinSuites \
616 plat-mac/lib-scriptpackages/CodeWarrior \
617 plat-mac/lib-scriptpackages/Explorer \
618 plat-mac/lib-scriptpackages/Finder \
619 plat-mac/lib-scriptpackages/Netscape \
620 plat-mac/lib-scriptpackages/StdSuites \
621 plat-mac/lib-scriptpackages/Terminal
622 LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \
623 encodings email compiler hotshot logging bsddb \
624 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
625 libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
626 @for i in $(SCRIPTDIR) $(LIBDEST); \
628 if test ! -d $$i; then \
629 echo "Creating directory $$i"; \
630 $(INSTALL) -d -m $(DIRMODE) $$i; \
634 @for d in $(LIBSUBDIRS); \
636 a=$(srcdir)/Lib/$$d; \
637 if test ! -d $$a; then continue; else true; fi; \
639 if test ! -d $$b; then \
640 echo "Creating directory $$b"; \
641 $(INSTALL) -d -m $(DIRMODE) $$b; \
645 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
647 if test -x $$i; then \
648 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
649 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
651 $(INSTALL_DATA) $$i $(LIBDEST); \
652 echo $(INSTALL_DATA) $$i $(LIBDEST); \
655 @for d in $(LIBSUBDIRS); \
657 a=$(srcdir)/Lib/$$d; \
658 if test ! -d $$a; then continue; else true; fi; \
668 if test -d $$i; then continue; fi; \
669 if test -x $$i; then \
670 echo $(INSTALL_SCRIPT) $$i $$b; \
671 $(INSTALL_SCRIPT) $$i $$b; \
673 echo $(INSTALL_DATA) $$i $$b; \
674 $(INSTALL_DATA) $$i $$b; \
679 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
680 PYTHONPATH=$(LIBDEST) $(RUNSHARED) \
681 ./$(BUILDPYTHON) -Wi -tt $(LIBDEST)/compileall.py \
682 -x badsyntax $(LIBDEST)
683 PYTHONPATH=$(LIBDEST) $(RUNSHARED) \
684 ./$(BUILDPYTHON) -Wi -tt -O $(LIBDEST)/compileall.py \
685 -x badsyntax $(LIBDEST)
687 # Create the PLATDIR source directory, if one wasn't distributed..
688 $(srcdir)/Lib/$(PLATDIR):
689 mkdir $(srcdir)/Lib/$(PLATDIR)
690 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
691 export PATH; PATH="`pwd`:$$PATH"; \
692 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
693 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
694 export EXE; EXE="$(BUILDEXE)"; \
695 cd $(srcdir)/Lib/$(PLATDIR); ./regen
697 # Install the include files
698 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
700 @for i in $(INCLDIRSTOMAKE); \
702 if test ! -d $$i; then \
703 echo "Creating directory $$i"; \
704 $(INSTALL) -d -m $(DIRMODE) $$i; \
708 @for i in $(srcdir)/Include/*.h; \
710 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
711 $(INSTALL_DATA) $$i $(INCLUDEPY); \
713 $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h
715 # Install the library and miscellaneous stuff needed for extending/embedding
716 # This goes into $(exec_prefix)
717 LIBPL= $(LIBP)/config
719 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
721 if test ! -d $$i; then \
722 echo "Creating directory $$i"; \
723 $(INSTALL) -d -m $(DIRMODE) $$i; \
727 @if test -d $(LIBRARY); then :; else \
728 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
729 if test "$(SO)" = .dll; then \
730 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL) ; \
732 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
733 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
736 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
739 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
740 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
741 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
742 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
743 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
744 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
745 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
746 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
747 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
748 @if [ -s Modules/python.exp -a \
749 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
750 echo; echo "Installing support files for building shared extension modules on AIX:"; \
751 $(INSTALL_DATA) Modules/python.exp \
752 $(LIBPL)/python.exp; \
753 echo; echo "$(LIBPL)/python.exp"; \
754 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
755 $(LIBPL)/makexp_aix; \
756 echo "$(LIBPL)/makexp_aix"; \
757 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
758 $(LIBPL)/ld_so_aix; \
759 echo "$(LIBPL)/ld_so_aix"; \
760 echo; echo "See Misc/AIX-NOTES for details."; \
763 @case "$(MACHDEP)" in beos*) \
764 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
765 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
766 echo; echo "$(LIBPL)/README"; \
767 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
768 echo "$(LIBPL)/ar_beos"; \
769 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
770 echo "$(LIBPL)/ld_so_beos"; \
771 echo; echo "See Misc/BeOS-NOTES for details."; \
775 # Install the dynamically loadable modules
776 # This goes into $(exec_prefix)
778 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
780 --install-scripts=$(BINDIR) \
781 --install-platlib=$(DESTSHARED)
783 # Here are a couple of targets for MacOSX again, to install a full
784 # framework-based Python. frameworkinstall installs everything, the
785 # subtargets install specific parts. Much of the actual work is offloaded to
786 # the Makefile in Mac/OSX
788 frameworkinstall: frameworkinstallframework \
789 frameworkinstallapps frameworkinstallunixtools
791 # On install, we re-make the framework
792 # structure in the install location, /Library/Frameworks/ or the argument to
793 # --enable-framework. If --enable-framework has been specified then we have
794 # automatically set prefix to the location deep down in the framework, so we
795 # only have to cater for the structural bits of the framework.
797 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
799 frameworkinstallstructure: $(LDLIBRARY)
800 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
801 echo Not configured with --enable-framework; \
805 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
806 if test ! -d $$i; then \
807 echo "Creating directory $$i"; \
808 $(INSTALL) -d -m $(DIRMODE) $$i; \
812 $(LN) -fsn include/python$(VERSION) $(prefix)/Headers
813 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(prefix)/Resources/Info.plist
814 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(prefix)/Resources/version.plist
815 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
816 $(prefix)/Resources/English.lproj/InfoPlist.strings
817 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
818 $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python
819 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers
820 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources
821 $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
823 # This installs Mac/Lib into the framework
824 frameworkinstallmaclib:
825 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \
826 srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST)
828 # This installs the IDE, the Launcher and other apps into /Applications
829 frameworkinstallapps:
830 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \
831 srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
833 # This install the unix python and pythonw tools in /usr/local/bin
834 frameworkinstallunixtools:
835 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
836 srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
841 ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install \
844 --install-scripts=$(BINDIR) \
845 --install-platlib=$(DESTSHARED)
847 # Build the toplevel Makefile
848 Makefile.pre: Makefile.pre.in config.status
849 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
850 $(MAKE) -f Makefile.pre Makefile
852 # Run the configure script.
853 config.status: $(srcdir)/configure
854 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
856 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
858 # Some make's put the object file in the current directory
860 $(CC) -c $(PY_CFLAGS) -o $@ $<
862 # Rerun configure with the same options as it was run last time,
863 # provided the config.status script exists
865 $(SHELL) config.status --recheck
866 $(SHELL) config.status
868 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
870 (cd $(srcdir); autoconf)
871 (cd $(srcdir); autoheader)
873 # Create a tags file for vi
876 ctags -w -t Include/*.h; \
877 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
881 # Create a tags file for GNU Emacs
885 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
887 # Sanitation targets -- clean leaves libraries, executables and tags
888 # files, which clobber removes those as well
891 find . -name '*.o' -exec rm -f {} ';'
892 find . -name '*.s[ol]' -exec rm -f {} ';'
893 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
896 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
898 config.cache config.log pyconfig.h Modules/config.c
899 -rm -rf build platform
901 # Make things extra clean, before making a distribution:
902 # remove all generated files, even Makefile[.pre]
904 -rm -f core Makefile Makefile.pre buildno config.status \
905 Modules/Setup Modules/Setup.local Modules/Setup.config
906 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
907 -o -name '[@,#]*' -o -name '*.old' \
908 -o -name '*.orig' -o -name '*.rej' \
909 -o -name '*.bak' ')' \
912 # Check for smelly exported symbols (not starting with Py/_Py)
915 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
917 # Find files with funny names
919 find $(DISTDIRS) -type d \
936 -o -name Repository \
942 -o -name .cvsignore \
948 Python/thread.o: @THREADHEADERS@
950 # Declare targets that aren't real files
951 .PHONY: all sharedmods oldsharedmods test quicktest memtest
952 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
953 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
954 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
955 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
956 .PHONY: recheck autoconf clean clobber distclean smelly funny
958 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY