Fix off-by-one error that resulted in missed characters
[pytest.git] / Makefile.pre.in
blob3cd9c678cd1ba7fa52114d2060f325e504634b1e
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 MAINCC=         @MAINCC@
34 LINKCC=         @LINKCC@
35 AR=             @AR@
36 RANLIB=         @RANLIB@
37 SVNVERSION=     @SVNVERSION@
39 # Shell used by make (some versions default to the login shell, which is bad)
40 SHELL=          /bin/sh
42 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
43 LN=             @LN@
45 # Portable install script (configure doesn't always guess right)
46 INSTALL=        @INSTALL@
47 INSTALL_PROGRAM=@INSTALL_PROGRAM@
48 INSTALL_SCRIPT= @INSTALL_SCRIPT@
49 INSTALL_DATA=   @INSTALL_DATA@
50 # Shared libraries must be installed with executable mode on some systems;
51 # rather than figuring out exactly which, we always give them executable mode.
52 # Also, making them read-only seems to be a good idea...
53 INSTALL_SHARED= ${INSTALL} -m 555
55 MAKESETUP=      $(srcdir)/Modules/makesetup
57 # Compiler options
58 OPT=            @OPT@
59 BASECFLAGS=     @BASECFLAGS@
60 CFLAGS=         $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
61 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
62 # be able to build extension modules using the directories specified in the
63 # environment variables
64 CPPFLAGS=       -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
65 LDFLAGS=        @LDFLAGS@
66 LDLAST=         @LDLAST@
67 SGI_ABI=        @SGI_ABI@
68 CCSHARED=       @CCSHARED@
69 LINKFORSHARED=  @LINKFORSHARED@
70 # Extra C flags added for building the interpreter object files.
71 CFLAGSFORSHARED=@CFLAGSFORSHARED@
72 # C flags used for building the interpreter object files
73 PY_CFLAGS=      $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
76 # Machine-dependent subdirectories
77 MACHDEP=        @MACHDEP@
79 # Install prefix for architecture-independent files
80 prefix=         @prefix@
82 # Install prefix for architecture-dependent files
83 exec_prefix=    @exec_prefix@
85 # Install prefix for data files
86 datarootdir=    @datarootdir@
88 # Expanded directories
89 BINDIR=         $(exec_prefix)/bin
90 LIBDIR=         $(exec_prefix)/lib
91 MANDIR=         @mandir@
92 INCLUDEDIR=     @includedir@
93 CONFINCLUDEDIR= $(exec_prefix)/include
94 SCRIPTDIR=      $(prefix)/lib
96 # Detailed destination directories
97 BINLIBDEST=     $(LIBDIR)/python$(VERSION)
98 LIBDEST=        $(SCRIPTDIR)/python$(VERSION)
99 INCLUDEPY=      $(INCLUDEDIR)/python$(VERSION)
100 CONFINCLUDEPY=  $(CONFINCLUDEDIR)/python$(VERSION)
101 LIBP=           $(LIBDIR)/python$(VERSION)
103 # Symbols used for using shared libraries
104 SO=             @SO@
105 LDSHARED=       @LDSHARED@
106 BLDSHARED=      @BLDSHARED@
107 DESTSHARED=     $(BINLIBDEST)/lib-dynload
109 # Executable suffix (.exe on Windows and Mac OS X)
110 EXE=            @EXEEXT@
111 BUILDEXE=       @BUILDEXEEXT@
113 # Short name and location for Mac OS X Python framework
114 UNIVERSALSDK=@UNIVERSALSDK@
115 PYTHONFRAMEWORK=        @PYTHONFRAMEWORK@
116 PYTHONFRAMEWORKDIR=     @PYTHONFRAMEWORKDIR@
117 PYTHONFRAMEWORKPREFIX=  @PYTHONFRAMEWORKPREFIX@
118 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
119 # Deployment target selected during configure, to be checked
120 # by distutils. The export statement is needed to ensure that the
121 # deployment target is active during build.
122 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
123 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
125 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
126 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
128 # Environment to run shared python without installed libraries
129 RUNSHARED=       @RUNSHARED@
131 # Modes for directories, executables and data files created by the
132 # install process.  Default to user-only-writable for all file types.
133 DIRMODE=        755
134 EXEMODE=        755
135 FILEMODE=       644
137 # configure script arguments
138 CONFIG_ARGS=    @CONFIG_ARGS@
141 # Subdirectories with code
142 SRCDIRS=        @SRCDIRS@
144 # Other subdirectories
145 SUBDIRSTOO=     Include Lib Misc Demo
147 # Files and directories to be distributed
148 CONFIGFILES=    configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
149 DISTFILES=      README ChangeLog $(CONFIGFILES)
150 DISTDIRS=       $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
151 DIST=           $(DISTFILES) $(DISTDIRS)
154 LIBRARY=        @LIBRARY@
155 LDLIBRARY=      @LDLIBRARY@
156 BLDLIBRARY=     @BLDLIBRARY@
157 DLLLIBRARY=     @DLLLIBRARY@
158 LDLIBRARYDIR=   @LDLIBRARYDIR@
159 INSTSONAME=     @INSTSONAME@
162 LIBS=           @LIBS@
163 LIBM=           @LIBM@
164 LIBC=           @LIBC@
165 SYSLIBS=        $(LIBM) $(LIBC)
166 SHLIBS=         @SHLIBS@
168 THREADOBJ=      @THREADOBJ@
169 DLINCLDIR=      @DLINCLDIR@
170 DYNLOADFILE=    @DYNLOADFILE@
171 MACHDEP_OBJS=   @MACHDEP_OBJS@
172 UNICODE_OBJS=   @UNICODE_OBJS@
174 PYTHON=         python$(EXE)
175 BUILDPYTHON=    python$(BUILDEXE)
177 # === Definitions added by makesetup ===
180 ##########################################################################
181 # Modules
182 MODULE_OBJS=    \
183                 Modules/config.o \
184                 Modules/getpath.o \
185                 Modules/main.o \
186                 Modules/gcmodule.o
188 # Used of signalmodule.o is not available
189 SIGNAL_OBJS=    @SIGNAL_OBJS@
192 ##########################################################################
193 # Grammar
194 GRAMMAR_H=      $(srcdir)/Include/graminit.h
195 GRAMMAR_C=      $(srcdir)/Python/graminit.c
196 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
199 ##########################################################################
200 # Parser
201 PGEN=           Parser/pgen$(EXE)
203 POBJS=          \
204                 Parser/acceler.o \
205                 Parser/grammar1.o \
206                 Parser/listnode.o \
207                 Parser/node.o \
208                 Parser/parser.o \
209                 Parser/parsetok.o \
210                 Parser/bitset.o \
211                 Parser/metagrammar.o \
212                 Parser/firstsets.o \
213                 Parser/grammar.o \
214                 Parser/pgen.o
216 PARSER_OBJS=    $(POBJS) Parser/myreadline.o Parser/tokenizer.o
218 PGOBJS=         \
219                 Objects/obmalloc.o \
220                 Python/mysnprintf.o \
221                 Parser/tokenizer_pgen.o \
222                 Parser/printgrammar.o \
223                 Parser/pgenmain.o
225 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
227 ##########################################################################
228 # AST
229 AST_H_DIR=      $(srcdir)/Include
230 AST_H=          $(AST_H_DIR)/Python-ast.h
231 AST_C_DIR=      $(srcdir)/Python
232 AST_C=          $(AST_C_DIR)/Python-ast.c
233 AST_ASDL=       $(srcdir)/Parser/Python.asdl
235 ASDLGEN_FILES=  $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
236 # XXX Note that a build now requires Python exist before the build starts
237 ASDLGEN=        $(srcdir)/Parser/asdl_c.py
239 ##########################################################################
240 # Python
241 PYTHON_OBJS=    \
242                 Python/Python-ast.o \
243                 Python/asdl.o \
244                 Python/ast.o \
245                 Python/bltinmodule.o \
246                 Python/ceval.o \
247                 Python/compile.o \
248                 Python/codecs.o \
249                 Python/errors.o \
250                 Python/frozen.o \
251                 Python/frozenmain.o \
252                 Python/future.o \
253                 Python/getargs.o \
254                 Python/getcompiler.o \
255                 Python/getcopyright.o \
256                 Python/getmtime.o \
257                 Python/getplatform.o \
258                 Python/getversion.o \
259                 Python/graminit.o \
260                 Python/import.o \
261                 Python/importdl.o \
262                 Python/marshal.o \
263                 Python/modsupport.o \
264                 Python/mystrtoul.o \
265                 Python/mysnprintf.o \
266                 Python/pyarena.o \
267                 Python/pyfpe.o \
268                 Python/pystate.o \
269                 Python/pythonrun.o \
270                 Python/structmember.o \
271                 Python/symtable.o \
272                 Python/sysmodule.o \
273                 Python/traceback.o \
274                 Python/getopt.o \
275                 Python/pystrtod.o \
276                 Python/$(DYNLOADFILE) \
277                 $(MACHDEP_OBJS) \
278                 $(THREADOBJ)
281 ##########################################################################
282 # Objects
283 OBJECT_OBJS=    \
284                 Objects/abstract.o \
285                 Objects/boolobject.o \
286                 Objects/bufferobject.o \
287                 Objects/cellobject.o \
288                 Objects/classobject.o \
289                 Objects/cobject.o \
290                 Objects/codeobject.o \
291                 Objects/complexobject.o \
292                 Objects/descrobject.o \
293                 Objects/enumobject.o \
294                 Objects/exceptions.o \
295                 Objects/genobject.o \
296                 Objects/fileobject.o \
297                 Objects/floatobject.o \
298                 Objects/frameobject.o \
299                 Objects/funcobject.o \
300                 Objects/intobject.o \
301                 Objects/iterobject.o \
302                 Objects/listobject.o \
303                 Objects/longobject.o \
304                 Objects/dictobject.o \
305                 Objects/methodobject.o \
306                 Objects/moduleobject.o \
307                 Objects/object.o \
308                 Objects/obmalloc.o \
309                 Objects/rangeobject.o \
310                 Objects/setobject.o \
311                 Objects/sliceobject.o \
312                 Objects/stringobject.o \
313                 Objects/structseq.o \
314                 Objects/tupleobject.o \
315                 Objects/typeobject.o \
316                 Objects/weakrefobject.o \
317                 $(UNICODE_OBJS)
320 ##########################################################################
321 # objects that get linked into the Python library
322 LIBRARY_OBJS=   \
323                 Modules/_typesmodule.o \
324                 Modules/getbuildinfo.o \
325                 $(PARSER_OBJS) \
326                 $(OBJECT_OBJS) \
327                 $(PYTHON_OBJS) \
328                 $(MODULE_OBJS) \
329                 $(SIGNAL_OBJS) \
330                 $(MODOBJS)
332 #########################################################################
333 # Rules
335 # Default target
336 all:            $(BUILDPYTHON) oldsharedmods sharedmods
338 # Build the interpreter
339 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
340                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
341                         Modules/python.o \
342                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
344 platform: $(BUILDPYTHON)
345         $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
348 # Build the shared modules
349 sharedmods: $(BUILDPYTHON)
350         case $$MAKEFLAGS in \
351         *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
352         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
353         esac
355 # Build static library
356 # avoid long command lines, same as LIBRARY_OBJS
357 $(LIBRARY): $(LIBRARY_OBJS)
358         -rm -f $@
359         $(AR) cr $@ Modules/getbuildinfo.o
360         $(AR) cr $@ Modules/_typesmodule.o
361         $(AR) cr $@ $(PARSER_OBJS)
362         $(AR) cr $@ $(OBJECT_OBJS)
363         $(AR) cr $@ $(PYTHON_OBJS)
364         $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
365         $(AR) cr $@ $(MODOBJS)
366         $(RANLIB) $@
368 libpython$(VERSION).so: $(LIBRARY_OBJS)
369         if test $(INSTSONAME) != $(LDLIBRARY); then \
370                 $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
371                 $(LN) -f $(INSTSONAME) $@; \
372         else\
373                 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
374         fi
376 libpython$(VERSION).sl: $(LIBRARY_OBJS)
377         $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
379 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
380 # minimal framework (not including the Lib directory and such) in the current
381 # directory.
382 RESSRCDIR=$(srcdir)/Mac/Resources/framework
383 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
384                 $(LIBRARY) \
385                 $(RESSRCDIR)/Info.plist \
386                 $(RESSRCDIR)/version.plist \
387                 $(RESSRCDIR)/English.lproj/InfoPlist.strings
388         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
389         if test "${UNIVERSALSDK}"; then \
390                 $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
391                         -isysroot "${UNIVERSALSDK}" \
392                         -all_load $(LIBRARY) -Wl,-single_module \
393                         -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
394                         -compatibility_version $(VERSION) \
395                         -current_version $(VERSION); \
396         else \
397                 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
398                         @LIBTOOL_CRUFT@ ;\
399         fi
400         $(INSTALL) -d -m $(DIRMODE)  \
401                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
402         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
403                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
404         $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
405                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
406         $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
407                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
408         $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
409         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
410         $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
411         $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
413 # This rule builds the Cygwin Python DLL and import library if configured
414 # for a shared core library; otherwise, this rule is a noop.
415 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
416         if test -n "$(DLLLIBRARY)"; then \
417                 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
418                         $(LIBS) $(MODLIBS) $(SYSLIBS); \
419         else true; \
420         fi
423 oldsharedmods: $(SHAREDMODS)
426 Makefile Modules/config.c: Makefile.pre \
427                                 $(srcdir)/Modules/config.c.in \
428                                 $(MAKESETUP) \
429                                 Modules/Setup.config \
430                                 Modules/Setup \
431                                 Modules/Setup.local
432         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
433                                 -s Modules \
434                                 Modules/Setup.config \
435                                 Modules/Setup.local \
436                                 Modules/Setup
437         @mv config.c Modules
438         @echo "The Makefile was updated, you may need to re-run make."
441 Modules/Setup: $(srcdir)/Modules/Setup.dist
442         @if test -f Modules/Setup; then \
443                 echo "-----------------------------------------------"; \
444                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
445                 echo "check to make sure you have all the updates you"; \
446                 echo "need in your Modules/Setup file."; \
447                 echo "Usually, copying Setup.dist to Setup will work."; \
448                 echo "-----------------------------------------------"; \
449         fi
451 ############################################################################
452 # Special rules for object files
454 Modules/getbuildinfo.o: $(PARSER_OBJS) \
455                 $(OBJECT_OBJS) \
456                 $(PYTHON_OBJS) \
457                 $(MODULE_OBJS) \
458                 $(SIGNAL_OBJS) \
459                 $(MODOBJS) \
460                 $(srcdir)/Modules/getbuildinfo.c
461         $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
463 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
464         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
465                 -DPREFIX='"$(prefix)"' \
466                 -DEXEC_PREFIX='"$(exec_prefix)"' \
467                 -DVERSION='"$(VERSION)"' \
468                 -DVPATH='"$(VPATH)"' \
469                 -o $@ $(srcdir)/Modules/getpath.c
471 Modules/python.o: $(srcdir)/Modules/python.c
472         $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
475 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
476                 -@ mkdir Include
477                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
479 $(PGEN):        $(PGENOBJS)
480                 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
482 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
483                                 $(srcdir)/Include/token.h \
484                                 $(srcdir)/Include/grammar.h
485 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
487 Parser/tokenizer_pgen.o:        $(srcdir)/Parser/tokenizer.c
489 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
490         $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
492 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
493         $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
495 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
497 Python/getplatform.o: $(srcdir)/Python/getplatform.c
498                 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
500 Python/importdl.o: $(srcdir)/Python/importdl.c
501                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
503 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
504                                 $(srcdir)/Objects/unicodetype_db.h
506 ############################################################################
507 # Header files
509 PYTHON_HEADERS= \
510                 Include/Python.h \
511                 Include/Python-ast.h \
512                 Include/asdl.h \
513                 Include/abstract.h \
514                 Include/boolobject.h \
515                 Include/bufferobject.h \
516                 Include/ceval.h \
517                 Include/classobject.h \
518                 Include/cobject.h \
519                 Include/code.h \
520                 Include/codecs.h \
521                 Include/compile.h \
522                 Include/complexobject.h \
523                 Include/descrobject.h \
524                 Include/dictobject.h \
525                 Include/enumobject.h \
526                 Include/genobject.h \
527                 Include/fileobject.h \
528                 Include/floatobject.h \
529                 Include/funcobject.h \
530                 Include/import.h \
531                 Include/intobject.h \
532                 Include/intrcheck.h \
533                 Include/iterobject.h \
534                 Include/listobject.h \
535                 Include/longobject.h \
536                 Include/methodobject.h \
537                 Include/modsupport.h \
538                 Include/moduleobject.h \
539                 Include/object.h \
540                 Include/objimpl.h \
541                 Include/patchlevel.h \
542                 Include/pyarena.h \
543                 Include/pydebug.h \
544                 Include/pyerrors.h \
545                 Include/pyfpe.h \
546                 Include/pymem.h \
547                 Include/pyport.h \
548                 Include/pystate.h \
549                 Include/pythonrun.h \
550                 Include/rangeobject.h \
551                 Include/setobject.h \
552                 Include/sliceobject.h \
553                 Include/stringobject.h \
554                 Include/structseq.h \
555                 Include/structmember.h \
556                 Include/symtable.h \
557                 Include/sysmodule.h \
558                 Include/traceback.h \
559                 Include/tupleobject.h \
560                 Include/unicodeobject.h \
561                 Include/weakrefobject.h \
562                 pyconfig.h
564 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
567 ######################################################################
569 # Test the interpreter (twice, once without .pyc files, once with)
570 # In the past, we've had problems where bugs in the marshalling or
571 # elsewhere caused bytecode read from .pyc files to behave differently
572 # than bytecode generated directly from a .py source file.  Sometimes
573 # the bytecode read from a .pyc file had the bug, somtimes the directly
574 # generated bytecode.  This is sometimes a very shy bug needing a lot of
575 # sample data.
577 TESTOPTS=       -l $(EXTRATESTOPTS)
578 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
579 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
580 test:           all platform
581                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
582                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
583                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
585 testall:        all platform
586                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
587                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
588                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
590 #  Run the unitests for both architectures in a Universal build on OSX
591 #  Must be run on an Intel box.
592 testuniversal:  all platform
593                 if [ `arch` != 'i386' ];then \
594                         echo "This can only be used on OSX/i386" ;\
595                         exit 1 ;\
596                 fi
597                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
598                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
599                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
600                 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
603 # Like testall, but with a single pass only
604 # run an optional script to include some information about the build environment
605 buildbottest:   all platform
606                 -@if which pybuildbot.identify >/dev/null 2>&1; then \
607                         pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
608                 fi
609                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
611 QUICKTESTOPTS=  $(TESTOPTS) -x test_thread test_signal test_strftime \
612                 test_unicodedata test_re test_sre test_select test_poll \
613                 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
614 quicktest:      all platform
615                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
616                 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
617                 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
619 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
620                 test_longexp
621 memtest:        all platform
622                 -rm -f $(srcdir)/Lib/test/*.py[co]
623                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
624                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
626 # Install everything
627 install:        @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
629 # Install almost everything without disturbing previous versions
630 altinstall:     @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
631                 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
633 # Install shared libraries enabled by Setup
634 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
636 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
637                 @for i in X $(SHAREDMODS); do \
638                   if test $$i != X; then \
639                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
640                     $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
641                   fi; \
642                 done
644 $(DESTSHARED):
645                 @for i in $(DESTDIRS); \
646                 do \
647                         if test ! -d $(DESTDIR)$$i; then \
648                                 echo "Creating directory $$i"; \
649                                 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
650                         else    true; \
651                         fi; \
652                 done
655 # Install the interpreter (by creating a hard link to python$(VERSION))
656 bininstall:     altbininstall
657         -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
658         then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
659         else true; \
660         fi
661         (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
662         -rm -f $(DESTDIR)$(BINDIR)/python-config
663         (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
665 # Install the interpreter with $(VERSION) affixed
666 # This goes into $(exec_prefix)
667 altbininstall:  $(BUILDPYTHON)
668         @for i in $(BINDIR) $(LIBDIR); \
669         do \
670                 if test ! -d $(DESTDIR)$$i; then \
671                         echo "Creating directory $$i"; \
672                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
673                 else    true; \
674                 fi; \
675         done
676         $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
677         if test -f libpython$(VERSION)$(SO); then \
678                 if test "$(SO)" = .dll; then \
679                         $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
680                 else \
681                         $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
682                         if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
683                                 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
684                         fi \
685                 fi; \
686         else    true; \
687         fi
689 # Install the manual page
690 maninstall:
691         @for i in $(MANDIR) $(MANDIR)/man1; \
692         do \
693                 if test ! -d $(DESTDIR)$$i; then \
694                         echo "Creating directory $$i"; \
695                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
696                 else    true; \
697                 fi; \
698         done
699         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
700                 $(DESTDIR)$(MANDIR)/man1/python.1
702 # Install the library
703 PLATDIR=        plat-$(MACHDEP)
704 EXTRAPLATDIR= @EXTRAPLATDIR@
705 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
706 MACHDEPS=       $(PLATDIR) $(EXTRAPLATDIR)
707 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
708 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
709         plat-mac/lib-scriptpackages/_builtinSuites \
710         plat-mac/lib-scriptpackages/CodeWarrior \
711         plat-mac/lib-scriptpackages/Explorer \
712         plat-mac/lib-scriptpackages/Finder \
713         plat-mac/lib-scriptpackages/Netscape \
714         plat-mac/lib-scriptpackages/StdSuites \
715         plat-mac/lib-scriptpackages/SystemEvents \
716         plat-mac/lib-scriptpackages/Terminal 
717 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
718 LIBSUBDIRS=     lib-tk site-packages test test/output test/data \
719                 test/decimaltestdata \
720                 encodings compiler hotshot \
721                 email email/mime email/test email/test/data \
722                 sqlite3 sqlite3/test \
723                 logging bsddb bsddb/test csv wsgiref \
724                 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
725                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
726                 setuptools setuptools/command setuptools/tests setuptools.egg-info \
727                 curses $(MACHDEPS)
728 libinstall:     $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
729         @for i in $(SCRIPTDIR) $(LIBDEST); \
730         do \
731                 if test ! -d $(DESTDIR)$$i; then \
732                         echo "Creating directory $$i"; \
733                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
734                 else    true; \
735                 fi; \
736         done
737         @for d in $(LIBSUBDIRS); \
738         do \
739                 a=$(srcdir)/Lib/$$d; \
740                 if test ! -d $$a; then continue; else true; fi; \
741                 b=$(LIBDEST)/$$d; \
742                 if test ! -d $(DESTDIR)$$b; then \
743                         echo "Creating directory $$b"; \
744                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
745                 else    true; \
746                 fi; \
747         done
748         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
749         do \
750                 if test -x $$i; then \
751                         $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
752                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
753                 else \
754                         $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
755                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
756                 fi; \
757         done
758         @for d in $(LIBSUBDIRS); \
759         do \
760                 a=$(srcdir)/Lib/$$d; \
761                 if test ! -d $$a; then continue; else true; fi; \
762                 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
763                 b=$(LIBDEST)/$$d; \
764                 for i in $$a/*; \
765                 do \
766                         case $$i in \
767                         *CVS) ;; \
768                         *.py[co]) ;; \
769                         *.orig) ;; \
770                         *~) ;; \
771                         *) \
772                                 if test -d $$i; then continue; fi; \
773                                 if test -x $$i; then \
774                                     echo $(INSTALL_SCRIPT) $$i $$b; \
775                                     $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
776                                 else \
777                                     echo $(INSTALL_DATA) $$i $$b; \
778                                     $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
779                                 fi;; \
780                         esac; \
781                 done; \
782         done
783         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
784         PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
785                 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
786                 -d $(LIBDEST) -f \
787                 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
788         PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
789                 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
790                 -d $(LIBDEST) -f \
791                 -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
792         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
793                 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
794                 -d $(LIBDEST)/site-packages -f \
795                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
796         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
797                 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
798                 -d $(LIBDEST)/site-packages -f \
799                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
801 # Create the PLATDIR source directory, if one wasn't distributed..
802 $(srcdir)/Lib/$(PLATDIR):
803         mkdir $(srcdir)/Lib/$(PLATDIR)
804         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
805         export PATH; PATH="`pwd`:$$PATH"; \
806         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
807         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
808         export EXE; EXE="$(BUILDEXE)"; \
809         cd $(srcdir)/Lib/$(PLATDIR); ./regen
811 # Install the include files
812 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
813 inclinstall:
814         @for i in $(INCLDIRSTOMAKE); \
815         do \
816                 if test ! -d $(DESTDIR)$$i; then \
817                         echo "Creating directory $$i"; \
818                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
819                 else    true; \
820                 fi; \
821         done
822         @for i in $(srcdir)/Include/*.h; \
823         do \
824                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
825                 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
826         done
827         $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
829 # Install the library and miscellaneous stuff needed for extending/embedding
830 # This goes into $(exec_prefix)
831 LIBPL=          $(LIBP)/config
832 libainstall:    all
833         @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
834         do \
835                 if test ! -d $(DESTDIR)$$i; then \
836                         echo "Creating directory $$i"; \
837                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
838                 else    true; \
839                 fi; \
840         done
841         @if test -d $(LIBRARY); then :; else \
842                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
843                         if test "$(SO)" = .dll; then \
844                                 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
845                         else \
846                                 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
847                                 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
848                         fi; \
849                 else \
850                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
851                 fi; \
852         fi
853         $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
854         $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
855         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
856         $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
857         $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
858         $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
859         $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
860         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
861         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
862         # Substitution happens here, as the completely-expanded BINDIR
863         # is not available in configure
864         sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
865         $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
866         rm python-config
867         @if [ -s Modules/python.exp -a \
868                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
869                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
870                 $(INSTALL_DATA) Modules/python.exp              \
871                                 $(DESTDIR)$(LIBPL)/python.exp;          \
872                 echo; echo "$(LIBPL)/python.exp";               \
873                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
874                                 $(DESTDIR)$(LIBPL)/makexp_aix;          \
875                 echo "$(LIBPL)/makexp_aix";                     \
876                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
877                                 $(DESTDIR)$(LIBPL)/ld_so_aix;           \
878                 echo "$(LIBPL)/ld_so_aix";                      \
879                 echo; echo "See Misc/AIX-NOTES for details.";   \
880         else true; \
881         fi
882         @case "$(MACHDEP)" in beos*) \
883                 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
884                 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
885                 echo; echo "$(LIBPL)/README";                   \
886                 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
887                 echo "$(LIBPL)/ar_beos";                        \
888                 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
889                 echo "$(LIBPL)/ld_so_beos";                     \
890                 echo; echo "See Misc/BeOS-NOTES for details.";  \
891                 ;; \
892         esac
894 # Install the dynamically loadable modules
895 # This goes into $(exec_prefix)
896 sharedinstall:
897         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
898                 --prefix=$(prefix) \
899                 --install-scripts=$(BINDIR) \
900                 --install-platlib=$(DESTSHARED) \
901                 --root=/$(DESTDIR)
903 # Here are a couple of targets for MacOSX again, to install a full
904 # framework-based Python. frameworkinstall installs everything, the
905 # subtargets install specific parts. Much of the actual work is offloaded to
906 # the Makefile in Mac
909 # This target is here for backward compatiblity, previous versions of Python
910 # hadn't integrated framework installation in the normal install process.
911 frameworkinstall: install
913 # On install, we re-make the framework
914 # structure in the install location, /Library/Frameworks/ or the argument to
915 # --enable-framework. If --enable-framework has been specified then we have
916 # automatically set prefix to the location deep down in the framework, so we
917 # only have to cater for the structural bits of the framework.
919 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
921 frameworkinstallstructure:      $(LDLIBRARY)
922         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
923                 echo Not configured with --enable-framework; \
924                 exit 1; \
925         else true; \
926         fi
927         @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
928                 if test ! -d $(DESTDIR)$$i; then \
929                         echo "Creating directory $(DESTDIR)$$i"; \
930                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
931                 else    true; \
932                 fi; \
933         done
934         $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
935         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
936         $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
937         $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
938                 $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
939         $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
940         $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
941         $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
942         $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
943         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
945 # This installs Mac/Lib into the framework
946 # Install a number of symlinks to keep software that expects a normal unix
947 # install (which includes python-config) happy.
948 frameworkinstallmaclib:
949         ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
950         cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
952 # This installs the IDE, the Launcher and other apps into /Applications
953 frameworkinstallapps:
954         cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
956 # This install the unix python and pythonw tools in /usr/local/bin
957 frameworkinstallunixtools:
958         cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
960 frameworkaltinstallunixtools:
961         cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
963 # This installs the Demos and Tools into the applications directory.
964 # It is not part of a normal frameworkinstall
965 frameworkinstallextras:
966         cd Mac && Make installextras DESTDIR="$(DESTDIR)"
968 # This installs a few of the useful scripts in Tools/scripts
969 scriptsinstall:
970         SRCDIR=$(srcdir) $(RUNSHARED) \
971         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
972         --prefix=$(prefix) \
973         --install-scripts=$(BINDIR) \
974         --root=/$(DESTDIR)
976 # Build the toplevel Makefile
977 Makefile.pre: Makefile.pre.in config.status
978         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
979         $(MAKE) -f Makefile.pre Makefile
981 # Run the configure script.
982 config.status:  $(srcdir)/configure
983         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
985 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
987 # Some make's put the object file in the current directory
988 .c.o:
989         $(CC) -c $(PY_CFLAGS) -o $@ $<
991 # Run reindent on the library
992 reindent:
993         ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
995 # Rerun configure with the same options as it was run last time,
996 # provided the config.status script exists
997 recheck:
998         $(SHELL) config.status --recheck
999         $(SHELL) config.status
1001 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1002 autoconf:
1003         (cd $(srcdir); autoconf)
1004         (cd $(srcdir); autoheader)
1006 # Create a tags file for vi
1007 tags::
1008         cd $(srcdir); \
1009         ctags -w -t Include/*.h; \
1010         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1011         done; \
1012         sort -o tags tags
1014 # Create a tags file for GNU Emacs
1015 TAGS::
1016         cd $(srcdir); \
1017         etags Include/*.h; \
1018         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1020 # Sanitation targets -- clean leaves libraries, executables and tags
1021 # files, which clobber removes those as well
1022 pycremoval:
1023         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1025 clean: pycremoval
1026         find . -name '*.o' -exec rm -f {} ';'
1027         find . -name '*.s[ol]' -exec rm -f {} ';'
1028         find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
1029         find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
1031 clobber: clean
1032         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1033                 tags TAGS \
1034                 config.cache config.log pyconfig.h Modules/config.c
1035         -rm -rf build platform
1036         -rm -rf $(PYTHONFRAMEWORKDIR)
1038 # Make things extra clean, before making a distribution:
1039 # remove all generated files, even Makefile[.pre]
1040 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1041 distclean: clobber
1042         -rm -f core Makefile Makefile.pre config.status \
1043                 Modules/Setup Modules/Setup.local Modules/Setup.config
1044         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1045                            -o -name '[@,#]*' -o -name '*.old' \
1046                            -o -name '*.orig' -o -name '*.rej' \
1047                            -o -name '*.bak' ')' \
1048                            -exec rm -f {} ';'
1050 # Check for smelly exported symbols (not starting with Py/_Py)
1051 smelly: all
1052         nm -p $(LIBRARY) | \
1053                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1055 # Find files with funny names
1056 funny:
1057         find $(DISTDIRS) -type d \
1058                 -o -name '*.[chs]' \
1059                 -o -name '*.py' \
1060                 -o -name '*.doc' \
1061                 -o -name '*.sty' \
1062                 -o -name '*.bib' \
1063                 -o -name '*.dat' \
1064                 -o -name '*.el' \
1065                 -o -name '*.fd' \
1066                 -o -name '*.in' \
1067                 -o -name '*.tex' \
1068                 -o -name '*,[vpt]' \
1069                 -o -name 'Setup' \
1070                 -o -name 'Setup.*' \
1071                 -o -name README \
1072                 -o -name Makefile \
1073                 -o -name ChangeLog \
1074                 -o -name Repository \
1075                 -o -name Root \
1076                 -o -name Entries \
1077                 -o -name Tag \
1078                 -o -name tags \
1079                 -o -name TAGS \
1080                 -o -name .cvsignore \
1081                 -o -name MANIFEST \
1082                 -o -print
1084 # Dependencies
1086 Python/thread.o: @THREADHEADERS@
1088 # Declare targets that aren't real files
1089 .PHONY: all sharedmods oldsharedmods test quicktest memtest
1090 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1091 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1092 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1093 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1094 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
1095 .PHONY: smelly funny
1097 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY