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