Add better error reporting for MemoryErrors caused by str->float conversions.
[python.git] / Makefile.pre.in
blob300a03486ed1e881571bad9efdd616c2804e6033
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 GNULD=          @GNULD@
41 # Shell used by make (some versions default to the login shell, which is bad)
42 SHELL=          /bin/sh
44 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
45 LN=             @LN@
47 # Portable install script (configure doesn't always guess right)
48 INSTALL=        @INSTALL@
49 INSTALL_PROGRAM=@INSTALL_PROGRAM@
50 INSTALL_SCRIPT= @INSTALL_SCRIPT@
51 INSTALL_DATA=   @INSTALL_DATA@
52 # Shared libraries must be installed with executable mode on some systems;
53 # rather than figuring out exactly which, we always give them executable mode.
54 # Also, making them read-only seems to be a good idea...
55 INSTALL_SHARED= ${INSTALL} -m 555
57 MAKESETUP=      $(srcdir)/Modules/makesetup
59 # Compiler options
60 OPT=            @OPT@
61 BASECFLAGS=     @BASECFLAGS@
62 CFLAGS=         $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
63 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
64 # be able to build extension modules using the directories specified in the
65 # environment variables
66 CPPFLAGS=       -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
67 LDFLAGS=        @LDFLAGS@
68 LDLAST=         @LDLAST@
69 SGI_ABI=        @SGI_ABI@
70 CCSHARED=       @CCSHARED@
71 LINKFORSHARED=  @LINKFORSHARED@
72 ARFLAGS=        @ARFLAGS@
73 # Extra C flags added for building the interpreter object files.
74 CFLAGSFORSHARED=@CFLAGSFORSHARED@
75 # C flags used for building the interpreter object files
76 PY_CFLAGS=      $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
79 # Machine-dependent subdirectories
80 MACHDEP=        @MACHDEP@
82 # Install prefix for architecture-independent files
83 prefix=         @prefix@
85 # Install prefix for architecture-dependent files
86 exec_prefix=    @exec_prefix@
88 # Install prefix for data files
89 datarootdir=    @datarootdir@
91 # Expanded directories
92 BINDIR=         $(exec_prefix)/bin
93 LIBDIR=         $(exec_prefix)/lib
94 MANDIR=         @mandir@
95 INCLUDEDIR=     @includedir@
96 CONFINCLUDEDIR= $(exec_prefix)/include
97 SCRIPTDIR=      $(prefix)/lib
99 # Detailed destination directories
100 BINLIBDEST=     $(LIBDIR)/python$(VERSION)
101 LIBDEST=        $(SCRIPTDIR)/python$(VERSION)
102 INCLUDEPY=      $(INCLUDEDIR)/python$(VERSION)
103 CONFINCLUDEPY=  $(CONFINCLUDEDIR)/python$(VERSION)
104 LIBP=           $(LIBDIR)/python$(VERSION)
106 # Symbols used for using shared libraries
107 SO=             @SO@
108 LDSHARED=       @LDSHARED@
109 BLDSHARED=      @BLDSHARED@
110 DESTSHARED=     $(BINLIBDEST)/lib-dynload
112 # Executable suffix (.exe on Windows and Mac OS X)
113 EXE=            @EXEEXT@
114 BUILDEXE=       @BUILDEXEEXT@
116 # Short name and location for Mac OS X Python framework
117 UNIVERSALSDK=@UNIVERSALSDK@
118 PYTHONFRAMEWORK=        @PYTHONFRAMEWORK@
119 PYTHONFRAMEWORKDIR=     @PYTHONFRAMEWORKDIR@
120 PYTHONFRAMEWORKPREFIX=  @PYTHONFRAMEWORKPREFIX@
121 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
122 # Deployment target selected during configure, to be checked
123 # by distutils. The export statement is needed to ensure that the
124 # deployment target is active during build.
125 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
126 @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
128 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
129 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
131 # Environment to run shared python without installed libraries
132 RUNSHARED=       @RUNSHARED@
134 # Modes for directories, executables and data files created by the
135 # install process.  Default to user-only-writable for all file types.
136 DIRMODE=        755
137 EXEMODE=        755
138 FILEMODE=       644
140 # configure script arguments
141 CONFIG_ARGS=    @CONFIG_ARGS@
144 # Subdirectories with code
145 SRCDIRS=        @SRCDIRS@
147 # Other subdirectories
148 SUBDIRSTOO=     Include Lib Misc Demo
150 # Files and directories to be distributed
151 CONFIGFILES=    configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
152 DISTFILES=      README ChangeLog $(CONFIGFILES)
153 DISTDIRS=       $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
154 DIST=           $(DISTFILES) $(DISTDIRS)
157 LIBRARY=        @LIBRARY@
158 LDLIBRARY=      @LDLIBRARY@
159 BLDLIBRARY=     @BLDLIBRARY@
160 DLLLIBRARY=     @DLLLIBRARY@
161 LDLIBRARYDIR=   @LDLIBRARYDIR@
162 INSTSONAME=     @INSTSONAME@
165 LIBS=           @LIBS@
166 LIBM=           @LIBM@
167 LIBC=           @LIBC@
168 SYSLIBS=        $(LIBM) $(LIBC)
169 SHLIBS=         @SHLIBS@
171 THREADOBJ=      @THREADOBJ@
172 DLINCLDIR=      @DLINCLDIR@
173 DYNLOADFILE=    @DYNLOADFILE@
174 MACHDEP_OBJS=   @MACHDEP_OBJS@
175 LIBOBJDIR=      Python/
176 LIBOBJS=        @LIBOBJS@
177 UNICODE_OBJS=   @UNICODE_OBJS@
179 PYTHON=         python$(EXE)
180 BUILDPYTHON=    python$(BUILDEXE)
182 # The task to run while instrument when building the profile-opt target
183 PROFILE_TASK=   $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
184 #PROFILE_TASK=  $(srcdir)/Lib/test/regrtest.py
186 # === Definitions added by makesetup ===
189 ##########################################################################
190 # Modules
191 MODULE_OBJS=    \
192                 Modules/config.o \
193                 Modules/getpath.o \
194                 Modules/main.o \
195                 Modules/gcmodule.o
197 # Used of signalmodule.o is not available
198 SIGNAL_OBJS=    @SIGNAL_OBJS@
201 ##########################################################################
202 # Grammar
203 GRAMMAR_H=      $(srcdir)/Include/graminit.h
204 GRAMMAR_C=      $(srcdir)/Python/graminit.c
205 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
208 LIBFFI_INCLUDEDIR=      @LIBFFI_INCLUDEDIR@
210 ##########################################################################
211 # Parser
212 PGEN=           Parser/pgen$(EXE)
214 POBJS=          \
215                 Parser/acceler.o \
216                 Parser/grammar1.o \
217                 Parser/listnode.o \
218                 Parser/node.o \
219                 Parser/parser.o \
220                 Parser/parsetok.o \
221                 Parser/bitset.o \
222                 Parser/metagrammar.o \
223                 Parser/firstsets.o \
224                 Parser/grammar.o \
225                 Parser/pgen.o
227 PARSER_OBJS=    $(POBJS) Parser/myreadline.o Parser/tokenizer.o
229 PGOBJS=         \
230                 Objects/obmalloc.o \
231                 Python/mysnprintf.o \
232                 Parser/tokenizer_pgen.o \
233                 Parser/printgrammar.o \
234                 Parser/pgenmain.o
236 PARSER_HEADERS= \
237                 Parser/parser.h \
238                 Parser/tokenizer.h
240 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
242 ##########################################################################
243 # AST
244 AST_H_DIR=      $(srcdir)/Include
245 AST_H=          $(AST_H_DIR)/Python-ast.h
246 AST_C_DIR=      $(srcdir)/Python
247 AST_C=          $(AST_C_DIR)/Python-ast.c
248 AST_ASDL=       $(srcdir)/Parser/Python.asdl
250 ASDLGEN_FILES=  $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
251 # XXX Note that a build now requires Python exist before the build starts
252 ASDLGEN=        $(srcdir)/Parser/asdl_c.py
254 ##########################################################################
255 # Python
256 PYTHON_OBJS=    \
257                 Python/_warnings.o \
258                 Python/Python-ast.o \
259                 Python/asdl.o \
260                 Python/ast.o \
261                 Python/bltinmodule.o \
262                 Python/ceval.o \
263                 Python/compile.o \
264                 Python/codecs.o \
265                 Python/errors.o \
266                 Python/frozen.o \
267                 Python/frozenmain.o \
268                 Python/future.o \
269                 Python/getargs.o \
270                 Python/getcompiler.o \
271                 Python/getcopyright.o \
272                 Python/getplatform.o \
273                 Python/getversion.o \
274                 Python/graminit.o \
275                 Python/import.o \
276                 Python/importdl.o \
277                 Python/marshal.o \
278                 Python/modsupport.o \
279                 Python/mystrtoul.o \
280                 Python/mysnprintf.o \
281                 Python/peephole.o \
282                 Python/pyarena.o \
283                 Python/pyctype.o \
284                 Python/pyfpe.o \
285                 Python/pymath.o \
286                 Python/pystate.o \
287                 Python/pythonrun.o \
288                 Python/structmember.o \
289                 Python/symtable.o \
290                 Python/sysmodule.o \
291                 Python/traceback.o \
292                 Python/getopt.o \
293                 Python/pystrcmp.o \
294                 Python/pystrtod.o \
295                 Python/dtoa.o \
296                 Python/formatter_unicode.o \
297                 Python/formatter_string.o \
298                 Python/$(DYNLOADFILE) \
299                 $(LIBOBJS) \
300                 $(MACHDEP_OBJS) \
301                 $(THREADOBJ)
304 ##########################################################################
305 # Objects
306 OBJECT_OBJS=    \
307                 Objects/abstract.o \
308                 Objects/boolobject.o \
309                 Objects/bufferobject.o \
310                 Objects/bytes_methods.o \
311                 Objects/bytearrayobject.o \
312                 Objects/cellobject.o \
313                 Objects/classobject.o \
314                 Objects/cobject.o \
315                 Objects/codeobject.o \
316                 Objects/complexobject.o \
317                 Objects/descrobject.o \
318                 Objects/enumobject.o \
319                 Objects/exceptions.o \
320                 Objects/genobject.o \
321                 Objects/fileobject.o \
322                 Objects/floatobject.o \
323                 Objects/frameobject.o \
324                 Objects/funcobject.o \
325                 Objects/intobject.o \
326                 Objects/iterobject.o \
327                 Objects/listobject.o \
328                 Objects/longobject.o \
329                 Objects/dictobject.o \
330                 Objects/memoryobject.o \
331                 Objects/methodobject.o \
332                 Objects/moduleobject.o \
333                 Objects/object.o \
334                 Objects/obmalloc.o \
335                 Objects/rangeobject.o \
336                 Objects/setobject.o \
337                 Objects/sliceobject.o \
338                 Objects/stringobject.o \
339                 Objects/structseq.o \
340                 Objects/tupleobject.o \
341                 Objects/typeobject.o \
342                 Objects/weakrefobject.o \
343                 $(UNICODE_OBJS)
346 ##########################################################################
347 # objects that get linked into the Python library
348 LIBRARY_OBJS=   \
349                 Modules/getbuildinfo.o \
350                 $(PARSER_OBJS) \
351                 $(OBJECT_OBJS) \
352                 $(PYTHON_OBJS) \
353                 $(MODULE_OBJS) \
354                 $(SIGNAL_OBJS) \
355                 $(MODOBJS)
357 #########################################################################
358 # Rules
360 # Default target
361 all:            build_all
362 build_all:      $(BUILDPYTHON) oldsharedmods sharedmods
364 # Compile a binary with gcc profile guided optimization.
365 profile-opt:
366         @echo "Building with support for profile generation:"
367         $(MAKE) clean
368         $(MAKE) build_all_generate_profile
369         @echo "Running benchmark to generate profile data:"
370         $(MAKE) profile-removal
371         $(MAKE) run_profile_task
372         @echo "Rebuilding with profile guided optimizations:"
373         $(MAKE) clean
374         $(MAKE) build_all_use_profile
376 build_all_generate_profile:
377         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
379 run_profile_task:
380         ./$(BUILDPYTHON) $(PROFILE_TASK)
382 build_all_use_profile:
383         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
385 coverage:
386         @echo "Building with support for coverage checking:"
387         $(MAKE) clean
388         $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
391 # Build the interpreter
392 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
393                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
394                         Modules/python.o \
395                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
397 platform: $(BUILDPYTHON)
398         $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
401 # Build the shared modules
402 sharedmods: $(BUILDPYTHON)
403         @case $$MAKEFLAGS in \
404         *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
405         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
406         esac
408 # Build static library
409 # avoid long command lines, same as LIBRARY_OBJS
410 $(LIBRARY): $(LIBRARY_OBJS)
411         -rm -f $@
412         $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
413         $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
414         $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
415         $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
416         $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
417         $(AR) $(ARFLAGS) $@ $(MODOBJS)
418         $(RANLIB) $@
420 libpython$(VERSION).so: $(LIBRARY_OBJS)
421         if test $(INSTSONAME) != $(LDLIBRARY); then \
422                 $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
423                 $(LN) -f $(INSTSONAME) $@; \
424         else \
425                 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
426         fi
428 libpython$(VERSION).dylib: $(LIBRARY_OBJS)
429          $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
430                  
432 libpython$(VERSION).sl: $(LIBRARY_OBJS)
433         $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
435 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
436 # minimal framework (not including the Lib directory and such) in the current
437 # directory.
438 RESSRCDIR=Mac/Resources/framework
439 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
440                 $(LIBRARY) \
441                 $(RESSRCDIR)/Info.plist
442         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
443         if test "${UNIVERSALSDK}"; then \
444                 $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
445                         -isysroot "${UNIVERSALSDK}" \
446                         -all_load $(LIBRARY) -Wl,-single_module \
447                         -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
448                         -compatibility_version $(VERSION) \
449                         -current_version $(VERSION); \
450         else \
451                 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
452                         @LIBTOOL_CRUFT@ ;\
453         fi
454         $(INSTALL) -d -m $(DIRMODE)  \
455                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
456         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
457                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
458         $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
459         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
460         $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
461         $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
463 # This rule builds the Cygwin Python DLL and import library if configured
464 # for a shared core library; otherwise, this rule is a noop.
465 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
466         if test -n "$(DLLLIBRARY)"; then \
467                 $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
468                         $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
469         else true; \
470         fi
473 oldsharedmods: $(SHAREDMODS)
476 Makefile Modules/config.c: Makefile.pre \
477                                 $(srcdir)/Modules/config.c.in \
478                                 $(MAKESETUP) \
479                                 Modules/Setup.config \
480                                 Modules/Setup \
481                                 Modules/Setup.local
482         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
483                                 -s Modules \
484                                 Modules/Setup.config \
485                                 Modules/Setup.local \
486                                 Modules/Setup
487         @mv config.c Modules
488         @echo "The Makefile was updated, you may need to re-run make."
491 Modules/Setup: $(srcdir)/Modules/Setup.dist
492         @if test -f Modules/Setup; then \
493                 echo "-----------------------------------------------"; \
494                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
495                 echo "check to make sure you have all the updates you"; \
496                 echo "need in your Modules/Setup file."; \
497                 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
498                 echo "-----------------------------------------------"; \
499         fi
501 ############################################################################
502 # Special rules for object files
504 Modules/getbuildinfo.o: $(PARSER_OBJS) \
505                 $(OBJECT_OBJS) \
506                 $(PYTHON_OBJS) \
507                 $(MODULE_OBJS) \
508                 $(SIGNAL_OBJS) \
509                 $(MODOBJS) \
510                 $(srcdir)/Modules/getbuildinfo.c
511         $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
513 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
514         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
515                 -DPREFIX='"$(prefix)"' \
516                 -DEXEC_PREFIX='"$(exec_prefix)"' \
517                 -DVERSION='"$(VERSION)"' \
518                 -DVPATH='"$(VPATH)"' \
519                 -o $@ $(srcdir)/Modules/getpath.c
521 Modules/python.o: $(srcdir)/Modules/python.c
522         $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
525 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
526                 -@$(INSTALL) -d Include
527                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
529 $(PGEN):        $(PGENOBJS)
530                 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
532 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
533                                 $(srcdir)/Include/token.h \
534                                 $(srcdir)/Include/grammar.h
535 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
537 Parser/tokenizer_pgen.o:        $(srcdir)/Parser/tokenizer.c
539 Parser/pgenmain.o:      $(srcdir)/Include/parsetok.h
541 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
542         $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
544 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
545         $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
547 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
549 Python/getplatform.o: $(srcdir)/Python/getplatform.c
550                 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
552 Python/importdl.o: $(srcdir)/Python/importdl.c
553                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
555 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
556                                 $(srcdir)/Objects/unicodetype_db.h
558 STRINGLIB_HEADERS= \
559                 $(srcdir)/Include/bytes_methods.h \
560                 $(srcdir)/Objects/stringlib/count.h \
561                 $(srcdir)/Objects/stringlib/ctype.h \
562                 $(srcdir)/Objects/stringlib/fastsearch.h \
563                 $(srcdir)/Objects/stringlib/find.h \
564                 $(srcdir)/Objects/stringlib/formatter.h \
565                 $(srcdir)/Objects/stringlib/partition.h \
566                 $(srcdir)/Objects/stringlib/split.h \
567                 $(srcdir)/Objects/stringlib/stringdefs.h \
568                 $(srcdir)/Objects/stringlib/string_format.h \
569                 $(srcdir)/Objects/stringlib/transmogrify.h \
570                 $(srcdir)/Objects/stringlib/unicodedefs.h \
571                 $(srcdir)/Objects/stringlib/localeutil.h
573 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
574                                 $(STRINGLIB_HEADERS)
576 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
577                                 $(STRINGLIB_HEADERS)
579 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
580                                 $(STRINGLIB_HEADERS)
582 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
583                                 $(STRINGLIB_HEADERS)
585 Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
586                                 $(STRINGLIB_HEADERS)
588 ############################################################################
589 # Header files
591 PYTHON_HEADERS= \
592                 Include/Python-ast.h \
593                 Include/Python.h \
594                 Include/abstract.h \
595                 Include/asdl.h \
596                 Include/ast.h \
597                 Include/bitset.h \
598                 Include/boolobject.h \
599                 Include/bytearrayobject.h \
600                 Include/bytes_methods.h \
601                 Include/bytesobject.h \
602                 Include/bufferobject.h \
603                 Include/cellobject.h \
604                 Include/ceval.h \
605                 Include/classobject.h \
606                 Include/cobject.h \
607                 Include/code.h \
608                 Include/codecs.h \
609                 Include/compile.h \
610                 Include/complexobject.h \
611                 Include/descrobject.h \
612                 Include/dictobject.h \
613                 Include/dtoa.h \
614                 Include/enumobject.h \
615                 Include/errcode.h \
616                 Include/eval.h \
617                 Include/fileobject.h \
618                 Include/floatobject.h \
619                 Include/frameobject.h \
620                 Include/funcobject.h \
621                 Include/genobject.h \
622                 Include/import.h \
623                 Include/intobject.h \
624                 Include/intrcheck.h \
625                 Include/iterobject.h \
626                 Include/listobject.h \
627                 Include/longintrepr.h \
628                 Include/longobject.h \
629                 Include/marshal.h \
630                 Include/memoryobject.h \
631                 Include/metagrammar.h \
632                 Include/methodobject.h \
633                 Include/modsupport.h \
634                 Include/moduleobject.h \
635                 Include/node.h \
636                 Include/object.h \
637                 Include/objimpl.h \
638                 Include/opcode.h \
639                 Include/osdefs.h \
640                 Include/parsetok.h \
641                 Include/patchlevel.h \
642                 Include/pgen.h \
643                 Include/pgenheaders.h \
644                 Include/pyarena.h \
645                 Include/pyctype.h \
646                 Include/pydebug.h \
647                 Include/pyerrors.h \
648                 Include/pyfpe.h \
649                 Include/pymath.h \
650                 Include/pygetopt.h \
651                 Include/pymem.h \
652                 Include/pyport.h \
653                 Include/pystate.h \
654                 Include/pystrcmp.h \
655                 Include/pystrtod.h \
656                 Include/pythonrun.h \
657                 Include/pythread.h \
658                 Include/rangeobject.h \
659                 Include/setobject.h \
660                 Include/sliceobject.h \
661                 Include/stringobject.h \
662                 Include/structmember.h \
663                 Include/structseq.h \
664                 Include/symtable.h \
665                 Include/sysmodule.h \
666                 Include/traceback.h \
667                 Include/tupleobject.h \
668                 Include/ucnhash.h \
669                 Include/unicodeobject.h \
670                 Include/warnings.h \
671                 Include/weakrefobject.h \
672                 pyconfig.h \
673                 $(PARSER_HEADERS)
675 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
678 ######################################################################
680 # Test the interpreter (twice, once without .pyc files, once with)
681 # In the past, we've had problems where bugs in the marshalling or
682 # elsewhere caused bytecode read from .pyc files to behave differently
683 # than bytecode generated directly from a .py source file.  Sometimes
684 # the bytecode read from a .pyc file had the bug, somtimes the directly
685 # generated bytecode.  This is sometimes a very shy bug needing a lot of
686 # sample data.
688 TESTOPTS=       -l $(EXTRATESTOPTS)
689 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
690 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
691 test:           all platform
692                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
693                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
694                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
696 testall:        all platform
697                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
698                 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
699                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
700                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
701                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
703 #  Run the unitests for both architectures in a Universal build on OSX
704 #  Must be run on an Intel box.
705 testuniversal:  all platform
706                 if [ `arch` != 'i386' ];then \
707                         echo "This can only be used on OSX/i386" ;\
708                         exit 1 ;\
709                 fi
710                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
711                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
712                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
713                 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
716 # Like testall, but with a single pass only
717 # run an optional script to include some information about the build environment
718 buildbottest:   all platform
719                 -@if which pybuildbot.identify >/dev/null 2>&1; then \
720                         pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
721                 fi
722                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rwW
724 QUICKTESTOPTS=  $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
725                 test_multibytecodec test_urllib2_localnet test_itertools \
726                 test_multiprocessing test_mailbox test_socket test_poll \
727                 test_select test_zipfile
728 quicktest:      all platform
729                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
730                 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
731                 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
733 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
734                 test_longexp
735 memtest:        all platform
736                 -rm -f $(srcdir)/Lib/test/*.py[co]
737                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
738                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
740 # Install everything
741 install:        @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
743 # Install almost everything without disturbing previous versions
744 altinstall:     @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
745                 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
747 # Install shared libraries enabled by Setup
748 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
750 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
751                 @for i in X $(SHAREDMODS); do \
752                   if test $$i != X; then \
753                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
754                     $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
755                   fi; \
756                 done
758 $(DESTSHARED):
759                 @for i in $(DESTDIRS); \
760                 do \
761                         if test ! -d $(DESTDIR)$$i; then \
762                                 echo "Creating directory $$i"; \
763                                 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
764                         else    true; \
765                         fi; \
766                 done
769 # Install the interpreter (by creating a hard link to python$(VERSION))
770 bininstall:     altbininstall
771         -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
772         then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
773         else true; \
774         fi
775         (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
776         -rm -f $(DESTDIR)$(BINDIR)/python-config
777         (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
778         -test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
779         -rm -f $(DESTDIR)$(LIBPC)/python.pc
780         (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python.pc)
782 # Install the interpreter with $(VERSION) affixed
783 # This goes into $(exec_prefix)
784 altbininstall:  $(BUILDPYTHON)
785         @for i in $(BINDIR) $(LIBDIR); \
786         do \
787                 if test ! -d $(DESTDIR)$$i; then \
788                         echo "Creating directory $$i"; \
789                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
790                 else    true; \
791                 fi; \
792         done
793         $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
794         if test -f $(LDLIBRARY); then \
795                 if test -n "$(DLLLIBRARY)" ; then \
796                         $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
797                 else \
798                         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
799                         if test $(LDLIBRARY) != $(INSTSONAME); then \
800                                 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
801                         fi \
802                 fi; \
803         else    true; \
804         fi
806 # Install the manual page
807 maninstall:
808         @for i in $(MANDIR) $(MANDIR)/man1; \
809         do \
810                 if test ! -d $(DESTDIR)$$i; then \
811                         echo "Creating directory $$i"; \
812                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
813                 else    true; \
814                 fi; \
815         done
816         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
817                 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
819 # Install the library
820 PLATDIR=        plat-$(MACHDEP)
821 EXTRAPLATDIR= @EXTRAPLATDIR@
822 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
823 MACHDEPS=       $(PLATDIR) $(EXTRAPLATDIR)
824 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
825 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
826         plat-mac/lib-scriptpackages/_builtinSuites \
827         plat-mac/lib-scriptpackages/CodeWarrior \
828         plat-mac/lib-scriptpackages/Explorer \
829         plat-mac/lib-scriptpackages/Finder \
830         plat-mac/lib-scriptpackages/Netscape \
831         plat-mac/lib-scriptpackages/StdSuites \
832         plat-mac/lib-scriptpackages/SystemEvents \
833         plat-mac/lib-scriptpackages/Terminal 
834 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
835 LIBSUBDIRS=     lib-tk site-packages test test/output test/data \
836                 test/decimaltestdata \
837                 encodings compiler hotshot \
838                 email email/mime email/test email/test/data \
839                 json json/tests \
840                 sqlite3 sqlite3/test \
841                 logging bsddb bsddb/test csv importlib wsgiref \
842                 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
843                 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
844                 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
845                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
846                 multiprocessing multiprocessing/dummy \
847                 unittest \
848                 lib-old \
849                 curses pydoc_data $(MACHDEPS)
850 libinstall:     build_all $(srcdir)/Lib/$(PLATDIR)
851         @for i in $(SCRIPTDIR) $(LIBDEST); \
852         do \
853                 if test ! -d $(DESTDIR)$$i; then \
854                         echo "Creating directory $$i"; \
855                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
856                 else    true; \
857                 fi; \
858         done
859         @for d in $(LIBSUBDIRS); \
860         do \
861                 a=$(srcdir)/Lib/$$d; \
862                 if test ! -d $$a; then continue; else true; fi; \
863                 b=$(LIBDEST)/$$d; \
864                 if test ! -d $(DESTDIR)$$b; then \
865                         echo "Creating directory $$b"; \
866                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
867                 else    true; \
868                 fi; \
869         done
870         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
871         do \
872                 if test -x $$i; then \
873                         $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
874                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
875                 else \
876                         $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
877                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
878                 fi; \
879         done
880         @for d in $(LIBSUBDIRS); \
881         do \
882                 a=$(srcdir)/Lib/$$d; \
883                 if test ! -d $$a; then continue; else true; fi; \
884                 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
885                 b=$(LIBDEST)/$$d; \
886                 for i in $$a/*; \
887                 do \
888                         case $$i in \
889                         *CVS) ;; \
890                         *.py[co]) ;; \
891                         *.orig) ;; \
892                         *~) ;; \
893                         *) \
894                                 if test -d $$i; then continue; fi; \
895                                 if test -x $$i; then \
896                                     echo $(INSTALL_SCRIPT) $$i $$b; \
897                                     $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
898                                 else \
899                                     echo $(INSTALL_DATA) $$i $$b; \
900                                     $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
901                                 fi;; \
902                         esac; \
903                 done; \
904         done
905         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
906         PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
907                 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
908                 -d $(LIBDEST) -f \
909                 -x 'bad_coding|badsyntax|site-packages|py3_test_grammar' \
910                 $(DESTDIR)$(LIBDEST)
911         PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
912                 ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
913                 -d $(LIBDEST) -f \
914                 -x 'bad_coding|badsyntax|site-packages|py3_test_grammar' \
915                 $(DESTDIR)$(LIBDEST)
916         -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
917                 ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
918                 -d $(LIBDEST)/site-packages -f \
919                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
920         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
921                 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
922                 -d $(LIBDEST)/site-packages -f \
923                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
924         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
925                 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
927 # Create the PLATDIR source directory, if one wasn't distributed..
928 $(srcdir)/Lib/$(PLATDIR):
929         mkdir $(srcdir)/Lib/$(PLATDIR)
930         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
931         export PATH; PATH="`pwd`:$$PATH"; \
932         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
933         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
934         export EXE; EXE="$(BUILDEXE)"; \
935         cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
937 # Install the include files
938 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
939 inclinstall:
940         @for i in $(INCLDIRSTOMAKE); \
941         do \
942                 if test ! -d $(DESTDIR)$$i; then \
943                         echo "Creating directory $$i"; \
944                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
945                 else    true; \
946                 fi; \
947         done
948         @for i in $(srcdir)/Include/*.h; \
949         do \
950                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
951                 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
952         done
953         $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
955 # Install the library and miscellaneous stuff needed for extending/embedding
956 # This goes into $(exec_prefix)
957 LIBPL=          $(LIBP)/config
959 # pkgconfig directory
960 LIBPC=          $(LIBDIR)/pkgconfig
962 libainstall:    all
963         @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
964         do \
965                 if test ! -d $(DESTDIR)$$i; then \
966                         echo "Creating directory $$i"; \
967                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
968                 else    true; \
969                 fi; \
970         done
971         @if test -d $(LIBRARY); then :; else \
972                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
973                         if test "$(SO)" = .dll; then \
974                                 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
975                         else \
976                                 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
977                                 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
978                         fi; \
979                 else \
980                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
981                 fi; \
982         fi
983         $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
984         $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
985         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
986         $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
987         $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
988         $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
989         $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
990         $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
991         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
992         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
993         # Substitution happens here, as the completely-expanded BINDIR
994         # is not available in configure
995         sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
996         $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
997         rm python-config
998         @if [ -s Modules/python.exp -a \
999                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1000                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
1001                 $(INSTALL_DATA) Modules/python.exp              \
1002                                 $(DESTDIR)$(LIBPL)/python.exp;          \
1003                 echo; echo "$(LIBPL)/python.exp";               \
1004                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
1005                                 $(DESTDIR)$(LIBPL)/makexp_aix;          \
1006                 echo "$(LIBPL)/makexp_aix";                     \
1007                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
1008                                 $(DESTDIR)$(LIBPL)/ld_so_aix;           \
1009                 echo "$(LIBPL)/ld_so_aix";                      \
1010                 echo; echo "See Misc/AIX-NOTES for details.";   \
1011         else true; \
1012         fi
1013         @case "$(MACHDEP)" in beos*) \
1014                 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
1015                 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
1016                 echo; echo "$(LIBPL)/README";                   \
1017                 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
1018                 echo "$(LIBPL)/ar_beos";                        \
1019                 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
1020                 echo "$(LIBPL)/ld_so_beos";                     \
1021                 echo; echo "See Misc/BeOS-NOTES for details.";  \
1022                 ;; \
1023         esac
1025 # Install the dynamically loadable modules
1026 # This goes into $(exec_prefix)
1027 sharedinstall:
1028         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1029                 --prefix=$(prefix) \
1030                 --install-scripts=$(BINDIR) \
1031                 --install-platlib=$(DESTSHARED) \
1032                 --root=/$(DESTDIR)
1034 # Here are a couple of targets for MacOSX again, to install a full
1035 # framework-based Python. frameworkinstall installs everything, the
1036 # subtargets install specific parts. Much of the actual work is offloaded to
1037 # the Makefile in Mac
1040 # This target is here for backward compatiblity, previous versions of Python
1041 # hadn't integrated framework installation in the normal install process.
1042 frameworkinstall: install
1044 # On install, we re-make the framework
1045 # structure in the install location, /Library/Frameworks/ or the argument to
1046 # --enable-framework. If --enable-framework has been specified then we have
1047 # automatically set prefix to the location deep down in the framework, so we
1048 # only have to cater for the structural bits of the framework.
1050 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1052 frameworkinstallstructure:      $(LDLIBRARY)
1053         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1054                 echo Not configured with --enable-framework; \
1055                 exit 1; \
1056         else true; \
1057         fi
1058         @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1059                 if test ! -d $(DESTDIR)$$i; then \
1060                         echo "Creating directory $(DESTDIR)$$i"; \
1061                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1062                 else    true; \
1063                 fi; \
1064         done
1065         $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1066         sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1067         $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1068         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1069         $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1070         $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1071         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1073 # This installs Mac/Lib into the framework
1074 # Install a number of symlinks to keep software that expects a normal unix
1075 # install (which includes python-config) happy.
1076 frameworkinstallmaclib:
1077         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1078         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
1079         ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1080         cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1082 # This installs the IDE, the Launcher and other apps into /Applications
1083 frameworkinstallapps:
1084         cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1086 # This install the unix python and pythonw tools in /usr/local/bin
1087 frameworkinstallunixtools:
1088         cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1090 frameworkaltinstallunixtools:
1091         cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1093 # This installs the Demos and Tools into the applications directory.
1094 # It is not part of a normal frameworkinstall
1095 frameworkinstallextras:
1096         cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1098 # This installs a few of the useful scripts in Tools/scripts
1099 scriptsinstall:
1100         SRCDIR=$(srcdir) $(RUNSHARED) \
1101         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1102         --prefix=$(prefix) \
1103         --install-scripts=$(BINDIR) \
1104         --root=/$(DESTDIR)
1106 # Build the toplevel Makefile
1107 Makefile.pre: Makefile.pre.in config.status
1108         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1109         $(MAKE) -f Makefile.pre Makefile
1111 # Run the configure script.
1112 config.status:  $(srcdir)/configure
1113         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1115 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1117 # Some make's put the object file in the current directory
1118 .c.o:
1119         $(CC) -c $(PY_CFLAGS) -o $@ $<
1121 # Run reindent on the library
1122 reindent:
1123         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1125 # Rerun configure with the same options as it was run last time,
1126 # provided the config.status script exists
1127 recheck:
1128         $(SHELL) config.status --recheck
1129         $(SHELL) config.status
1131 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1132 autoconf:
1133         (cd $(srcdir); autoconf)
1134         (cd $(srcdir); autoheader)
1136 # Create a tags file for vi
1137 tags::
1138         cd $(srcdir); \
1139         ctags -w -t Include/*.h; \
1140         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1141         done; \
1142         sort -o tags tags
1144 # Create a tags file for GNU Emacs
1145 TAGS::
1146         cd $(srcdir); \
1147         etags Include/*.h; \
1148         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1150 # Sanitation targets -- clean leaves libraries, executables and tags
1151 # files, which clobber removes as well
1152 pycremoval:
1153         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1155 clean: pycremoval
1156         find . -name '*.o' -exec rm -f {} ';'
1157         find . -name '*.s[ol]' -exec rm -f {} ';'
1158         find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1159         find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1160         -rm -f Lib/lib2to3/*Grammar*.pickle
1162 profile-removal:
1163         find . -name '*.gc??' -exec rm -f {} ';'
1165 clobber: clean profile-removal
1166         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1167                 tags TAGS \
1168                 config.cache config.log pyconfig.h Modules/config.c
1169         -rm -rf build platform
1170         -rm -rf $(PYTHONFRAMEWORKDIR)
1172 # Make things extra clean, before making a distribution:
1173 # remove all generated files, even Makefile[.pre]
1174 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1175 distclean: clobber
1176         -rm -f Lib/test/data/*
1177         -rm -f core Makefile Makefile.pre config.status \
1178                 Modules/Setup Modules/Setup.local Modules/Setup.config \
1179                 Misc/python.pc
1180         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1181                            -o -name '[@,#]*' -o -name '*.old' \
1182                            -o -name '*.orig' -o -name '*.rej' \
1183                            -o -name '*.bak' ')' \
1184                            -exec rm -f {} ';'
1186 # Check for smelly exported symbols (not starting with Py/_Py)
1187 smelly: all
1188         nm -p $(LIBRARY) | \
1189                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1191 # Find files with funny names
1192 funny:
1193         find $(DISTDIRS) -type d \
1194                 -o -name '*.[chs]' \
1195                 -o -name '*.py' \
1196                 -o -name '*.doc' \
1197                 -o -name '*.sty' \
1198                 -o -name '*.bib' \
1199                 -o -name '*.dat' \
1200                 -o -name '*.el' \
1201                 -o -name '*.fd' \
1202                 -o -name '*.in' \
1203                 -o -name '*.tex' \
1204                 -o -name '*,[vpt]' \
1205                 -o -name 'Setup' \
1206                 -o -name 'Setup.*' \
1207                 -o -name README \
1208                 -o -name Makefile \
1209                 -o -name ChangeLog \
1210                 -o -name Repository \
1211                 -o -name Root \
1212                 -o -name Entries \
1213                 -o -name Tag \
1214                 -o -name tags \
1215                 -o -name TAGS \
1216                 -o -name .cvsignore \
1217                 -o -name MANIFEST \
1218                 -o -print
1220 # Perform some verification checks on any modified files.
1221 patchcheck:
1222         $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1224 # Dependencies
1226 Python/thread.o: @THREADHEADERS@
1228 # Declare targets that aren't real files
1229 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1230 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1231 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1232 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1233 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1234 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
1235 .PHONY: smelly funny patchcheck
1237 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY