This commit was manufactured by cvs2svn to create tag 'r23a1-fork'.
[python/dscho.git] / Makefile.pre.in
blob2dde4af3c6b4ad6f49239a5fa1a50b14e801aa46
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:
9 #       ./configure
10 #       make
11 #       make test
12 #       make install
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
17 # additional details.
19 # See also the section "Build instructions" in the README file.
21 # === Variables set by makesetup ===
23 MODOBJS=        _MODOBJS_
24 MODLIBS=        _MODLIBS_
26 # === Variables set by configure
27 VERSION=        @VERSION@
28 srcdir=         @srcdir@
29 VPATH=          @srcdir@
31 CC=             @CC@
32 CXX=            @CXX@
33 LINKCC=         @LINKCC@
34 AR=             @AR@
35 RANLIB=         @RANLIB@
37 # Shell used by make (some versions default to the login shell, which is bad)
38 SHELL=          /bin/sh
40 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
41 LN=             @LN@
43 # Portable install script (configure doesn't always guess right)
44 INSTALL=        @INSTALL@
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
55 # Compiler options
56 OPT=            @OPT@
57 CFLAGS=         $(OPT)
58 CPPFLAGS=       -I. -I$(srcdir)/Include
59 LDFLAGS=        @LDFLAGS@
60 LDLAST=         @LDLAST@
61 SGI_ABI=        @SGI_ABI@
62 CCSHARED=       @CCSHARED@
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
71 MACHDEP=        @MACHDEP@
73 # Install prefix for architecture-independent files
74 prefix=         @prefix@
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
82 MANDIR=         @mandir@
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
95 SO=             @SO@
96 LDSHARED=       @LDSHARED@
97 BLDSHARED=      @BLDSHARED@
98 DESTSHARED=     $(BINLIBDEST)/lib-dynload
100 # Executable suffix (.exe on Windows and Mac OS X)
101 EXE=            @EXEEXT@
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.
115 DIRMODE=        755
116 EXEMODE=        755
117 FILEMODE=       644
119 # configure script arguments
120 CONFIG_ARGS=    @CONFIG_ARGS@
123 # Subdirectories with code
124 SRCDIRS=        @SRCDIRS@
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)
136 LIBRARY=        @LIBRARY@
137 LDLIBRARY=      @LDLIBRARY@
138 BLDLIBRARY=     @BLDLIBRARY@
139 DLLLIBRARY=     @DLLLIBRARY@
140 LDLIBRARYDIR=   @LDLIBRARYDIR@
141 INSTSONAME=     @INSTSONAME@
144 LIBS=           @LIBS@
145 LIBM=           @LIBM@
146 LIBC=           @LIBC@
147 SYSLIBS=        $(LIBM) $(LIBC)
148 SHLIBS=         @SHLIBS@
150 MAINOBJ=        @MAINOBJ@
151 THREADOBJ=      @THREADOBJ@
152 DLINCLDIR=      @DLINCLDIR@
153 DYNLOADFILE=    @DYNLOADFILE@
154 MACHDEP_OBJS=   @MACHDEP_OBJS@
155 UNICODE_OBJS=   @UNICODE_OBJS@
157 PYTHON=         python$(EXE)
158 BUILDPYTHON=    python$(BUILDEXE)
160 # === Definitions added by makesetup ===
163 ##########################################################################
164 # Modules
165 MODULE_OBJS=    \
166                 Modules/config.o \
167                 Modules/getpath.o \
168                 Modules/main.o \
169                 Modules/gcmodule.o
171 # Used of signalmodule.o is not available
172 SIGNAL_OBJS=    @SIGNAL_OBJS@
175 ##########################################################################
176 # Grammar
177 GRAMMAR_H=      $(srcdir)/Include/graminit.h
178 GRAMMAR_C=      $(srcdir)/Python/graminit.c
179 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
182 ##########################################################################
183 # Parser
184 PGEN=           Parser/pgen$(EXE)
186 POBJS=          \
187                 Parser/acceler.o \
188                 Parser/grammar1.o \
189                 Parser/listnode.o \
190                 Parser/node.o \
191                 Parser/parser.o \
192                 Parser/parsetok.o \
193                 Parser/bitset.o \
194                 Parser/metagrammar.o
196 PARSER_OBJS=    $(POBJS) Parser/myreadline.o Parser/tokenizer.o
198 PGOBJS=         \
199                 Objects/obmalloc.o \
200                 Python/mysnprintf.o \
201                 Parser/tokenizer_pgen.o \
202                 Parser/firstsets.o \
203                 Parser/grammar.o \
204                 Parser/pgen.o \
205                 Parser/printgrammar.o \
206                 Parser/pgenmain.o
208 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
211 ##########################################################################
212 # Python
213 PYTHON_OBJS=    \
214                 Python/bltinmodule.o \
215                 Python/exceptions.o \
216                 Python/ceval.o \
217                 Python/compile.o \
218                 Python/codecs.o \
219                 Python/errors.o \
220                 Python/frozen.o \
221                 Python/frozenmain.o \
222                 Python/future.o \
223                 Python/getargs.o \
224                 Python/getcompiler.o \
225                 Python/getcopyright.o \
226                 Python/getmtime.o \
227                 Python/getplatform.o \
228                 Python/getversion.o \
229                 Python/graminit.o \
230                 Python/import.o \
231                 Python/importdl.o \
232                 Python/marshal.o \
233                 Python/modsupport.o \
234                 Python/mystrtoul.o \
235                 Python/mysnprintf.o \
236                 Python/pyfpe.o \
237                 Python/pystate.o \
238                 Python/pythonrun.o \
239                 Python/structmember.o \
240                 Python/symtable.o \
241                 Python/sysmodule.o \
242                 Python/traceback.o \
243                 Python/getopt.o \
244                 Python/$(DYNLOADFILE) \
245                 $(MACHDEP_OBJS) \
246                 $(THREADOBJ)
249 ##########################################################################
250 # Objects
251 OBJECT_OBJS=    \
252                 Objects/abstract.o \
253                 Objects/boolobject.o \
254                 Objects/bufferobject.o \
255                 Objects/cellobject.o \
256                 Objects/classobject.o \
257                 Objects/cobject.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 \
272                 Objects/object.o \
273                 Objects/obmalloc.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 \
281                 $(UNICODE_OBJS)
284 ##########################################################################
285 # objects that get linked into the Python library
286 LIBRARY_OBJS=   \
287                 Modules/getbuildinfo.o \
288                 $(PARSER_OBJS) \
289                 $(OBJECT_OBJS) \
290                 $(PYTHON_OBJS) \
291                 $(MODULE_OBJS) \
292                 $(SIGNAL_OBJS) \
293                 $(MODOBJS)
295 #########################################################################
296 # Rules
298 # Default target
299 all:            $(BUILDPYTHON) oldsharedmods sharedmods
301 # Build the interpreter
302 $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
303                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
304                         Modules/$(MAINOBJ) \
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;; \
316         esac
318 # buildno should really depend on something like LIBRARY_SRC
319 buildno: $(PARSER_OBJS) \
320                 $(OBJECT_OBJS) \
321                 $(PYTHON_OBJS) \
322                 $(MODULE_OBJS) \
323                 $(SIGNAL_OBJS) \
324                 $(MODOBJS) \
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)
334         -rm -f $@
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)
341         $(RANLIB) $@
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
351 # directory.
352 RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
353 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
354                 $(LIBRARY) \
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 \
385                                 $(MAKESETUP) \
386                                 Modules/Setup.config \
387                                 Modules/Setup \
388                                 Modules/Setup.local
389         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
390                                 -s Modules \
391                                 Modules/Setup.config \
392                                 Modules/Setup.local \
393                                 Modules/Setup
394         @mv config.c Modules
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 "-----------------------------------------------"; \
406         fi
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)
429 $(PGEN):        $(PGENOBJS)
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 ############################################################################
452 # Header files
454 PYTHON_HEADERS= \
455                 Include/Python.h \
456                 Include/abstract.h \
457                 Include/boolobject.h \
458                 Include/bufferobject.h \
459                 Include/ceval.h \
460                 Include/classobject.h \
461                 Include/cobject.h \
462                 Include/codecs.h \
463                 Include/compile.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 \
471                 Include/import.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 \
480                 Include/object.h \
481                 Include/objimpl.h \
482                 Include/patchlevel.h \
483                 Include/pydebug.h \
484                 Include/pyerrors.h \
485                 Include/pyfpe.h \
486                 Include/pymem.h \
487                 Include/pyport.h \
488                 Include/pystate.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 \
495                 Include/symtable.h \
496                 Include/sysmodule.h \
497                 Include/traceback.h \
498                 Include/tupleobject.h \
499                 Include/unicodeobject.h \
500                 Include/weakrefobject.h \
501                 pyconfig.h
503 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
506 ######################################################################
508 # Test the interpreter (twice, once without .pyc files, once with)
509 TESTOPTS=       -l
510 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
511 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
512 test:           all platform
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 \
526                 test_longexp
527 memtest:        all platform
528                 -rm -f $(srcdir)/Lib/test/*.py[co]
529                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
530                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
532 # Install everything
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`; \
547                   fi; \
548                 done
550 $(DESTSHARED):
551                 @for i in $(DESTDIRS); \
552                 do \
553                         if test ! -d $$i; then \
554                                 echo "Creating directory $$i"; \
555                                 $(INSTALL) -d -m $(DIRMODE) $$i; \
556                         else    true; \
557                         fi; \
558                 done
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); \
565         else true; \
566         fi
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"'; \
575                         exit 1; \
576                 fi; \
577         fi
578         @for i in $(BINDIR) $(LIBDIR); \
579         do \
580                 if test ! -d $$i; then \
581                         echo "Creating directory $$i"; \
582                         $(INSTALL) -d -m $(DIRMODE) $$i; \
583                 else    true; \
584                 fi; \
585         done
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); \
590                 else \
591                         $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \
592                 fi; \
593         else    true; \
594         fi
596 # Install the manual page
597 maninstall:
598         @for i in $(MANDIR) $(MANDIR)/man1; \
599         do \
600                 if test ! -d $$i; then \
601                         echo "Creating directory $$i"; \
602                         $(INSTALL) -d -m $(DIRMODE) $$i; \
603                 else    true; \
604                 fi; \
605         done
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); \
627         do \
628                 if test ! -d $$i; then \
629                         echo "Creating directory $$i"; \
630                         $(INSTALL) -d -m $(DIRMODE) $$i; \
631                 else    true; \
632                 fi; \
633         done
634         @for d in $(LIBSUBDIRS); \
635         do \
636                 a=$(srcdir)/Lib/$$d; \
637                 if test ! -d $$a; then continue; else true; fi; \
638                 b=$(LIBDEST)/$$d; \
639                 if test ! -d $$b; then \
640                         echo "Creating directory $$b"; \
641                         $(INSTALL) -d -m $(DIRMODE) $$b; \
642                 else    true; \
643                 fi; \
644         done
645         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
646         do \
647                 if test -x $$i; then \
648                         $(INSTALL_SCRIPT) $$i $(LIBDEST); \
649                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
650                 else \
651                         $(INSTALL_DATA) $$i $(LIBDEST); \
652                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
653                 fi; \
654         done
655         @for d in $(LIBSUBDIRS); \
656         do \
657                 a=$(srcdir)/Lib/$$d; \
658                 if test ! -d $$a; then continue; else true; fi; \
659                 b=$(LIBDEST)/$$d; \
660                 for i in $$a/*; \
661                 do \
662                         case $$i in \
663                         *CVS) ;; \
664                         *.py[co]) ;; \
665                         *.orig) ;; \
666                         *~) ;; \
667                         *) \
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; \
672                                 else \
673                                     echo $(INSTALL_DATA) $$i $$b; \
674                                     $(INSTALL_DATA) $$i $$b; \
675                                 fi;; \
676                         esac; \
677                 done; \
678         done
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)
699 inclinstall:
700         @for i in $(INCLDIRSTOMAKE); \
701         do \
702                 if test ! -d $$i; then \
703                         echo "Creating directory $$i"; \
704                         $(INSTALL) -d -m $(DIRMODE) $$i; \
705                 else    true; \
706                 fi; \
707         done
708         @for i in $(srcdir)/Include/*.h; \
709         do \
710                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
711                 $(INSTALL_DATA) $$i $(INCLUDEPY); \
712         done
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
718 libainstall:    all
719         @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
720         do \
721                 if test ! -d $$i; then \
722                         echo "Creating directory $$i"; \
723                         $(INSTALL) -d -m $(DIRMODE) $$i; \
724                 else    true; \
725                 fi; \
726         done
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) ; \
731                         else \
732                                 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
733                                 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
734                         fi; \
735                 else \
736                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
737                 fi; \
738         fi
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.";   \
761         else true; \
762         fi
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.";  \
772                 ;; \
773         esac
775 # Install the dynamically loadable modules
776 # This goes into $(exec_prefix)
777 sharedinstall:
778         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
779                 --prefix=$(prefix) \
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; \
802                 exit 1; \
803         else true; \
804         fi
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; \
809                 else    true; \
810                 fi; \
811         done
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)/../..
838 # This installs IDLE
839 idleinstall:
840         SRCDIR=$(srcdir) \
841         ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install \
842         --check-tkinter \
843         --prefix=$(prefix) \
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
859 .c.o:
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
864 recheck:
865         $(SHELL) config.status --recheck
866         $(SHELL) config.status
868 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
869 autoconf:
870         (cd $(srcdir); autoconf)
871         (cd $(srcdir); autoheader)
873 # Create a tags file for vi
874 tags::
875         cd $(srcdir); \
876         ctags -w -t Include/*.h; \
877         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
878         done; \
879         sort -o tags tags
881 # Create a tags file for GNU Emacs
882 TAGS::
883         cd $(srcdir); \
884         etags Include/*.h; \
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
890 clean:
891         find . -name '*.o' -exec rm -f {} ';'
892         find . -name '*.s[ol]' -exec rm -f {} ';'
893         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
895 clobber: clean
896         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
897                 tags TAGS \
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]
903 distclean: clobber
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' ')' \
910                            -exec rm -f {} ';'
912 # Check for smelly exported symbols (not starting with Py/_Py)
913 smelly: all
914         nm -p $(LIBRARY) | \
915                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
917 # Find files with funny names
918 funny:
919         find $(DISTDIRS) -type d \
920                 -o -name '*.[chs]' \
921                 -o -name '*.py' \
922                 -o -name '*.doc' \
923                 -o -name '*.sty' \
924                 -o -name '*.bib' \
925                 -o -name '*.dat' \
926                 -o -name '*.el' \
927                 -o -name '*.fd' \
928                 -o -name '*.in' \
929                 -o -name '*.tex' \
930                 -o -name '*,[vpt]' \
931                 -o -name 'Setup' \
932                 -o -name 'Setup.*' \
933                 -o -name README \
934                 -o -name Makefile \
935                 -o -name ChangeLog \
936                 -o -name Repository \
937                 -o -name Root \
938                 -o -name Entries \
939                 -o -name Tag \
940                 -o -name tags \
941                 -o -name TAGS \
942                 -o -name .cvsignore \
943                 -o -name MANIFEST \
944                 -o -print
946 # Dependencies
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