Allow core Python build to succeed under WITHOUT_COMPLEX. The module build stage...
[python.git] / Makefile.pre.in
blob6b0dce4f6a97b460dd042c9a6494d6c072d64693
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 ##########################################################################
209 # Parser
210 PGEN=           Parser/pgen$(EXE)
212 POBJS=          \
213                 Parser/acceler.o \
214                 Parser/grammar1.o \
215                 Parser/listnode.o \
216                 Parser/node.o \
217                 Parser/parser.o \
218                 Parser/parsetok.o \
219                 Parser/bitset.o \
220                 Parser/metagrammar.o \
221                 Parser/firstsets.o \
222                 Parser/grammar.o \
223                 Parser/pgen.o
225 PARSER_OBJS=    $(POBJS) Parser/myreadline.o Parser/tokenizer.o
227 PGOBJS=         \
228                 Objects/obmalloc.o \
229                 Python/mysnprintf.o \
230                 Parser/tokenizer_pgen.o \
231                 Parser/printgrammar.o \
232                 Parser/pgenmain.o
234 PARSER_HEADERS= \
235                 Parser/parser.h \
236                 Parser/tokenizer.h
238 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
240 ##########################################################################
241 # AST
242 AST_H_DIR=      $(srcdir)/Include
243 AST_H=          $(AST_H_DIR)/Python-ast.h
244 AST_C_DIR=      $(srcdir)/Python
245 AST_C=          $(AST_C_DIR)/Python-ast.c
246 AST_ASDL=       $(srcdir)/Parser/Python.asdl
248 ASDLGEN_FILES=  $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
249 # XXX Note that a build now requires Python exist before the build starts
250 ASDLGEN=        $(srcdir)/Parser/asdl_c.py
252 ##########################################################################
253 # Python
254 PYTHON_OBJS=    \
255                 Python/_warnings.o \
256                 Python/Python-ast.o \
257                 Python/asdl.o \
258                 Python/ast.o \
259                 Python/bltinmodule.o \
260                 Python/ceval.o \
261                 Python/compile.o \
262                 Python/codecs.o \
263                 Python/errors.o \
264                 Python/frozen.o \
265                 Python/frozenmain.o \
266                 Python/future.o \
267                 Python/getargs.o \
268                 Python/getcompiler.o \
269                 Python/getcopyright.o \
270                 Python/getplatform.o \
271                 Python/getversion.o \
272                 Python/graminit.o \
273                 Python/import.o \
274                 Python/importdl.o \
275                 Python/marshal.o \
276                 Python/modsupport.o \
277                 Python/mystrtoul.o \
278                 Python/mysnprintf.o \
279                 Python/peephole.o \
280                 Python/pyarena.o \
281                 Python/pyctype.o \
282                 Python/pyfpe.o \
283                 Python/pymath.o \
284                 Python/pystate.o \
285                 Python/pythonrun.o \
286                 Python/structmember.o \
287                 Python/symtable.o \
288                 Python/sysmodule.o \
289                 Python/traceback.o \
290                 Python/getopt.o \
291                 Python/pystrcmp.o \
292                 Python/pystrtod.o \
293                 Python/formatter_unicode.o \
294                 Python/formatter_string.o \
295                 Python/$(DYNLOADFILE) \
296                 $(LIBOBJS) \
297                 $(MACHDEP_OBJS) \
298                 $(THREADOBJ)
301 ##########################################################################
302 # Objects
303 OBJECT_OBJS=    \
304                 Objects/abstract.o \
305                 Objects/boolobject.o \
306                 Objects/bufferobject.o \
307                 Objects/bytes_methods.o \
308                 Objects/bytearrayobject.o \
309                 Objects/cellobject.o \
310                 Objects/classobject.o \
311                 Objects/cobject.o \
312                 Objects/codeobject.o \
313                 Objects/complexobject.o \
314                 Objects/descrobject.o \
315                 Objects/enumobject.o \
316                 Objects/exceptions.o \
317                 Objects/genobject.o \
318                 Objects/fileobject.o \
319                 Objects/floatobject.o \
320                 Objects/frameobject.o \
321                 Objects/funcobject.o \
322                 Objects/intobject.o \
323                 Objects/iterobject.o \
324                 Objects/listobject.o \
325                 Objects/longobject.o \
326                 Objects/dictobject.o \
327                 Objects/memoryobject.o \
328                 Objects/methodobject.o \
329                 Objects/moduleobject.o \
330                 Objects/object.o \
331                 Objects/obmalloc.o \
332                 Objects/rangeobject.o \
333                 Objects/setobject.o \
334                 Objects/sliceobject.o \
335                 Objects/stringobject.o \
336                 Objects/structseq.o \
337                 Objects/tupleobject.o \
338                 Objects/typeobject.o \
339                 Objects/weakrefobject.o \
340                 $(UNICODE_OBJS)
343 ##########################################################################
344 # objects that get linked into the Python library
345 LIBRARY_OBJS=   \
346                 Modules/getbuildinfo.o \
347                 $(PARSER_OBJS) \
348                 $(OBJECT_OBJS) \
349                 $(PYTHON_OBJS) \
350                 $(MODULE_OBJS) \
351                 $(SIGNAL_OBJS) \
352                 $(MODOBJS)
354 #########################################################################
355 # Rules
357 # Default target
358 all:            build_all
359 build_all:      $(BUILDPYTHON) oldsharedmods sharedmods
361 # Compile a binary with gcc profile guided optimization.
362 profile-opt:
363         @echo "Building with support for profile generation:"
364         $(MAKE) clean
365         $(MAKE) build_all_generate_profile
366         @echo "Running benchmark to generate profile data:"
367         $(MAKE) profile-removal
368         $(MAKE) run_profile_task
369         @echo "Rebuilding with profile guided optimizations:"
370         $(MAKE) clean
371         $(MAKE) build_all_use_profile
373 build_all_generate_profile:
374         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
376 run_profile_task:
377         ./$(BUILDPYTHON) $(PROFILE_TASK)
379 build_all_use_profile:
380         $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
382 coverage:
383         @echo "Building with support for coverage checking:"
384         $(MAKE) clean
385         $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
388 # Build the interpreter
389 $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
390                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
391                         Modules/python.o \
392                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
394 platform: $(BUILDPYTHON)
395         $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
398 # Build the shared modules
399 sharedmods: $(BUILDPYTHON)
400         @case $$MAKEFLAGS in \
401         *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
402         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
403         esac
405 # Build static library
406 # avoid long command lines, same as LIBRARY_OBJS
407 $(LIBRARY): $(LIBRARY_OBJS)
408         -rm -f $@
409         $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
410         $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
411         $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
412         $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
413         $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
414         $(AR) $(ARFLAGS) $@ $(MODOBJS)
415         $(RANLIB) $@
417 libpython$(VERSION).so: $(LIBRARY_OBJS)
418         if test $(INSTSONAME) != $(LDLIBRARY); then \
419                 $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
420                 $(LN) -f $(INSTSONAME) $@; \
421         else \
422                 $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
423         fi
425 libpython$(VERSION).dylib: $(LIBRARY_OBJS)
426          $(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); \
427                  
429 libpython$(VERSION).sl: $(LIBRARY_OBJS)
430         $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
432 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
433 # minimal framework (not including the Lib directory and such) in the current
434 # directory.
435 RESSRCDIR=Mac/Resources/framework
436 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
437                 $(LIBRARY) \
438                 $(RESSRCDIR)/Info.plist
439         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
440         if test "${UNIVERSALSDK}"; then \
441                 $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
442                         -isysroot "${UNIVERSALSDK}" \
443                         -all_load $(LIBRARY) -Wl,-single_module \
444                         -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
445                         -compatibility_version $(VERSION) \
446                         -current_version $(VERSION); \
447         else \
448                 /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
449                         @LIBTOOL_CRUFT@ ;\
450         fi
451         $(INSTALL) -d -m $(DIRMODE)  \
452                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
453         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
454                 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
455         $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
456         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
457         $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
458         $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
460 # This rule builds the Cygwin Python DLL and import library if configured
461 # for a shared core library; otherwise, this rule is a noop.
462 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
463         if test -n "$(DLLLIBRARY)"; then \
464                 $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
465                         $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
466         else true; \
467         fi
470 oldsharedmods: $(SHAREDMODS)
473 Makefile Modules/config.c: Makefile.pre \
474                                 $(srcdir)/Modules/config.c.in \
475                                 $(MAKESETUP) \
476                                 Modules/Setup.config \
477                                 Modules/Setup \
478                                 Modules/Setup.local
479         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
480                                 -s Modules \
481                                 Modules/Setup.config \
482                                 Modules/Setup.local \
483                                 Modules/Setup
484         @mv config.c Modules
485         @echo "The Makefile was updated, you may need to re-run make."
488 Modules/Setup: $(srcdir)/Modules/Setup.dist
489         @if test -f Modules/Setup; then \
490                 echo "-----------------------------------------------"; \
491                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
492                 echo "check to make sure you have all the updates you"; \
493                 echo "need in your Modules/Setup file."; \
494                 echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
495                 echo "-----------------------------------------------"; \
496         fi
498 ############################################################################
499 # Special rules for object files
501 Modules/getbuildinfo.o: $(PARSER_OBJS) \
502                 $(OBJECT_OBJS) \
503                 $(PYTHON_OBJS) \
504                 $(MODULE_OBJS) \
505                 $(SIGNAL_OBJS) \
506                 $(MODOBJS) \
507                 $(srcdir)/Modules/getbuildinfo.c
508         $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
510 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
511         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
512                 -DPREFIX='"$(prefix)"' \
513                 -DEXEC_PREFIX='"$(exec_prefix)"' \
514                 -DVERSION='"$(VERSION)"' \
515                 -DVPATH='"$(VPATH)"' \
516                 -o $@ $(srcdir)/Modules/getpath.c
518 Modules/python.o: $(srcdir)/Modules/python.c
519         $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
522 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
523                 -@$(INSTALL) -d Include
524                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
526 $(PGEN):        $(PGENOBJS)
527                 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
529 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
530                                 $(srcdir)/Include/token.h \
531                                 $(srcdir)/Include/grammar.h
532 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
534 Parser/tokenizer_pgen.o:        $(srcdir)/Parser/tokenizer.c
536 Parser/pgenmain.o:      $(srcdir)/Include/parsetok.h
538 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
539         $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
541 $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
542         $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
544 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
546 Python/getplatform.o: $(srcdir)/Python/getplatform.c
547                 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
549 Python/importdl.o: $(srcdir)/Python/importdl.c
550                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
552 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
553                                 $(srcdir)/Objects/unicodetype_db.h
555 STRINGLIB_HEADERS= \
556                 $(srcdir)/Include/bytes_methods.h \
557                 $(srcdir)/Objects/stringlib/count.h \
558                 $(srcdir)/Objects/stringlib/ctype.h \
559                 $(srcdir)/Objects/stringlib/fastsearch.h \
560                 $(srcdir)/Objects/stringlib/find.h \
561                 $(srcdir)/Objects/stringlib/formatter.h \
562                 $(srcdir)/Objects/stringlib/partition.h \
563                 $(srcdir)/Objects/stringlib/stringdefs.h \
564                 $(srcdir)/Objects/stringlib/string_format.h \
565                 $(srcdir)/Objects/stringlib/transmogrify.h \
566                 $(srcdir)/Objects/stringlib/unicodedefs.h \
567                 $(srcdir)/Objects/stringlib/localeutil.h
569 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
570                                 $(STRINGLIB_HEADERS)
572 Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
573                                 $(STRINGLIB_HEADERS)
575 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
576                                 $(STRINGLIB_HEADERS)
578 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
579                                 $(STRINGLIB_HEADERS)
581 Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
582                                 $(STRINGLIB_HEADERS)
584 ############################################################################
585 # Header files
587 PYTHON_HEADERS= \
588                 Include/Python-ast.h \
589                 Include/Python.h \
590                 Include/abstract.h \
591                 Include/asdl.h \
592                 Include/ast.h \
593                 Include/bitset.h \
594                 Include/boolobject.h \
595                 Include/bytearrayobject.h \
596                 Include/bytes_methods.h \
597                 Include/bytesobject.h \
598                 Include/bufferobject.h \
599                 Include/cellobject.h \
600                 Include/ceval.h \
601                 Include/classobject.h \
602                 Include/cobject.h \
603                 Include/code.h \
604                 Include/codecs.h \
605                 Include/compile.h \
606                 Include/complexobject.h \
607                 Include/descrobject.h \
608                 Include/dictobject.h \
609                 Include/enumobject.h \
610                 Include/errcode.h \
611                 Include/eval.h \
612                 Include/fileobject.h \
613                 Include/floatobject.h \
614                 Include/frameobject.h \
615                 Include/funcobject.h \
616                 Include/genobject.h \
617                 Include/import.h \
618                 Include/intobject.h \
619                 Include/intrcheck.h \
620                 Include/iterobject.h \
621                 Include/listobject.h \
622                 Include/longintrepr.h \
623                 Include/longobject.h \
624                 Include/marshal.h \
625                 Include/memoryobject.h \
626                 Include/metagrammar.h \
627                 Include/methodobject.h \
628                 Include/modsupport.h \
629                 Include/moduleobject.h \
630                 Include/node.h \
631                 Include/object.h \
632                 Include/objimpl.h \
633                 Include/opcode.h \
634                 Include/osdefs.h \
635                 Include/parsetok.h \
636                 Include/patchlevel.h \
637                 Include/pgen.h \
638                 Include/pgenheaders.h \
639                 Include/pyarena.h \
640                 Include/pyctype.h \
641                 Include/pydebug.h \
642                 Include/pyerrors.h \
643                 Include/pyfpe.h \
644                 Include/pymath.h \
645                 Include/pygetopt.h \
646                 Include/pymem.h \
647                 Include/pyport.h \
648                 Include/pystate.h \
649                 Include/pystrcmp.h \
650                 Include/pystrtod.h \
651                 Include/pythonrun.h \
652                 Include/pythread.h \
653                 Include/rangeobject.h \
654                 Include/setobject.h \
655                 Include/sliceobject.h \
656                 Include/stringobject.h \
657                 Include/structmember.h \
658                 Include/structseq.h \
659                 Include/symtable.h \
660                 Include/sysmodule.h \
661                 Include/traceback.h \
662                 Include/tupleobject.h \
663                 Include/ucnhash.h \
664                 Include/unicodeobject.h \
665                 Include/warnings.h \
666                 Include/weakrefobject.h \
667                 pyconfig.h \
668                 $(PARSER_HEADERS)
670 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
673 ######################################################################
675 # Test the interpreter (twice, once without .pyc files, once with)
676 # In the past, we've had problems where bugs in the marshalling or
677 # elsewhere caused bytecode read from .pyc files to behave differently
678 # than bytecode generated directly from a .py source file.  Sometimes
679 # the bytecode read from a .pyc file had the bug, somtimes the directly
680 # generated bytecode.  This is sometimes a very shy bug needing a lot of
681 # sample data.
683 TESTOPTS=       -l $(EXTRATESTOPTS)
684 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
685 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
686 test:           all platform
687                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
688                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
689                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
691 testall:        all platform
692                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
693                 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
694                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
695                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
696                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
698 #  Run the unitests for both architectures in a Universal build on OSX
699 #  Must be run on an Intel box.
700 testuniversal:  all platform
701                 if [ `arch` != 'i386' ];then \
702                         echo "This can only be used on OSX/i386" ;\
703                         exit 1 ;\
704                 fi
705                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
706                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
707                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
708                 $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
711 # Like testall, but with a single pass only
712 # run an optional script to include some information about the build environment
713 buildbottest:   all platform
714                 -@if which pybuildbot.identify >/dev/null 2>&1; then \
715                         pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
716                 fi
717                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
719 QUICKTESTOPTS=  $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
720                 test_multibytecodec test_urllib2_localnet test_itertools \
721                 test_multiprocessing test_mailbox test_socket test_poll \
722                 test_select test_zipfile
723 quicktest:      all platform
724                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
725                 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
726                 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
728 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
729                 test_longexp
730 memtest:        all platform
731                 -rm -f $(srcdir)/Lib/test/*.py[co]
732                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
733                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
735 # Install everything
736 install:        @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
738 # Install almost everything without disturbing previous versions
739 altinstall:     @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
740                 sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
742 # Install shared libraries enabled by Setup
743 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
745 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
746                 @for i in X $(SHAREDMODS); do \
747                   if test $$i != X; then \
748                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
749                     $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
750                   fi; \
751                 done
753 $(DESTSHARED):
754                 @for i in $(DESTDIRS); \
755                 do \
756                         if test ! -d $(DESTDIR)$$i; then \
757                                 echo "Creating directory $$i"; \
758                                 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
759                         else    true; \
760                         fi; \
761                 done
764 # Install the interpreter (by creating a hard link to python$(VERSION))
765 bininstall:     altbininstall
766         -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
767         then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
768         else true; \
769         fi
770         (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
771         -rm -f $(DESTDIR)$(BINDIR)/python-config
772         (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
773         -test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
774         -rm -f $(DESTDIR)$(LIBPC)/python.pc
775         (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python.pc)
777 # Install the interpreter with $(VERSION) affixed
778 # This goes into $(exec_prefix)
779 altbininstall:  $(BUILDPYTHON)
780         @for i in $(BINDIR) $(LIBDIR); \
781         do \
782                 if test ! -d $(DESTDIR)$$i; then \
783                         echo "Creating directory $$i"; \
784                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
785                 else    true; \
786                 fi; \
787         done
788         $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
789         if test -f $(LDLIBRARY); then \
790                 if test -n "$(DLLLIBRARY)" ; then \
791                         $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
792                 else \
793                         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
794                         if test $(LDLIBRARY) != $(INSTSONAME); then \
795                                 (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
796                         fi \
797                 fi; \
798         else    true; \
799         fi
801 # Install the manual page
802 maninstall:
803         @for i in $(MANDIR) $(MANDIR)/man1; \
804         do \
805                 if test ! -d $(DESTDIR)$$i; then \
806                         echo "Creating directory $$i"; \
807                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
808                 else    true; \
809                 fi; \
810         done
811         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
812                 $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
814 # Install the library
815 PLATDIR=        plat-$(MACHDEP)
816 EXTRAPLATDIR= @EXTRAPLATDIR@
817 EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
818 MACHDEPS=       $(PLATDIR) $(EXTRAPLATDIR)
819 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
820 PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
821         plat-mac/lib-scriptpackages/_builtinSuites \
822         plat-mac/lib-scriptpackages/CodeWarrior \
823         plat-mac/lib-scriptpackages/Explorer \
824         plat-mac/lib-scriptpackages/Finder \
825         plat-mac/lib-scriptpackages/Netscape \
826         plat-mac/lib-scriptpackages/StdSuites \
827         plat-mac/lib-scriptpackages/SystemEvents \
828         plat-mac/lib-scriptpackages/Terminal 
829 PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
830 LIBSUBDIRS=     lib-tk site-packages test test/output test/data \
831                 test/decimaltestdata \
832                 encodings compiler hotshot \
833                 email email/mime email/test email/test/data \
834                 json json/tests \
835                 sqlite3 sqlite3/test \
836                 logging bsddb bsddb/test csv importlib wsgiref \
837                 lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
838                 lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
839                 ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
840                 distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
841                 multiprocessing multiprocessing/dummy \
842                 unittest \
843                 lib-old \
844                 curses pydoc_data $(MACHDEPS)
845 libinstall:     build_all $(srcdir)/Lib/$(PLATDIR)
846         @for i in $(SCRIPTDIR) $(LIBDEST); \
847         do \
848                 if test ! -d $(DESTDIR)$$i; then \
849                         echo "Creating directory $$i"; \
850                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
851                 else    true; \
852                 fi; \
853         done
854         @for d in $(LIBSUBDIRS); \
855         do \
856                 a=$(srcdir)/Lib/$$d; \
857                 if test ! -d $$a; then continue; else true; fi; \
858                 b=$(LIBDEST)/$$d; \
859                 if test ! -d $(DESTDIR)$$b; then \
860                         echo "Creating directory $$b"; \
861                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
862                 else    true; \
863                 fi; \
864         done
865         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
866         do \
867                 if test -x $$i; then \
868                         $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
869                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
870                 else \
871                         $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
872                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
873                 fi; \
874         done
875         @for d in $(LIBSUBDIRS); \
876         do \
877                 a=$(srcdir)/Lib/$$d; \
878                 if test ! -d $$a; then continue; else true; fi; \
879                 if test `ls $$a | wc -l` -lt 1; then continue; fi; \
880                 b=$(LIBDEST)/$$d; \
881                 for i in $$a/*; \
882                 do \
883                         case $$i in \
884                         *CVS) ;; \
885                         *.py[co]) ;; \
886                         *.orig) ;; \
887                         *~) ;; \
888                         *) \
889                                 if test -d $$i; then continue; fi; \
890                                 if test -x $$i; then \
891                                     echo $(INSTALL_SCRIPT) $$i $$b; \
892                                     $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
893                                 else \
894                                     echo $(INSTALL_DATA) $$i $$b; \
895                                     $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
896                                 fi;; \
897                         esac; \
898                 done; \
899         done
900         $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
901         PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
902                 ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
903                 -d $(LIBDEST) -f \
904                 -x 'bad_coding|badsyntax|site-packages|py3_test_grammar' \
905                 $(DESTDIR)$(LIBDEST)
906         PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
907                 ./$(BUILDPYTHON) -Wi -tt -O $(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 -t $(DESTDIR)$(LIBDEST)/compileall.py \
913                 -d $(LIBDEST)/site-packages -f \
914                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
915         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
916                 ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
917                 -d $(LIBDEST)/site-packages -f \
918                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
919         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
920                 ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
922 # Create the PLATDIR source directory, if one wasn't distributed..
923 $(srcdir)/Lib/$(PLATDIR):
924         mkdir $(srcdir)/Lib/$(PLATDIR)
925         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
926         export PATH; PATH="`pwd`:$$PATH"; \
927         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
928         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
929         export EXE; EXE="$(BUILDEXE)"; \
930         cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
932 # Install the include files
933 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
934 inclinstall:
935         @for i in $(INCLDIRSTOMAKE); \
936         do \
937                 if test ! -d $(DESTDIR)$$i; then \
938                         echo "Creating directory $$i"; \
939                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
940                 else    true; \
941                 fi; \
942         done
943         @for i in $(srcdir)/Include/*.h; \
944         do \
945                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
946                 $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
947         done
948         $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
950 # Install the library and miscellaneous stuff needed for extending/embedding
951 # This goes into $(exec_prefix)
952 LIBPL=          $(LIBP)/config
954 # pkgconfig directory
955 LIBPC=          $(LIBDIR)/pkgconfig
957 libainstall:    all
958         @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
959         do \
960                 if test ! -d $(DESTDIR)$$i; then \
961                         echo "Creating directory $$i"; \
962                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
963                 else    true; \
964                 fi; \
965         done
966         @if test -d $(LIBRARY); then :; else \
967                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
968                         if test "$(SO)" = .dll; then \
969                                 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
970                         else \
971                                 $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
972                                 $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
973                         fi; \
974                 else \
975                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
976                 fi; \
977         fi
978         $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
979         $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
980         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
981         $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
982         $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
983         $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
984         $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
985         $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
986         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
987         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
988         # Substitution happens here, as the completely-expanded BINDIR
989         # is not available in configure
990         sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
991         $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
992         rm python-config
993         @if [ -s Modules/python.exp -a \
994                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
995                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
996                 $(INSTALL_DATA) Modules/python.exp              \
997                                 $(DESTDIR)$(LIBPL)/python.exp;          \
998                 echo; echo "$(LIBPL)/python.exp";               \
999                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
1000                                 $(DESTDIR)$(LIBPL)/makexp_aix;          \
1001                 echo "$(LIBPL)/makexp_aix";                     \
1002                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
1003                                 $(DESTDIR)$(LIBPL)/ld_so_aix;           \
1004                 echo "$(LIBPL)/ld_so_aix";                      \
1005                 echo; echo "See Misc/AIX-NOTES for details.";   \
1006         else true; \
1007         fi
1008         @case "$(MACHDEP)" in beos*) \
1009                 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
1010                 $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
1011                 echo; echo "$(LIBPL)/README";                   \
1012                 $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
1013                 echo "$(LIBPL)/ar_beos";                        \
1014                 $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
1015                 echo "$(LIBPL)/ld_so_beos";                     \
1016                 echo; echo "See Misc/BeOS-NOTES for details.";  \
1017                 ;; \
1018         esac
1020 # Install the dynamically loadable modules
1021 # This goes into $(exec_prefix)
1022 sharedinstall:
1023         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
1024                 --prefix=$(prefix) \
1025                 --install-scripts=$(BINDIR) \
1026                 --install-platlib=$(DESTSHARED) \
1027                 --root=/$(DESTDIR)
1029 # Here are a couple of targets for MacOSX again, to install a full
1030 # framework-based Python. frameworkinstall installs everything, the
1031 # subtargets install specific parts. Much of the actual work is offloaded to
1032 # the Makefile in Mac
1035 # This target is here for backward compatiblity, previous versions of Python
1036 # hadn't integrated framework installation in the normal install process.
1037 frameworkinstall: install
1039 # On install, we re-make the framework
1040 # structure in the install location, /Library/Frameworks/ or the argument to
1041 # --enable-framework. If --enable-framework has been specified then we have
1042 # automatically set prefix to the location deep down in the framework, so we
1043 # only have to cater for the structural bits of the framework.
1045 frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1047 frameworkinstallstructure:      $(LDLIBRARY)
1048         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1049                 echo Not configured with --enable-framework; \
1050                 exit 1; \
1051         else true; \
1052         fi
1053         @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1054                 if test ! -d $(DESTDIR)$$i; then \
1055                         echo "Creating directory $(DESTDIR)$$i"; \
1056                         $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1057                 else    true; \
1058                 fi; \
1059         done
1060         $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
1061         sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1062         $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1063         $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1064         $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1065         $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1066         $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1068 # This installs Mac/Lib into the framework
1069 # Install a number of symlinks to keep software that expects a normal unix
1070 # install (which includes python-config) happy.
1071 frameworkinstallmaclib:
1072         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
1073         ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1074         cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
1076 # This installs the IDE, the Launcher and other apps into /Applications
1077 frameworkinstallapps:
1078         cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1080 frameworkinstallapps4way:
1081         cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
1083 # This install the unix python and pythonw tools in /usr/local/bin
1084 frameworkinstallunixtools:
1085         cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1087 frameworkinstallunixtools4way:
1088         cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
1090 frameworkaltinstallunixtools:
1091         cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1093 frameworkaltinstallunixtools4way:
1094         cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
1096 # This installs the Demos and Tools into the applications directory.
1097 # It is not part of a normal frameworkinstall
1098 frameworkinstallextras:
1099         cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1101 # This installs a few of the useful scripts in Tools/scripts
1102 scriptsinstall:
1103         SRCDIR=$(srcdir) $(RUNSHARED) \
1104         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
1105         --prefix=$(prefix) \
1106         --install-scripts=$(BINDIR) \
1107         --root=/$(DESTDIR)
1109 # Build the toplevel Makefile
1110 Makefile.pre: Makefile.pre.in config.status
1111         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1112         $(MAKE) -f Makefile.pre Makefile
1114 # Run the configure script.
1115 config.status:  $(srcdir)/configure
1116         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1118 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1120 # Some make's put the object file in the current directory
1121 .c.o:
1122         $(CC) -c $(PY_CFLAGS) -o $@ $<
1124 # Run reindent on the library
1125 reindent:
1126         ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1128 # Rerun configure with the same options as it was run last time,
1129 # provided the config.status script exists
1130 recheck:
1131         $(SHELL) config.status --recheck
1132         $(SHELL) config.status
1134 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
1135 autoconf:
1136         (cd $(srcdir); autoconf)
1137         (cd $(srcdir); autoheader)
1139 # Create a tags file for vi
1140 tags::
1141         cd $(srcdir); \
1142         ctags -w -t Include/*.h; \
1143         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
1144         done; \
1145         sort -o tags tags
1147 # Create a tags file for GNU Emacs
1148 TAGS::
1149         cd $(srcdir); \
1150         etags Include/*.h; \
1151         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1153 # Sanitation targets -- clean leaves libraries, executables and tags
1154 # files, which clobber removes as well
1155 pycremoval:
1156         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1158 clean: pycremoval
1159         find . -name '*.o' -exec rm -f {} ';'
1160         find . -name '*.s[ol]' -exec rm -f {} ';'
1161         find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1162         find build -name 'fficonfig.py' -exec rm -f {} ';' || true
1163         -rm -f Lib/lib2to3/*Grammar*.pickle
1165 profile-removal:
1166         find . -name '*.gc??' -exec rm -f {} ';'
1168 clobber: clean profile-removal
1169         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1170                 tags TAGS \
1171                 config.cache config.log pyconfig.h Modules/config.c
1172         -rm -rf build platform
1173         -rm -rf $(PYTHONFRAMEWORKDIR)
1175 # Make things extra clean, before making a distribution:
1176 # remove all generated files, even Makefile[.pre]
1177 # Keep configure and Python-ast.[ch], it's possible they can't be generated
1178 distclean: clobber
1179         -rm -f Lib/test/data/*
1180         -rm -f core Makefile Makefile.pre config.status \
1181                 Modules/Setup Modules/Setup.local Modules/Setup.config \
1182                 Misc/python.pc
1183         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
1184                            -o -name '[@,#]*' -o -name '*.old' \
1185                            -o -name '*.orig' -o -name '*.rej' \
1186                            -o -name '*.bak' ')' \
1187                            -exec rm -f {} ';'
1189 # Check for smelly exported symbols (not starting with Py/_Py)
1190 smelly: all
1191         nm -p $(LIBRARY) | \
1192                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
1194 # Find files with funny names
1195 funny:
1196         find $(DISTDIRS) -type d \
1197                 -o -name '*.[chs]' \
1198                 -o -name '*.py' \
1199                 -o -name '*.doc' \
1200                 -o -name '*.sty' \
1201                 -o -name '*.bib' \
1202                 -o -name '*.dat' \
1203                 -o -name '*.el' \
1204                 -o -name '*.fd' \
1205                 -o -name '*.in' \
1206                 -o -name '*.tex' \
1207                 -o -name '*,[vpt]' \
1208                 -o -name 'Setup' \
1209                 -o -name 'Setup.*' \
1210                 -o -name README \
1211                 -o -name Makefile \
1212                 -o -name ChangeLog \
1213                 -o -name Repository \
1214                 -o -name Root \
1215                 -o -name Entries \
1216                 -o -name Tag \
1217                 -o -name tags \
1218                 -o -name TAGS \
1219                 -o -name .cvsignore \
1220                 -o -name MANIFEST \
1221                 -o -print
1223 # Perform some verification checks on any modified files.
1224 patchcheck:
1225         $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
1227 # Dependencies
1229 Python/thread.o: @THREADHEADERS@
1231 # Declare targets that aren't real files
1232 .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
1233 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
1234 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1235 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1236 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1237 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
1238 .PHONY: smelly funny patchcheck
1240 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY