Fix three PyChecker-detected gotchas.
[python/dscho.git] / Makefile.pre.in
blobf81702b4509d9163181fff86f056a4c5be8b0149
1 # Top-level Makefile for Python
2
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:
8
9 #       ./configure
10 #       make
11 #       make test
12 #       make install
13
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.
18
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 DEFS=           @DEFS@
58 CFLAGS=         $(OPT) -I. -I$(srcdir)/Include $(DEFS)
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) $(CFLAGSFORSHARED)
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=         $(prefix)/man
83 INCLUDEDIR=     $(prefix)/include
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@
103 # Modes for directories, executables and data files created by the
104 # install process.  Default to user-only-writable for all file types.
105 DIRMODE=        755
106 EXEMODE=        755
107 FILEMODE=       644
109 # configure script arguments
110 CONFIG_ARGS=    @CONFIG_ARGS@
113 # Subdirectories with code
114 SRCDIRS=        @SRCDIRS@
116 # Other subdirectories
117 SUBDIRSTOO=     Include Lib Misc Demo
119 # Files and directories to be distributed
120 CONFIGFILES=    configure configure.in acconfig.h config.h.in Makefile.pre.in
121 DISTFILES=      README ChangeLog $(CONFIGFILES)
122 DISTDIRS=       $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
123 DIST=           $(DISTFILES) $(DISTDIRS)
126 LIBRARY=        @LIBRARY@
127 LDLIBRARY=      @LDLIBRARY@
128 DLLLIBRARY=     @DLLLIBRARY@
131 LIBS=           @LIBS@
132 LIBM=           @LIBM@
133 LIBC=           @LIBC@
134 SYSLIBS=        $(LIBM) $(LIBC)
136 MAINOBJ=        @MAINOBJ@
137 LIBOBJS=        @LIBOBJS@
138 DLINCLDIR=      @DLINCLDIR@
139 DYNLOADFILE=    @DYNLOADFILE@
141 PYTHON=         python$(EXE)
143 # === Definitions added by makesetup ===
146 ##########################################################################
147 # Modules
148 MODULE_OBJS=    \
149                 Modules/config.o \
150                 Modules/getpath.o \
151                 Modules/main.o
153 # Used of signalmodule.o is not available
154 SIGNAL_OBJS=    @SIGNAL_OBJS@
157 ##########################################################################
158 # Grammar
159 GRAMMAR_H=      $(srcdir)/Include/graminit.h
160 GRAMMAR_C=      $(srcdir)/Python/graminit.c
161 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
164 ##########################################################################
165 # Parser
166 PGEN=           Parser/pgen$(EXE)
168 POBJS=          \
169                 Parser/acceler.o \
170                 Parser/grammar1.o \
171                 Parser/listnode.o \
172                 Parser/node.o \
173                 Parser/parser.o \
174                 Parser/parsetok.o \
175                 Parser/tokenizer.o \
176                 Parser/bitset.o \
177                 Parser/metagrammar.o
179 PARSER_OBJS=    $(POBJS) Parser/myreadline.o
181 PGOBJS=         \
182                 Parser/firstsets.o \
183                 Parser/grammar.o \
184                 Parser/pgen.o \
185                 Parser/printgrammar.o \
186                 Parser/pgenmain.o
188 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
191 ##########################################################################
192 # Python
193 PYTHON_OBJS=    \
194                 Python/bltinmodule.o \
195                 Python/exceptions.o \
196                 Python/ceval.o \
197                 Python/compile.o \
198                 Python/codecs.o \
199                 Python/errors.o \
200                 Python/frozen.o \
201                 Python/frozenmain.o \
202                 Python/future.o \
203                 Python/getargs.o \
204                 Python/getcompiler.o \
205                 Python/getcopyright.o \
206                 Python/getmtime.o \
207                 Python/getplatform.o \
208                 Python/getversion.o \
209                 Python/graminit.o \
210                 Python/import.o \
211                 Python/importdl.o \
212                 Python/marshal.o \
213                 Python/modsupport.o \
214                 Python/mystrtoul.o \
215                 Python/pyfpe.o \
216                 Python/pystate.o \
217                 Python/pythonrun.o \
218                 Python/structmember.o \
219                 Python/symtable.o \
220                 Python/sysmodule.o \
221                 Python/traceback.o \
222                 Python/getopt.o \
223                 Python/$(DYNLOADFILE) \
224                 $(LIBOBJS)
227 ##########################################################################
228 # Objects
229 OBJECT_OBJS=    \
230                 Objects/abstract.o \
231                 Objects/bufferobject.o \
232                 Objects/cellobject.o \
233                 Objects/classobject.o \
234                 Objects/cobject.o \
235                 Objects/complexobject.o \
236                 Objects/fileobject.o \
237                 Objects/floatobject.o \
238                 Objects/frameobject.o \
239                 Objects/funcobject.o \
240                 Objects/intobject.o \
241                 Objects/listobject.o \
242                 Objects/longobject.o \
243                 Objects/dictobject.o \
244                 Objects/methodobject.o \
245                 Objects/moduleobject.o \
246                 Objects/object.o \
247                 Objects/rangeobject.o \
248                 Objects/sliceobject.o \
249                 Objects/stringobject.o \
250                 Objects/tupleobject.o \
251                 Objects/typeobject.o \
252                 Objects/unicodeobject.o \
253                 Objects/unicodectype.o
256 ##########################################################################
257 # objects that get linked into the Python library
258 LIBRARY_OBJS=   \
259                 Modules/getbuildinfo.o \
260                 $(PARSER_OBJS) \
261                 $(OBJECT_OBJS) \
262                 $(PYTHON_OBJS) \
263                 $(MODULE_OBJS) \
264                 $(SIGNAL_OBJS) \
265                 $(MODOBJS)
267 #########################################################################
268 # Rules
270 # Default target
271 all:            $(PYTHON) oldsharedmods sharedmods 
273 # Build the interpreter
274 $(PYTHON):      Modules/$(MAINOBJ) $(LDLIBRARY)
275                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
276                         Modules/$(MAINOBJ) \
277                         $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
279 platform: $(PYTHON)
280         ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
283 # Build the shared modules
284 sharedmods: $(PYTHON)
285         PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
287 # buildno should really depend on something like LIBRARY_SRC
288 buildno: $(PARSER_OBJS) \
289                 $(OBJECT_OBJS) \
290                 $(PYTHON_OBJS) \
291                 $(MODULE_OBJS) \
292                 $(SIGNAL_OBJS) \
293                 $(MODOBJS) \
294                 $(srcdir)/Modules/getbuildinfo.c
295         if test -f buildno; then \
296                 expr `cat buildno` + 1 >buildno1; \
297                 mv -f buildno1 buildno; \
298         else echo 1 >buildno; fi
300 # Build static library
301 # avoid long command lines, same as LIBRARY_OBJS
302 $(LIBRARY): $(LIBRARY_OBJS)
303         -rm -f $@
304         $(AR) cr $@ Modules/getbuildinfo.o
305         $(AR) cr $@ $(PARSER_OBJS)
306         $(AR) cr $@ $(OBJECT_OBJS)
307         $(AR) cr $@ $(PYTHON_OBJS)
308         $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
309         $(AR) cr $@ $(MODOBJS)
310         $(RANLIB) $@
312 # This rule is only here for DG/UX, UnixWare, and BeOS!!!
313 libpython$(VERSION).so: $(LIBRARY)
314         case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
315         *dgux*) \
316             test -d dgux || mkdir dgux; \
317             (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
318             /bin/rm -rf ./dgux \
319             ;; \
320         unixware*) \
321             $(LDSHARED) -o $@ $(LIBRARY_OBJS) \
322             ;; \
323         beos) \
324             $(AR) so $(LIBRARY) $@ \
325             ;; \
326         esac
328 # This rule is here for OPENSTEP/Rhapsody/MacOSX
329 libpython$(VERSION).dylib: $(LIBRARY)
330         libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
331                 -framework System @LIBTOOL_CRUFT@ 
333 # This rule builds the Cygwin Python DLL
334 libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
335         dlltool --export-all --output-def $@ $^
336         $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
337                 $(LIBS) $(MODLIBS) $(SYSLIBS)
340 oldsharedmods: $(SHAREDMODS)
343 Makefile Modules/config.c: Makefile.pre \
344                                 $(srcdir)/Modules/config.c.in \
345                                 $(MAKESETUP) \
346                                 Modules/Setup.config \
347                                 Modules/Setup \
348                                 Modules/Setup.local
349         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
350                                 -s Modules \
351                                 Modules/Setup.config \
352                                 Modules/Setup.local \
353                                 Modules/Setup
354         @mv config.c Modules
355         @echo "The Makefile was updated, you may need to re-run make."
358 Modules/Setup: $(srcdir)/Modules/Setup.dist
359         @if test -f Modules/Setup; then \
360                 echo "-----------------------------------------------"; \
361                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
362                 echo "check to make sure you have all the updates you"; \
363                 echo "need in your Modules/Setup file."; \
364                 echo "-----------------------------------------------"; \
365         fi
367 ############################################################################
368 # Special rules for object files
370 Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
371         $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
373 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
374         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
375                 -DPREFIX='"$(prefix)"' \
376                 -DEXEC_PREFIX='"$(exec_prefix)"' \
377                 -DVERSION='"$(VERSION)"' \
378                 -DVPATH='"$(VPATH)"' \
379                 -o $@ $(srcdir)/Modules/getpath.c
381 Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
382         $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
385 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
386                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
388 $(PGEN):        $(PGENOBJS)
389                 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
391 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
392                                 $(srcdir)/Parser/assert.h \
393                                 $(srcdir)/Include/token.h \
394                                 $(srcdir)/Include/grammar.h
395 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
398 Python/compile.o Python/symtable.o: $(GRAMMAR_H)
400 Python/getplatform.o: $(srcdir)/Python/getplatform.c
401                 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
403 Python/importdl.o: $(srcdir)/Python/importdl.c
404                 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
406 Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
408 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
409                                 $(srcdir)/Objects/unicodetype_db.h
412 ############################################################################
413 # Header files
415 PYTHON_HEADERS= \
416                 Include/Python.h \
417                 config.h \
418                 Include/patchlevel.h \
419                 Include/pyport.h \
420                 Include/pymem.h \
421                 Include/object.h \
422                 Include/objimpl.h \
423                 Include/compile.h \
424                 Include/symtable.h \
425                 Include/pydebug.h \
426                 Include/unicodeobject.h \
427                 Include/intobject.h \
428                 Include/longobject.h \
429                 Include/floatobject.h \
430                 Include/complexobject.h \
431                 Include/rangeobject.h \
432                 Include/stringobject.h \
433                 Include/bufferobject.h \
434                 Include/tupleobject.h \
435                 Include/listobject.h \
436                 Include/dictobject.h \
437                 Include/methodobject.h \
438                 Include/moduleobject.h \
439                 Include/funcobject.h \
440                 Include/classobject.h \
441                 Include/fileobject.h \
442                 Include/cobject.h \
443                 Include/traceback.h \
444                 Include/sliceobject.h \
445                 Include/codecs.h \
446                 Include/pyerrors.h \
447                 Include/pystate.h \
448                 Include/modsupport.h \
449                 Include/ceval.h \
450                 Include/pythonrun.h \
451                 Include/sysmodule.h \
452                 Include/intrcheck.h \
453                 Include/import.h \
454                 Include/abstract.h \
455                 Include/pyfpe.h
457 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
460 ######################################################################
462 # Test the interpreter (twice, once without .pyc files, once with)
463 TESTOPTS=       -l
464 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
465 TESTPYTHON=     ./$(PYTHON) -tt
466 test:           all platform
467                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
468                 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
469                 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
471 QUICKTESTOPTS=  $(TESTOPTS) -x test_thread test_signal test_strftime \
472                 test_unicodedata test_re test_sre test_select test_poll \
473                 test_linuxaudiodev test_sunaudiodev
474 quicktest:      all platform
475                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
476                 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
477                 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
479 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
480                 test_longexp
481 memtest:        all platform
482                 -rm -f $(srcdir)/Lib/test/*.py[co]
483                 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
484                 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
486 # Install everything
487 install:        altinstall bininstall maninstall
489 # Install almost everything without disturbing previous versions
490 altinstall:     altbininstall libinstall inclinstall libainstall \
491                 sharedinstall oldsharedinstall 
493 # Install shared libraries enabled by Setup
494 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
496 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
497                 @for i in X $(SHAREDMODS); do \
498                   if test $$i != X; then \
499                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
500                     $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
501                   fi; \
502                 done
504 $(DESTSHARED): 
505                 @for i in $(DESTDIRS); \
506                 do \
507                         if test ! -d $$i; then \
508                                 echo "Creating directory $$i"; \
509                                 $(INSTALL) -d -m $(DIRMODE) $$i; \
510                         else    true; \
511                         fi; \
512                 done
515 # Install the interpreter (by creating a hard link to python$(VERSION))
516 bininstall:     altbininstall
517         -if test -f $(BINDIR)/$(PYTHON); \
518         then rm -f $(BINDIR)/$(PYTHON); \
519         else true; \
520         fi
521         (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
523 # Install the interpreter with $(VERSION) affixed
524 # This goes into $(exec_prefix)
525 altbininstall:  $(PYTHON)
526         @for i in $(BINDIR); \
527         do \
528                 if test ! -d $$i; then \
529                         echo "Creating directory $$i"; \
530                         $(INSTALL) -d -m $(DIRMODE) $$i; \
531                 else    true; \
532                 fi; \
533         done
534         $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
535         if test -f libpython$(VERSION).so; then \
536                 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
537         else    true; \
538         fi
539         if test -f "$(DLLLIBRARY)"; then \
540                 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
541         else    true; \
542         fi
544 # Install the manual page
545 maninstall:
546         @for i in $(MANDIR) $(MANDIR)/man1; \
547         do \
548                 if test ! -d $$i; then \
549                         echo "Creating directory $$i"; \
550                         $(INSTALL) -d -m $(DIRMODE) $$i; \
551                 else    true; \
552                 fi; \
553         done
554         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
555                 $(MANDIR)/man1/python.1
557 # Install the library
558 PLATDIR=        plat-$(MACHDEP)
559 MACHDEPS=       $(PLATDIR)
560 XMLLIBSUBDIRS=  xml xml/dom xml/parsers xml/sax
561 LIBSUBDIRS=     lib-old lib-tk site-packages test test/output encodings \
562                 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
563 libinstall:     $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
564         @for i in $(SCRIPTDIR) $(LIBDEST); \
565         do \
566                 if test ! -d $$i; then \
567                         echo "Creating directory $$i"; \
568                         $(INSTALL) -d -m $(DIRMODE) $$i; \
569                 else    true; \
570                 fi; \
571         done
572         @for d in $(LIBSUBDIRS); \
573         do \
574                 a=$(srcdir)/Lib/$$d; \
575                 if test ! -d $$a; then continue; else true; fi; \
576                 b=$(LIBDEST)/$$d; \
577                 if test ! -d $$b; then \
578                         echo "Creating directory $$b"; \
579                         $(INSTALL) -d -m $(DIRMODE) $$b; \
580                 else    true; \
581                 fi; \
582         done
583         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
584         do \
585                 if test -x $$i; then \
586                         $(INSTALL_SCRIPT) $$i $(LIBDEST); \
587                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
588                 else \
589                         $(INSTALL_DATA) $$i $(LIBDEST); \
590                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
591                 fi; \
592         done
593         @for d in $(LIBSUBDIRS); \
594         do \
595                 a=$(srcdir)/Lib/$$d; \
596                 if test ! -d $$a; then continue; else true; fi; \
597                 b=$(LIBDEST)/$$d; \
598                 for i in $$a/*; \
599                 do \
600                         case $$i in \
601                         *CVS) ;; \
602                         *.py[co]) ;; \
603                         *.orig) ;; \
604                         *~) ;; \
605                         *) \
606                                 if test -d $$i; then continue; fi; \
607                                 if test -x $$i; then \
608                                     echo $(INSTALL_SCRIPT) $$i $$b; \
609                                     $(INSTALL_SCRIPT) $$i $$b; \
610                                 else \
611                                     echo $(INSTALL_DATA) $$i $$b; \
612                                     $(INSTALL_DATA) $$i $$b; \
613                                 fi;; \
614                         esac; \
615                 done; \
616         done
617         $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
618         PYTHONPATH=$(LIBDEST) \
619                 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
620         PYTHONPATH=$(LIBDEST) \
621                 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
623 # Create the PLATDIR source directory, if one wasn't distributed..
624 $(srcdir)/Lib/$(PLATDIR):
625         mkdir $(srcdir)/Lib/$(PLATDIR)
626         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
627         export PATH; PATH="`pwd`:$$PATH"; \
628         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
629         export EXE; EXE="$(EXE)"; \
630         cd $(srcdir)/Lib/$(PLATDIR); ./regen
632 # Install the include files
633 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
634 inclinstall:
635         @for i in $(INCLDIRSTOMAKE); \
636         do \
637                 if test ! -d $$i; then \
638                         echo "Creating directory $$i"; \
639                         $(INSTALL) -d -m $(DIRMODE) $$i; \
640                 else    true; \
641                 fi; \
642         done
643         @for i in $(srcdir)/Include/*.h; \
644         do \
645                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
646                 $(INSTALL_DATA) $$i $(INCLUDEPY); \
647         done
648         $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
650 # Install the library and miscellaneous stuff needed for extending/embedding
651 # This goes into $(exec_prefix)
652 LIBPL=          $(LIBP)/config
653 libainstall:    all
654         @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
655         do \
656                 if test ! -d $$i; then \
657                         echo "Creating directory $$i"; \
658                         $(INSTALL) -d -m $(DIRMODE) $$i; \
659                 else    true; \
660                 fi; \
661         done
662         @if test -d $(LDLIBRARY); then :; else \
663                 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
664                 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
665         fi
666         $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
667         $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
668         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
669         $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
670         $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
671         $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
672         $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
673         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
674         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
675         $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
676         @if [ -s Modules/python.exp -a \
677                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
678                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
679                 $(INSTALL_DATA) Modules/python.exp              \
680                                 $(LIBPL)/python.exp;            \
681                 echo; echo "$(LIBPL)/python.exp";               \
682                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
683                                 $(LIBPL)/makexp_aix;            \
684                 echo "$(LIBPL)/makexp_aix";                     \
685                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
686                                 $(LIBPL)/ld_so_aix;             \
687                 echo "$(LIBPL)/ld_so_aix";                      \
688                 echo; echo "See Misc/AIX-NOTES for details.";   \
689         else true; \
690         fi
691         @case "$(MACHDEP)" in beos*) \
692                 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
693                 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README;        \
694                 echo; echo "$(LIBPL)/README";                   \
695                 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
696                 echo "$(LIBPL)/ar_beos";                        \
697                 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
698                 echo "$(LIBPL)/ld_so_beos";                     \
699                 echo; echo "See Misc/BeOS-NOTES for details.";  \
700                 ;; \
701         esac
703 # Install the dynamically loadable modules
704 # This goes into $(exec_prefix)
705 sharedinstall:
706         PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py install \
707                 --install-platlib=$(DESTSHARED)
709 # Build the toplevel Makefile
710 Makefile.pre: Makefile.pre.in config.status
711         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
712         $(MAKE) -f Makefile.pre Makefile
714 # Run the configure script.
715 config.status:  $(srcdir)/configure
716         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
718 .PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
720 # Some make's put the object file in the current directory
721 .c.o:
722         $(CC) -c $(PY_CFLAGS) -o $@ $<
724 # Rerun configure with the same options as it was run last time,
725 # provided the config.status script exists
726 recheck:
727         $(SHELL) config.status --recheck
728         $(SHELL) config.status
730 # Rebuild the configure script from configure.in; also rebuild config.h.in
731 autoconf:
732         (cd $(srcdir); autoconf)
733         (cd $(srcdir); autoheader)
735 # Create a tags file for vi
736 tags::
737         cd $(srcdir); \
738         ctags -w -t Include/*.h; \
739         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
740         done; \
741         sort tags -o tags
743 # Create a tags file for GNU Emacs
744 TAGS::
745         cd $(srcdir); \
746         etags Include/*.h; \
747         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
749 # Sanitation targets -- clean leaves libraries, executables and tags
750 # files, which clobber removes those as well
752 clean:
753         find . -name '*.o' -exec rm -f {} ';'
754         find . -name '*.s[ol]' -exec rm -f {} ';'
755         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
757 clobber: clean
758         -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
759                 tags TAGS \
760                 config.cache config.log config.h Modules/config.c 
761         -rm -rf build
763 # Make things extra clean, before making a distribution:
764 # remove all generated files, even Makefile[.pre]
765 distclean: clobber
766         -rm -f core Makefile Makefile.pre buildno config.status \
767                 Modules/Setup Modules/Setup.local Modules/Setup.config
768         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
769                            -o -name '[@,#]*' -o -name '*.old' \
770                            -o -name '*.orig' -o -name '*.rej' \
771                            -o -name '*.bak' ')' \
772                            -exec rm -f {} ';'
774 # Check for smelly exported symbols (not starting with Py/_Py)
775 smelly: all
776         nm -p $(LIBRARY) | \
777                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
779 # Find files with funny names
780 funny:
781         find $(DISTDIRS) -type d \
782                 -o -name '*.[chs]' \
783                 -o -name '*.py' \
784                 -o -name '*.doc' \
785                 -o -name '*.sty' \
786                 -o -name '*.bib' \
787                 -o -name '*.dat' \
788                 -o -name '*.el' \
789                 -o -name '*.fd' \
790                 -o -name '*.in' \
791                 -o -name '*.tex' \
792                 -o -name '*,[vpt]' \
793                 -o -name 'Setup' \
794                 -o -name 'Setup.*' \
795                 -o -name README \
796                 -o -name Makefile \
797                 -o -name ChangeLog \
798                 -o -name Repository \
799                 -o -name Root \
800                 -o -name Entries \
801                 -o -name Tag \
802                 -o -name tags \
803                 -o -name TAGS \
804                 -o -name .cvsignore \
805                 -o -name MANIFEST \
806                 -o -print
808 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY