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