Use full package paths in imports.
[python/dscho.git] / Makefile.pre.in
blob2933c6539ca0ec1c552cc416c77dfb97b2fa2d8c
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 LINKCC=         @LINKCC@
34 AR=             @AR@
35 RANLIB=         @RANLIB@
37 # Shell used by make (some versions default to the login shell, which is bad)
38 SHELL=          /bin/sh
40 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
41 LN=             @LN@
43 # Portable install script (configure doesn't always guess right)
44 INSTALL=        @INSTALL@
45 INSTALL_PROGRAM=@INSTALL_PROGRAM@
46 INSTALL_SCRIPT= @INSTALL_SCRIPT@
47 INSTALL_DATA=   @INSTALL_DATA@
48 # Shared libraries must be installed with executable mode on some systems;
49 # rather than figuring out exactly which, we always give them executable mode.
50 # Also, making them read-only seems to be a good idea...
51 INSTALL_SHARED= ${INSTALL} -m 555
53 MAKESETUP=      $(srcdir)/Modules/makesetup
55 # Compiler options
56 OPT=            @OPT@
57 DEFS=           @DEFS@
58 CFLAGS=         $(OPT)
59 CPPFLAGS=       -I. -I$(srcdir)/Include $(DEFS)
60 LDFLAGS=        @LDFLAGS@
61 LDLAST=         @LDLAST@
62 SGI_ABI=        @SGI_ABI@
63 CCSHARED=       @CCSHARED@
64 LINKFORSHARED=  @LINKFORSHARED@
65 # Extra C flags added for building the interpreter object files.
66 CFLAGSFORSHARED=@CFLAGSFORSHARED@
67 # C flags used for building the interpreter object files
68 PY_CFLAGS=      $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
71 # Machine-dependent subdirectories
72 MACHDEP=        @MACHDEP@
74 # Install prefix for architecture-independent files
75 prefix=         @prefix@
77 # Install prefix for architecture-dependent files
78 exec_prefix=    @exec_prefix@
80 # Expanded directories
81 BINDIR=         $(exec_prefix)/bin
82 LIBDIR=         $(exec_prefix)/lib
83 MANDIR=         @mandir@
84 INCLUDEDIR=     @includedir@
85 CONFINCLUDEDIR= $(exec_prefix)/include
86 SCRIPTDIR=      $(prefix)/lib
88 # Detailed destination directories
89 BINLIBDEST=     $(LIBDIR)/python$(VERSION)
90 LIBDEST=        $(SCRIPTDIR)/python$(VERSION)
91 INCLUDEPY=      $(INCLUDEDIR)/python$(VERSION)
92 CONFINCLUDEPY=  $(CONFINCLUDEDIR)/python$(VERSION)
93 LIBP=           $(LIBDIR)/python$(VERSION)
95 # Symbols used for using shared libraries
96 SO=             @SO@
97 LDSHARED=       @LDSHARED@
98 BLDSHARED=      @BLDSHARED@
99 DESTSHARED=     $(BINLIBDEST)/lib-dynload
101 # Executable suffix (.exe on Windows and Mac OS X)
102 EXE=            @EXEEXT@
103 BUILDEXE=       @BUILDEXEEXT@
105 # Short name and location for Mac OS X Python framework
106 PYTHONFRAMEWORK=        @PYTHONFRAMEWORK@
107 PYTHONFRAMEWORKDIR=     @PYTHONFRAMEWORKDIR@
108 PYTHONFRAMEWORKPREFIX=  @PYTHONFRAMEWORKPREFIX@
109 PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
111 # Environment to run shared python without installed libraries
112 RUNSHARED=       @RUNSHARED@
114 # Modes for directories, executables and data files created by the
115 # install process.  Default to user-only-writable for all file types.
116 DIRMODE=        755
117 EXEMODE=        755
118 FILEMODE=       644
120 # configure script arguments
121 CONFIG_ARGS=    @CONFIG_ARGS@
124 # Subdirectories with code
125 SRCDIRS=        @SRCDIRS@
127 # Other subdirectories
128 SUBDIRSTOO=     Include Lib Misc Demo
130 # Files and directories to be distributed
131 CONFIGFILES=    configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
132 DISTFILES=      README ChangeLog $(CONFIGFILES)
133 DISTDIRS=       $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
134 DIST=           $(DISTFILES) $(DISTDIRS)
137 LIBRARY=        @LIBRARY@
138 LDLIBRARY=      @LDLIBRARY@
139 BLDLIBRARY=     @BLDLIBRARY@
140 DLLLIBRARY=     @DLLLIBRARY@
141 LDLIBRARYDIR=   @LDLIBRARYDIR@
142 INSTSONAME=     @INSTSONAME@
145 LIBS=           @LIBS@
146 LIBM=           @LIBM@
147 LIBC=           @LIBC@
148 SYSLIBS=        $(LIBM) $(LIBC)
149 SHLIBS=         @SHLIBS@
151 MAINOBJ=        @MAINOBJ@
152 THREADOBJ=      @THREADOBJ@
153 DLINCLDIR=      @DLINCLDIR@
154 DYNLOADFILE=    @DYNLOADFILE@
155 MACHDEP_OBJS=   @MACHDEP_OBJS@
156 UNICODE_OBJS=   @UNICODE_OBJS@
158 PYTHON=         python$(EXE)
159 BUILDPYTHON=    python$(BUILDEXE)
161 # === Definitions added by makesetup ===
164 ##########################################################################
165 # Modules
166 MODULE_OBJS=    \
167                 Modules/config.o \
168                 Modules/getpath.o \
169                 Modules/main.o \
170                 Modules/gcmodule.o
172 # Used of signalmodule.o is not available
173 SIGNAL_OBJS=    @SIGNAL_OBJS@
176 ##########################################################################
177 # Grammar
178 GRAMMAR_H=      $(srcdir)/Include/graminit.h
179 GRAMMAR_C=      $(srcdir)/Python/graminit.c
180 GRAMMAR_INPUT=  $(srcdir)/Grammar/Grammar
183 ##########################################################################
184 # Parser
185 PGEN=           Parser/pgen$(EXE)
187 POBJS=          \
188                 Parser/acceler.o \
189                 Parser/grammar1.o \
190                 Parser/listnode.o \
191                 Parser/node.o \
192                 Parser/parser.o \
193                 Parser/parsetok.o \
194                 Parser/tokenizer.o \
195                 Parser/bitset.o \
196                 Parser/metagrammar.o
198 PARSER_OBJS=    $(POBJS) Parser/myreadline.o
200 PGOBJS=         \
201                 Objects/obmalloc.o \
202                 Python/mysnprintf.o \
203                 Parser/firstsets.o \
204                 Parser/grammar.o \
205                 Parser/pgen.o \
206                 Parser/printgrammar.o \
207                 Parser/pgenmain.o
209 PGENOBJS=       $(PGENMAIN) $(POBJS) $(PGOBJS)
212 ##########################################################################
213 # Python
214 PYTHON_OBJS=    \
215                 Python/bltinmodule.o \
216                 Python/exceptions.o \
217                 Python/ceval.o \
218                 Python/compile.o \
219                 Python/codecs.o \
220                 Python/errors.o \
221                 Python/frozen.o \
222                 Python/frozenmain.o \
223                 Python/future.o \
224                 Python/getargs.o \
225                 Python/getcompiler.o \
226                 Python/getcopyright.o \
227                 Python/getmtime.o \
228                 Python/getplatform.o \
229                 Python/getversion.o \
230                 Python/graminit.o \
231                 Python/import.o \
232                 Python/importdl.o \
233                 Python/marshal.o \
234                 Python/modsupport.o \
235                 Python/mystrtoul.o \
236                 Python/mysnprintf.o \
237                 Python/pyfpe.o \
238                 Python/pystate.o \
239                 Python/pythonrun.o \
240                 Python/structmember.o \
241                 Python/symtable.o \
242                 Python/sysmodule.o \
243                 Python/traceback.o \
244                 Python/getopt.o \
245                 Python/$(DYNLOADFILE) \
246                 $(MACHDEP_OBJS) \
247                 $(THREADOBJ)
250 ##########################################################################
251 # Objects
252 OBJECT_OBJS=    \
253                 Objects/abstract.o \
254                 Objects/boolobject.o \
255                 Objects/bufferobject.o \
256                 Objects/cellobject.o \
257                 Objects/classobject.o \
258                 Objects/cobject.o \
259                 Objects/complexobject.o \
260                 Objects/descrobject.o \
261                 Objects/enumobject.o \
262                 Objects/fileobject.o \
263                 Objects/floatobject.o \
264                 Objects/frameobject.o \
265                 Objects/funcobject.o \
266                 Objects/intobject.o \
267                 Objects/iterobject.o \
268                 Objects/listobject.o \
269                 Objects/longobject.o \
270                 Objects/dictobject.o \
271                 Objects/methodobject.o \
272                 Objects/moduleobject.o \
273                 Objects/object.o \
274                 Objects/obmalloc.o \
275                 Objects/rangeobject.o \
276                 Objects/sliceobject.o \
277                 Objects/stringobject.o \
278                 Objects/structseq.o \
279                 Objects/tupleobject.o \
280                 Objects/typeobject.o \
281                 Objects/weakrefobject.o \
282                 $(UNICODE_OBJS)
285 ##########################################################################
286 # objects that get linked into the Python library
287 LIBRARY_OBJS=   \
288                 Modules/getbuildinfo.o \
289                 $(PARSER_OBJS) \
290                 $(OBJECT_OBJS) \
291                 $(PYTHON_OBJS) \
292                 $(MODULE_OBJS) \
293                 $(SIGNAL_OBJS) \
294                 $(MODOBJS)
296 #########################################################################
297 # Rules
299 # Default target
300 all:            $(BUILDPYTHON) oldsharedmods sharedmods
302 # Build the interpreter
303 $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
304                 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
305                         Modules/$(MAINOBJ) \
306                         $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
308 platform: $(BUILDPYTHON)
309         $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
312 # Build the shared modules
313 sharedmods: $(BUILDPYTHON)
314         case $$MAKEFLAGS in \
315         *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
316         *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
317         esac
319 # buildno should really depend on something like LIBRARY_SRC
320 buildno: $(PARSER_OBJS) \
321                 $(OBJECT_OBJS) \
322                 $(PYTHON_OBJS) \
323                 $(MODULE_OBJS) \
324                 $(SIGNAL_OBJS) \
325                 $(MODOBJS) \
326                 $(srcdir)/Modules/getbuildinfo.c
327         if test -f buildno; then \
328                 expr `cat buildno` + 1 >buildno1; \
329                 mv -f buildno1 buildno; \
330         else echo 1 >buildno; fi
332 # Build static library
333 # avoid long command lines, same as LIBRARY_OBJS
334 $(LIBRARY): $(LIBRARY_OBJS)
335         -rm -f $@
336         $(AR) cr $@ Modules/getbuildinfo.o
337         $(AR) cr $@ $(PARSER_OBJS)
338         $(AR) cr $@ $(OBJECT_OBJS)
339         $(AR) cr $@ $(PYTHON_OBJS)
340         $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
341         $(AR) cr $@ $(MODOBJS)
342         $(RANLIB) $@
344 libpython$(VERSION).so: $(LIBRARY_OBJS)
345         $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
347 libpython$(VERSION).sl: $(LIBRARY_OBJS)
348         $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
350 # This rule is here for OPENSTEP/Rhapsody/MacOSX
351 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): $(LIBRARY) $(PYTHONFRAMEWORKDIR)
352         $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
353         libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
354                 -framework System @LIBTOOL_CRUFT@
356 # This rule builds the Cygwin Python DLL
357 libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
358         $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
359                 $(LIBS) $(MODLIBS) $(SYSLIBS)
362 oldsharedmods: $(SHAREDMODS)
365 Makefile Modules/config.c: Makefile.pre \
366                                 $(srcdir)/Modules/config.c.in \
367                                 $(MAKESETUP) \
368                                 Modules/Setup.config \
369                                 Modules/Setup \
370                                 Modules/Setup.local
371         $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
372                                 -s Modules \
373                                 Modules/Setup.config \
374                                 Modules/Setup.local \
375                                 Modules/Setup
376         @mv config.c Modules
377         @echo "The Makefile was updated, you may need to re-run make."
380 Modules/Setup: $(srcdir)/Modules/Setup.dist
381         @if test -f Modules/Setup; then \
382                 echo "-----------------------------------------------"; \
383                 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
384                 echo "check to make sure you have all the updates you"; \
385                 echo "need in your Modules/Setup file."; \
386                 echo "Usually, copying Setup.dist to Setup will work."; \
387                 echo "-----------------------------------------------"; \
388         fi
390 ############################################################################
391 # Special rules for object files
393 Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
394         $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
396 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
397         $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
398                 -DPREFIX='"$(prefix)"' \
399                 -DEXEC_PREFIX='"$(exec_prefix)"' \
400                 -DVERSION='"$(VERSION)"' \
401                 -DVPATH='"$(VPATH)"' \
402                 -o $@ $(srcdir)/Modules/getpath.c
404 Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
405         $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
408 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
409                 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
411 $(PGEN):        $(PGENOBJS)
412                 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
414 Parser/grammar.o:       $(srcdir)/Parser/grammar.c \
415                                 $(srcdir)/Include/token.h \
416                                 $(srcdir)/Include/grammar.h
417 Parser/metagrammar.o:   $(srcdir)/Parser/metagrammar.c
420 Python/compile.o Python/symtable.o: $(GRAMMAR_H)
422 Python/getplatform.o: $(srcdir)/Python/getplatform.c
423                 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
425 Python/importdl.o: $(srcdir)/Python/importdl.c
426                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
428 Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
429                                 $(srcdir)/Objects/unicodetype_db.h
431 ############################################################################
432 # Header files
434 PYTHON_HEADERS= \
435                 Include/Python.h \
436                 Include/abstract.h \
437                 Include/boolobject.h \
438                 Include/bufferobject.h \
439                 Include/ceval.h \
440                 Include/classobject.h \
441                 Include/cobject.h \
442                 Include/codecs.h \
443                 Include/compile.h \
444                 Include/complexobject.h \
445                 Include/descrobject.h \
446                 Include/dictobject.h \
447                 Include/enumobject.h \
448                 Include/fileobject.h \
449                 Include/floatobject.h \
450                 Include/funcobject.h \
451                 Include/import.h \
452                 Include/intobject.h \
453                 Include/intrcheck.h \
454                 Include/iterobject.h \
455                 Include/listobject.h \
456                 Include/longobject.h \
457                 Include/methodobject.h \
458                 Include/modsupport.h \
459                 Include/moduleobject.h \
460                 Include/object.h \
461                 Include/objimpl.h \
462                 Include/patchlevel.h \
463                 Include/pydebug.h \
464                 Include/pyerrors.h \
465                 Include/pyfpe.h \
466                 Include/pymem.h \
467                 Include/pyport.h \
468                 Include/pystate.h \
469                 Include/pythonrun.h \
470                 Include/rangeobject.h \
471                 Include/sliceobject.h \
472                 Include/stringobject.h \
473                 Include/structseq.h \
474                 Include/structmember.h \
475                 Include/symtable.h \
476                 Include/sysmodule.h \
477                 Include/traceback.h \
478                 Include/tupleobject.h \
479                 Include/unicodeobject.h \
480                 Include/weakrefobject.h \
481                 pyconfig.h
483 $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
486 ######################################################################
488 # Test the interpreter (twice, once without .pyc files, once with)
489 TESTOPTS=       -l
490 TESTPROG=       $(srcdir)/Lib/test/regrtest.py
491 TESTPYTHON=     $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
492 test:           all platform
493                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
494                 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
495                 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
497 QUICKTESTOPTS=  $(TESTOPTS) -x test_thread test_signal test_strftime \
498                 test_unicodedata test_re test_sre test_select test_poll \
499                 test_linuxaudiodev test_struct test_sunaudiodev test_zlib 
500 quicktest:      all platform
501                 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
502                 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
503                 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
505 MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
506                 test_longexp
507 memtest:        all platform
508                 -rm -f $(srcdir)/Lib/test/*.py[co]
509                 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
510                 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
512 # Install everything
513 install:        altinstall bininstall maninstall
515 # Install almost everything without disturbing previous versions
516 altinstall:     altbininstall libinstall inclinstall libainstall \
517                 sharedinstall oldsharedinstall
519 # Install shared libraries enabled by Setup
520 DESTDIRS=       $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
522 oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
523                 @for i in X $(SHAREDMODS); do \
524                   if test $$i != X; then \
525                     echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
526                     $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
527                   fi; \
528                 done
530 $(DESTSHARED):
531                 @for i in $(DESTDIRS); \
532                 do \
533                         if test ! -d $$i; then \
534                                 echo "Creating directory $$i"; \
535                                 $(INSTALL) -d -m $(DIRMODE) $$i; \
536                         else    true; \
537                         fi; \
538                 done
541 # Install the interpreter (by creating a hard link to python$(VERSION))
542 bininstall:     altbininstall
543         -if test -f $(BINDIR)/$(PYTHON); \
544         then rm -f $(BINDIR)/$(PYTHON); \
545         else true; \
546         fi
547         (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
549 # Install the interpreter with $(VERSION) affixed
550 # This goes into $(exec_prefix)
551 altbininstall:  $(BUILDPYTHON)
552         @for i in $(BINDIR) $(LIBDIR); \
553         do \
554                 if test ! -d $$i; then \
555                         echo "Creating directory $$i"; \
556                         $(INSTALL) -d -m $(DIRMODE) $$i; \
557                 else    true; \
558                 fi; \
559         done
560         $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE)
561         if test -f libpython$(VERSION)$(SO); then \
562                 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \
563         else    true; \
564         fi
565         if test -f "$(DLLLIBRARY)"; then \
566                 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
567         else    true; \
568         fi
570 # Install the manual page
571 maninstall:
572         @for i in $(MANDIR) $(MANDIR)/man1; \
573         do \
574                 if test ! -d $$i; then \
575                         echo "Creating directory $$i"; \
576                         $(INSTALL) -d -m $(DIRMODE) $$i; \
577                 else    true; \
578                 fi; \
579         done
580         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
581                 $(MANDIR)/man1/python.1
583 # Install the library
584 PLATDIR=        plat-$(MACHDEP)
585 MACHDEPS=       $(PLATDIR)
586 XMLLIBSUBDIRS=  xml xml/dom xml/parsers xml/sax
587 LIBSUBDIRS=     lib-old lib-tk site-packages test test/output test/data \
588                 encodings email compiler hotshot \
589                 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
590 libinstall:     $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
591         @for i in $(SCRIPTDIR) $(LIBDEST); \
592         do \
593                 if test ! -d $$i; then \
594                         echo "Creating directory $$i"; \
595                         $(INSTALL) -d -m $(DIRMODE) $$i; \
596                 else    true; \
597                 fi; \
598         done
599         @for d in $(LIBSUBDIRS); \
600         do \
601                 a=$(srcdir)/Lib/$$d; \
602                 if test ! -d $$a; then continue; else true; fi; \
603                 b=$(LIBDEST)/$$d; \
604                 if test ! -d $$b; then \
605                         echo "Creating directory $$b"; \
606                         $(INSTALL) -d -m $(DIRMODE) $$b; \
607                 else    true; \
608                 fi; \
609         done
610         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
611         do \
612                 if test -x $$i; then \
613                         $(INSTALL_SCRIPT) $$i $(LIBDEST); \
614                         echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
615                 else \
616                         $(INSTALL_DATA) $$i $(LIBDEST); \
617                         echo $(INSTALL_DATA) $$i $(LIBDEST); \
618                 fi; \
619         done
620         @for d in $(LIBSUBDIRS); \
621         do \
622                 a=$(srcdir)/Lib/$$d; \
623                 if test ! -d $$a; then continue; else true; fi; \
624                 b=$(LIBDEST)/$$d; \
625                 for i in $$a/*; \
626                 do \
627                         case $$i in \
628                         *CVS) ;; \
629                         *.py[co]) ;; \
630                         *.orig) ;; \
631                         *~) ;; \
632                         *) \
633                                 if test -d $$i; then continue; fi; \
634                                 if test -x $$i; then \
635                                     echo $(INSTALL_SCRIPT) $$i $$b; \
636                                     $(INSTALL_SCRIPT) $$i $$b; \
637                                 else \
638                                     echo $(INSTALL_DATA) $$i $$b; \
639                                     $(INSTALL_DATA) $$i $$b; \
640                                 fi;; \
641                         esac; \
642                 done; \
643         done
644         $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
645         PYTHONPATH=$(LIBDEST)  $(RUNSHARED) \
646                 ./$(BUILDPYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
647                 $(LIBDEST)
648         PYTHONPATH=$(LIBDEST) $(RUNSHARED) \
649                 ./$(BUILDPYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
651 # Create the PLATDIR source directory, if one wasn't distributed..
652 $(srcdir)/Lib/$(PLATDIR):
653         mkdir $(srcdir)/Lib/$(PLATDIR)
654         cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
655         export PATH; PATH="`pwd`:$$PATH"; \
656         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
657         export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
658         export EXE; EXE="$(BUILDEXE)"; \
659         cd $(srcdir)/Lib/$(PLATDIR); ./regen
661 # Install the include files
662 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
663 inclinstall:
664         @for i in $(INCLDIRSTOMAKE); \
665         do \
666                 if test ! -d $$i; then \
667                         echo "Creating directory $$i"; \
668                         $(INSTALL) -d -m $(DIRMODE) $$i; \
669                 else    true; \
670                 fi; \
671         done
672         @for i in $(srcdir)/Include/*.h; \
673         do \
674                 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
675                 $(INSTALL_DATA) $$i $(INCLUDEPY); \
676         done
677         $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h
679 # Install the library and miscellaneous stuff needed for extending/embedding
680 # This goes into $(exec_prefix)
681 LIBPL=          $(LIBP)/config
682 libainstall:    all
683         @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
684         do \
685                 if test ! -d $$i; then \
686                         echo "Creating directory $$i"; \
687                         $(INSTALL) -d -m $(DIRMODE) $$i; \
688                 else    true; \
689                 fi; \
690         done
691         @if test -d $(LIBRARY); then :; else \
692                 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
693                         $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
694                         $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
695                 else \
696                         echo Skip install of $(LIBRARY) - use make frameworkinstall; \
697                 fi; \
698         fi
699         $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
700         $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
701         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
702         $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
703         $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
704         $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
705         $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
706         $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
707         $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
708         @if [ -s Modules/python.exp -a \
709                 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
710                 echo; echo "Installing support files for building shared extension modules on AIX:"; \
711                 $(INSTALL_DATA) Modules/python.exp              \
712                                 $(LIBPL)/python.exp;            \
713                 echo; echo "$(LIBPL)/python.exp";               \
714                 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
715                                 $(LIBPL)/makexp_aix;            \
716                 echo "$(LIBPL)/makexp_aix";                     \
717                 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
718                                 $(LIBPL)/ld_so_aix;             \
719                 echo "$(LIBPL)/ld_so_aix";                      \
720                 echo; echo "See Misc/AIX-NOTES for details.";   \
721         else true; \
722         fi
723         @case "$(MACHDEP)" in beos*) \
724                 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
725                 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README;        \
726                 echo; echo "$(LIBPL)/README";                   \
727                 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
728                 echo "$(LIBPL)/ar_beos";                        \
729                 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
730                 echo "$(LIBPL)/ld_so_beos";                     \
731                 echo; echo "See Misc/BeOS-NOTES for details.";  \
732                 ;; \
733         esac
735 # Install the dynamically loadable modules
736 # This goes into $(exec_prefix)
737 sharedinstall:
738         $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
739                 --prefix=$(prefix) \
740                 --install-scripts=$(BINDIR) \
741                 --install-platlib=$(DESTSHARED)
743 # Install a MacOSX framework During build (before
744 # setup.py), make a minimal Python.framework directory structure in the build
745 # directory. This framework is minimal, it doesn't contain the Lib directory
746 # and such, but together with some magic in Modules/getpath.c it is good enough
747 # to run python from the install dir.
749 FRAMEWORKDEST=$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
750 RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
751 $(PYTHONFRAMEWORKDIR): $(RESSRCDIR)/Info.plist \
752                 $(RESSRCDIR)/version.plist \
753                 $(RESSRCDIR)/English.lproj/InfoPlist.strings
754         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
755                 echo Not configured with --enable-framework; \
756                 exit 1; \
757         else true; \
758         fi
759         $(INSTALL) -d -m $(DIRMODE)  $(FRAMEWORKDEST)/Resources/English.lproj
760         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKDEST)/Resources/Info.plist
761         $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKDEST)/Resources/version.plist
762         $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
763                 $(FRAMEWORKDEST)/Resources/English.lproj/InfoPlist.strings
764         $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
765         $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
766         $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
767         $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
769 # On install, we re-make the framework
770 # structure in the install location, /Library/Frameworks/ or the argument to
771 # --enable-framework. If --enable-framework has been specified then we have
772 # automatically set prefix to the location deep down in the framework, so we
773 # only have to cater for the structural bits of the framework.
775 frameworkinstall: install frameworkinfrastructureinstall
776 FRAMEWORKFINALDEST=$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)
777 frameworkinfrastructureinstall: $(LDLIBRARY)
778         @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
779                 echo Not configured with --enable-framework; \
780                 exit 1; \
781         else true; \
782         fi
783         @for i in $(FRAMEWORKFINALDEST)/Resources/English.lproj $(FRAMEWORKFINALDEST)/lib; do\
784                 if test ! -d $$i; then \
785                         echo "Creating directory $$i"; \
786                         $(INSTALL) -d -m $(DIRMODE) $$i; \
787                 else    true; \
788                 fi; \
789         done
790         $(LN) -sf $(INCLUDEPY) $(FRAMEWORKFINALDEST)/Headers
791         $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKFINALDEST)/Resources/Info.plist
792         $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKFINALDEST)/Resources/version.plist
793         $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
794                 $(FRAMEWORKFINALDEST)/Resources/English.lproj/InfoPlist.strings
795         $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
796         $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python
797         $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers
798         $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources
799         $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
801 # Build Python executable that can run GUI code. Another MacOSX pseudo
802 # target.
803 python.app:
804         $(MAKE) -f $(srcdir)/Mac/OSX/Makefile install installmacsubtree \
805                 PYTHONSRCDIR=$(srcdir) PYTHONBUILDDIR=.
807 # Build the toplevel Makefile
808 Makefile.pre: Makefile.pre.in config.status
809         CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
810         $(MAKE) -f Makefile.pre Makefile
812 # Run the configure script.
813 config.status:  $(srcdir)/configure
814         $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
816 .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
818 # Some make's put the object file in the current directory
819 .c.o:
820         $(CC) -c $(PY_CFLAGS) -o $@ $<
822 # Rerun configure with the same options as it was run last time,
823 # provided the config.status script exists
824 recheck:
825         $(SHELL) config.status --recheck
826         $(SHELL) config.status
828 # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
829 autoconf:
830         (cd $(srcdir); autoconf)
831         (cd $(srcdir); autoheader)
833 # Create a tags file for vi
834 tags::
835         cd $(srcdir); \
836         ctags -w -t Include/*.h; \
837         for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
838         done; \
839         sort -o tags tags
841 # Create a tags file for GNU Emacs
842 TAGS::
843         cd $(srcdir); \
844         etags Include/*.h; \
845         for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
847 # Sanitation targets -- clean leaves libraries, executables and tags
848 # files, which clobber removes those as well
850 clean:
851         find . -name '*.o' -exec rm -f {} ';'
852         find . -name '*.s[ol]' -exec rm -f {} ';'
853         find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
855 clobber: clean
856         -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
857                 tags TAGS \
858                 config.cache config.log pyconfig.h Modules/config.c
859         -rm -rf build platform
861 # Make things extra clean, before making a distribution:
862 # remove all generated files, even Makefile[.pre]
863 distclean: clobber
864         -rm -f core Makefile Makefile.pre buildno config.status \
865                 Modules/Setup Modules/Setup.local Modules/Setup.config
866         find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
867                            -o -name '[@,#]*' -o -name '*.old' \
868                            -o -name '*.orig' -o -name '*.rej' \
869                            -o -name '*.bak' ')' \
870                            -exec rm -f {} ';'
872 # Check for smelly exported symbols (not starting with Py/_Py)
873 smelly: all
874         nm -p $(LIBRARY) | \
875                 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
877 # Find files with funny names
878 funny:
879         find $(DISTDIRS) -type d \
880                 -o -name '*.[chs]' \
881                 -o -name '*.py' \
882                 -o -name '*.doc' \
883                 -o -name '*.sty' \
884                 -o -name '*.bib' \
885                 -o -name '*.dat' \
886                 -o -name '*.el' \
887                 -o -name '*.fd' \
888                 -o -name '*.in' \
889                 -o -name '*.tex' \
890                 -o -name '*,[vpt]' \
891                 -o -name 'Setup' \
892                 -o -name 'Setup.*' \
893                 -o -name README \
894                 -o -name Makefile \
895                 -o -name ChangeLog \
896                 -o -name Repository \
897                 -o -name Root \
898                 -o -name Entries \
899                 -o -name Tag \
900                 -o -name tags \
901                 -o -name TAGS \
902                 -o -name .cvsignore \
903                 -o -name MANIFEST \
904                 -o -print
906 # Dependencies
908 Python/thread.o: @THREADHEADERS@
910 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY