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