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