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