home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Languages / Python / python-14-src / Makefile.in < prev    next >
Encoding:
Makefile  |  1997-01-17  |  16.2 KB  |  536 lines

  1. ########################################################################
  2. # Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
  3. # The Netherlands.
  4. #
  5. #                         All Rights Reserved
  6. #
  7. # Permission to use, copy, modify, and distribute this software and its
  8. # documentation for any purpose and without fee is hereby granted,
  9. # provided that the above copyright notice appear in all copies and that
  10. # both that copyright notice and this permission notice appear in
  11. # supporting documentation, and that the names of Stichting Mathematisch
  12. # Centrum or CWI or Corporation for National Research Initiatives or
  13. # CNRI not be used in advertising or publicity pertaining to
  14. # distribution of the software without specific, written prior
  15. # permission.
  16. # While CWI is the initial source for this software, a modified version
  17. # is made available by the Corporation for National Research Initiatives
  18. # (CNRI) at the Internet address ftp://ftp.python.org.
  19. # STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
  20. # REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  21. # MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
  22. # CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  23. # DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  24. # PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  25. # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  26. # PERFORMANCE OF THIS SOFTWARE.
  27. ########################################################################
  28.  
  29. # Top-level Makefile for Python
  30. # As distributed, this file is called Makefile.in; it is processed
  31. # into the real Makefile by running the script ./configure, which
  32. # replaces things like @spam@ with values appropriate for your system.
  33. # This means that if you edit Makefile, your changes get lost the next
  34. # time you run the configure script.  Ideally, you can do:
  35. #    ./configure
  36. #    make
  37. #    make test
  38. #    make install
  39. # The top-level Makefile invokes make recursively in a number of
  40. # subdirectories (see the SUBDIRS variable below).  If you want to,
  41. # you can invoke make in individual subdirectories.  However, the
  42. # sub-Makefiles are also generated by configure, and the quickest way
  43. # to make sure they are up to date is by running make (or "make
  44. # Makefiles") at the top level.  This is particularly important for
  45. # Modules/Makefile, which has to be regenerated every time you edit
  46. # Modules/Setup.  The python executable is built in the Modules
  47. # directory and then moved to the top-level directory.  The recursive
  48. # makes pass three options to subordinate makes: OPT (a quick way to
  49. # change some compiler options; it usually defaults to -O), prefix and
  50. # exec_prefix (the installation paths).
  51. # If you have a previous version of Python installed that you don't
  52. # want to overwrite, you can use "make altinstall" instead of "make
  53. # install".  This changes the install procedure so it installs the
  54. # Python binary as "python<version>".  The libraries and include files
  55. # are always installed in a subdirectory called "python<version>".
  56. # "make altinstall" does not install the manual page.  If you want to
  57. # make this installation the "official" installation but want to keep
  58. # the old binary around "just in case", rename the installed python
  59. # binary to "python<oldversion>" before running "make install".
  60. # (This only works between different versions, e.g. 1.3 and 1.4 --
  61. # different betas of the same version will overwrite each other in
  62. # installation unless you override the VERSION Make variable.)
  63. # In fact, "make install" or "make bininstall" installs the binary
  64. # as python<version> and makes a hard link to python, so when
  65. # installing a new version in the future, nothing of the current
  66. # version will be lost (except for the man page).
  67. # If recursive makes fail, try invoking make as "make MAKE=make".
  68. # See also the section "Build instructions" in the README file.
  69.  
  70. # Interpreter version number, for library destination pathnames
  71. VERSION=    1.4
  72.  
  73. # Substitutions by configure
  74. srcdir=        @srcdir@
  75. VPATH=        @srcdir@
  76. RANLIB=        @RANLIB@
  77.  
  78. # Machine-dependent subdirectories
  79. MACHDEP=    @MACHDEP@
  80.  
  81. # Install prefix for architecture-independent files
  82. prefix=        @prefix@
  83.  
  84. # Install prefix for architecture-dependent files
  85. exec_prefix=    @exec_prefix@
  86.  
  87. # Expanded directories
  88. BINDIR=        $(exec_prefix)/bin
  89. LIBDIR=        $(exec_prefix)/lib
  90. MANDIR=        $(prefix)/man
  91. INCLUDEDIR=    $(prefix)/include
  92. SCRIPTDIR=    $(prefix)/lib
  93.  
  94. # Detailed destination directories
  95. BINLIBDEST=    $(LIBDIR)/python$(VERSION)
  96. LIBDEST=    $(SCRIPTDIR)/python$(VERSION)
  97. INCLUDEPY=    $(INCLUDEDIR)/python$(VERSION)
  98. LIBP=        $(LIBDIR)/python$(VERSION)
  99.  
  100. # Symbols used for using shared libraries
  101. SO=        @SO@
  102. LDSHARED=    @LDSHARED@
  103. CCSHARED=    @CCSHARED@
  104. LINKFORSHARED=    @LINKFORSHARED@
  105. DESTSHARED=    $(BINLIBDEST)/sharedmodules
  106.  
  107. # Shell used by make (some versions default to the login shell, which is bad)
  108. SHELL=        /bin/sh
  109.  
  110. # Programs used by install targets
  111. INSTALL=    @INSTALL@
  112. INSTALL_PROGRAM=@INSTALL_PROGRAM@
  113. INSTALL_DATA=    @INSTALL_DATA@
  114.  
  115. # --with-PACKAGE options for configure script
  116. # e.g. --with-readline --with-svr5 --with-solaris --with-thread
  117. # (see README for an explanation)
  118. WITH=        
  119.  
  120. # Compiler options passed to subordinate makes
  121. OPT=        @OPT@
  122.  
  123. # Subdirectories where to run make recursively
  124. SUBDIRS=    Parser Objects Python Modules
  125.  
  126. # Other subdirectories
  127. SUBDIRSTOO=    Include Lib Doc Misc Demo Grammar
  128.  
  129. # Files and directories to be distributed
  130. CONFIGFILES=    configure configure.in acconfig.h config.h.in Makefile.in
  131. DISTFILES=    README ChangeLog $(CONFIGFILES)
  132. DISTDIRS=    $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
  133. DIST=        $(DISTFILES) $(DISTDIRS)
  134.  
  135. # Default target
  136. all:        python
  137.  
  138. # Build the interpreter
  139. python:        Makefiles
  140.         @for i in $(SUBDIRS); do \
  141.             (echo Making in subdirectory $$i; cd $$i; \
  142.              $(MAKE) OPT="$(OPT)" \
  143.                  VERSION="$(VERSION)" \
  144.                      prefix="$(prefix)" \
  145.                  exec_prefix="$(exec_prefix)" \
  146.                  all); \
  147.         done
  148.  
  149. # Test the interpreter (twice, once without .pyc files, once with)
  150. TESTPATH=    $(srcdir)/Lib:$(srcdir)/Lib/test:./Modules
  151. test:        python
  152.         -rm -f $(srcdir)/Lib/test/*.pyc
  153.         PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
  154.         PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
  155.  
  156. # Install everything
  157. install:    altinstall bininstall maninstall
  158.  
  159. # Install almost everything without disturbing previous versions
  160. altinstall:    altbininstall libinstall inclinstall libainstall sharedinstall
  161.  
  162. # Install the interpreter (by creating a hard link to python$(VERSION))
  163. bininstall:    altbininstall
  164.         -if test -f $(BINDIR)/python; \
  165.         then rm -f $(BINDIR)/python; \
  166.         else true; \
  167.         fi
  168.         (cd $(BINDIR); ln python$(VERSION) python)
  169.  
  170. # Install the interpreter with $(VERSION) affixed
  171. # This goes into $(exec_prefix)
  172. altbininstall:    python
  173.         @for i in $(BINDIR); \
  174.         do \
  175.             if test ! -d $$i; then \
  176.                 echo "Creating directory $$i"; \
  177.                 mkdir $$i; \
  178.                 chmod 755 $$i; \
  179.             else    true; \
  180.             fi; \
  181.         done
  182.         $(INSTALL_PROGRAM) python $(BINDIR)/python$(VERSION)
  183.  
  184. # Install the manual page
  185. maninstall:
  186.         @for i in $(MANDIR) $(MANDIR)/man1; \
  187.         do \
  188.             if test ! -d $$i; then \
  189.                 echo "Creating directory $$i"; \
  190.                 mkdir $$i; \
  191.                 chmod 755 $$i; \
  192.             else    true; \
  193.             fi; \
  194.         done
  195.         $(INSTALL_DATA) $(srcdir)/Misc/python.man \
  196.             $(MANDIR)/man1/python.1
  197.  
  198. # Install the library
  199. MACHDEPS=    $(MACHDEP)
  200. LIBSUBDIRS=    stdwin tkinter test $(MACHDEPS)
  201. libinstall:    python $(srcdir)/Lib/$(MACHDEP)
  202.         @for i in $(SCRIPTDIR) $(LIBDEST); \
  203.         do \
  204.             if test ! -d $$i; then \
  205.                 echo "Creating directory $$i"; \
  206.                 mkdir $$i; \
  207.                 chmod 755 $$i; \
  208.             else    true; \
  209.             fi; \
  210.         done
  211.         @for d in $(LIBSUBDIRS); \
  212.         do \
  213.             a=$(srcdir)/Lib/$$d; \
  214.             if test ! -d $$a; then continue; else true; fi; \
  215.             b=$(LIBDEST)/$$d; \
  216.             if test ! -d $$b; then \
  217.                 echo "Creating directory $$b"; \
  218.                 mkdir $$b; \
  219.                 chmod 755 $$b; \
  220.             else    true; \
  221.             fi; \
  222.         done
  223.         @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
  224.         do \
  225.             if test -x $$i; then \
  226.                 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
  227.                 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
  228.             else \
  229.                 $(INSTALL_DATA) $$i $(LIBDEST); \
  230.                 echo $(INSTALL_DATA) $$i $(LIBDEST); \
  231.             fi; \
  232.         done
  233.         @for d in $(LIBSUBDIRS); \
  234.         do \
  235.             a=$(srcdir)/Lib/$$d; \
  236.             if test ! -d $$a; then continue; else true; fi; \
  237.             b=$(LIBDEST)/$$d; \
  238.             for i in $$a/*; \
  239.             do \
  240.                 case $$i in \
  241.                 *CVS) ;; \
  242.                 *.pyc) ;; \
  243.                 *~) ;; \
  244.                 *) \
  245.                     if test -x $$i; then \
  246.                         echo $(INSTALL_PROGRAM) $$i $$b; \
  247.                         $(INSTALL_PROGRAM) $$i $$b; \
  248.                     else \
  249.                         echo $(INSTALL_DATA) $$i $$b; \
  250.                         $(INSTALL_DATA) $$i $$b; \
  251.                     fi;; \
  252.                 esac; \
  253.             done; \
  254.         done
  255.         PYTHONPATH=$(LIBDEST) \
  256.             ./python $(LIBDEST)/compileall.py $(LIBDEST)
  257.  
  258. # Create the MACHDEP source directory, if one wasn't distributed..
  259. $(srcdir)/Lib/$(MACHDEP):
  260.         mkdir $(srcdir)/Lib/$(MACHDEP)
  261.         cp $(srcdir)/Lib/generic/regen $(srcdir)/Lib/$(MACHDEP)/regen
  262.         export PATH; PATH="`pwd`:$$PATH"; \
  263.         export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
  264.         cd $(srcdir)/Lib/$(MACHDEP); ./regen
  265.  
  266. # Install the include files
  267. inclinstall:
  268.         @for i in $(INCLUDEDIR) $(INCLUDEPY); \
  269.         do \
  270.             if test ! -d $$i; then \
  271.                 echo "Creating directory $$i"; \
  272.                 mkdir $$i; \
  273.                 chmod 755 $$i; \
  274.             else    true; \
  275.             fi; \
  276.         done
  277.         @for i in $(srcdir)/Include/*.h; \
  278.         do \
  279.             echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
  280.             $(INSTALL_DATA) $$i $(INCLUDEPY); \
  281.         done
  282.  
  283. # Install the lib*.a files and miscellaneous stuff needed by extensions
  284. # This goes into $(exec_prefix)
  285. LIBPL=        $(LIBP)/config
  286. libainstall:    all
  287.         @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
  288.         do \
  289.             if test ! -d $$i; then \
  290.                 echo "Creating directory $$i"; \
  291.                 mkdir $$i; \
  292.                 chmod 755 $$i; \
  293.             else    true; \
  294.             fi; \
  295.         done
  296.         @for i in $(SUBDIRS); do \
  297.             echo Installing in subdirectory $$i; \
  298.             $(INSTALL_DATA) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
  299.             $(RANLIB) $(LIBPL)/lib$$i.a; \
  300.         done
  301.         $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
  302.         $(INSTALL_DATA) $(srcdir)/Modules/getpath.c $(LIBPL)/getpath.c
  303.         $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
  304.         $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
  305.         $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
  306.         $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
  307.         $(INSTALL_DATA) config.h $(LIBPL)/config.h
  308.         $(INSTALL_DATA) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
  309.         $(INSTALL_DATA) Modules/main.o $(LIBPL)/main.o
  310.  
  311. # Install the dynamically loadable modules
  312. # This goes into $(exec_prefix)
  313. sharedinstall:
  314.         cd Modules; $(MAKE) \
  315.             OPT="$(OPT)" \
  316.             VERSION="$(VERSION)" \
  317.             SO="$(SO)" \
  318.             LDSHARED="$(LDSHARED)" \
  319.             CCSHARED="$(CCSHARED)" \
  320.             LINKFORSHARED="$(LINKFORSHARED)" \
  321.             DESTSHARED="$(DESTSHARED)" \
  322.             INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
  323.             prefix="$(prefix)" \
  324.             exec_prefix="$(exec_prefix)" \
  325.             sharedinstall
  326.  
  327. # Build the sub-Makefiles
  328. Makefiles:    config.status Modules/Makefile.pre
  329.         (cd Modules; $(MAKE) -f Makefile.pre Makefile)
  330.         @for i in . $(SUBDIRS); do \
  331.             (echo making Makefile in subdirectory $$i; cd $$i; \
  332.              $(MAKE) Makefile); \
  333.         done
  334.  
  335. # Build the intermediate Makefile in Modules
  336. Modules/Makefile.pre: config.status
  337.         $(SHELL) config.status
  338.  
  339. # Build the toplevel Makefile
  340. Makefile:    Makefile.in config.status
  341.         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
  342.  
  343. # Run the configure script.  If config.status already exists,
  344. # call it with the --recheck argument, which reruns configure with the
  345. # same options as it was run last time; otherwise run the configure
  346. # script with options taken from the $(WITH) variable
  347. config.status:    $(srcdir)/configure
  348.         if test -f config.status; \
  349.         then $(SHELL) config.status --recheck; \
  350.              $(SHELL) config.status; \
  351.         else $(SHELL) $(srcdir)/configure $(WITH); \
  352.         fi
  353.  
  354. .PRECIOUS:    config.status python
  355.  
  356. # Rerun configure with the same options as it was run last time,
  357. # provided the config.status script exists
  358. recheck:
  359.         $(SHELL) config.status --recheck
  360.         $(SHELL) config.status
  361.  
  362. # Rebuild the configure script from configure.in; also rebuild config.h.in
  363. autoconf:
  364.         (cd $(srcdir); autoconf)
  365.         (cd $(srcdir); autoheader)
  366.  
  367. # Create a tags file for vi
  368. tags::
  369.         ctags -w -t Include/*.h
  370.         for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
  371.         sort tags -o tags
  372.  
  373. # Create a tags file for GNU Emacs
  374. TAGS::
  375.         etags Include/*.h
  376.         for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
  377.  
  378. # Add dependencies to sub-Makefiles
  379. depend:
  380.         @for i in $(SUBDIRS); do \
  381.             (echo making depend in subdirectory $$i; cd $$i; \
  382.              $(MAKE) depend); \
  383.         done
  384.  
  385. # Sanitation targets -- clean leaves libraries, executables and tags
  386. # files, which clobber removes those as well
  387.  
  388. localclean::
  389.         -rm -f core *~ [@,#]* *.old *.orig *.rej
  390.  
  391. clean:        localclean
  392.         -for i in $(SUBDIRS); do \
  393.             (echo making clean in subdirectory $$i; cd $$i; \
  394.              if test -f Makefile; \
  395.              then $(MAKE) clean; \
  396.              else $(MAKE) -f Makefile.*in clean; \
  397.              fi); \
  398.         done
  399.  
  400. localclobber:    localclean
  401.         -rm -f tags TAGS python
  402.         -rm -f config.log config.cache config.h
  403.  
  404. clobber:    localclobber
  405.         -for i in $(SUBDIRS); do \
  406.             (echo clobbering subdirectory $$i; cd $$i; \
  407.              if test -f Makefile; \
  408.              then $(MAKE) clobber; \
  409.              else $(MAKE) -f $(srcdir)/Makefile.in clobber; \
  410.              fi); \
  411.         done
  412.  
  413. # Make things extra clean, before making a distribution:
  414. # remove all generated files, even Makefile[.pre]
  415. distclean:    clobber
  416.         -$(MAKE) -f $(srcdir)/Makefile.in \
  417.             SUBDIRS="$(SUBDIRSTOO)" clobber
  418.         -rm -f config.status config.log config.cache config.h Makefile
  419.         -rm -f Modules/Makefile
  420.         -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
  421.              for f in $$i/*.in; do \
  422.                 f=`basename "$$f" .in`; \
  423.                  if test "$$f" != "*"; then \
  424.                     echo rm -f "$$i/$$f"; \
  425.                      rm -f "$$i/$$f"; \
  426.                 fi; \
  427.              done; \
  428.         done
  429.  
  430. # Check for smelly exported symbols (not starting with Py/_Py)
  431. smelly: all
  432.     for i in $(SUBDIRS); do \
  433.         echo --- $$i ---; \
  434.         nm -p $$i/lib$$i.a | \
  435.         sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
  436.     done
  437.  
  438. # Find files with funny names
  439. funny:
  440.         find $(DISTDIRS) -type d \
  441.             -o -name '*.[chs]' \
  442.             -o -name '*.py' \
  443.             -o -name '*.doc' \
  444.             -o -name '*.sty' \
  445.             -o -name '*.bib' \
  446.             -o -name '*.dat' \
  447.             -o -name '*.el' \
  448.             -o -name '*.fd' \
  449.             -o -name '*.in' \
  450.             -o -name '*.tex' \
  451.             -o -name '*,[vpt]' \
  452.             -o -name 'Setup' \
  453.             -o -name 'Setup.*' \
  454.             -o -name README \
  455.             -o -name Makefile \
  456.             -o -name ChangeLog \
  457.             -o -name Repository \
  458.             -o -name Root \
  459.             -o -name Entries \
  460.             -o -name Tag \
  461.             -o -name tags \
  462.             -o -name TAGS \
  463.             -o -name .cvsignore \
  464.             -o -name MANIFEST \
  465.             -o -print
  466.  
  467. # Build a NeXTSTEP Package: useful targets are `package' and `package-bin'
  468.  
  469. .SUFFIXES:    .root .pkg
  470.  
  471. # Create a NeXTSTEP Pkg containing the complete installation 
  472. package: python Python.pkg
  473.  
  474. # Create a NeXTSTEP Pkg containing only the binaries, without libraries
  475. # and headers
  476. package-bin: python Python-bin.pkg
  477.  
  478. # Perform the installation (everything) in a directory `Python.root'
  479. Python.root:
  480.     mkdirs $(srcdir)/$@
  481.     $(MAKE) prefix="`pwd`/$@" \
  482.          INSTALL_PROGRAM="$(INSTALL) -m 755 -sS -sx" \
  483.             altbininstall nslibinstall nsinclinstall \
  484.             libainstall sharedinstall bininstall maninstall
  485.  
  486. # Perform the installation (binaries) in a directory `Python-bin.root'
  487. Python-bin.root: 
  488.     mkdirs $(srcdir)/$@
  489.     $(MAKE) prefix="`pwd`/$@" \
  490.          INSTALL_PROGRAM="$(INSTALL) -m 755 -sS -sx" \
  491.             altbininstall nslibinstall sharedinstall \
  492.             bininstall maninstall
  493. localclean::
  494.     rm -rf Python.root Python-bin.root Python.pkg Python-bin.pkg
  495.  
  496. BUILD_PACKAGE=/NextAdmin/Installer.app/package
  497. .root.pkg:
  498.     $(BUILD_PACKAGE) $< $(srcdir)/Contrib/NeXT/$*.info
  499.     rm -rf $<
  500.     for script in pre_install post_install pre_delete post_delete; do \
  501.       if test -f $(srcdir)/Contrib/NeXT/$*.$$script; then \
  502.         install -m 755 $(srcdir)/Contrib/NeXT/$*.$$script $@; \
  503.       fi; \
  504.     done
  505.     gzip_package $@
  506.  
  507. # Install the library: use gnutar, to be faster; do not copy *.pyc;
  508. # do not copy uninteresting directories.
  509. nslibinstall:
  510.     mkdirs $(LIBDEST)
  511.     gnutar -C $(srcdir)/Lib --exclude 'CVS' --exclude '*.pyc' \
  512.             --exclude 'aix3' --exclude 'aix4' \
  513.             --exclude 'dos_8x3' --exclude 'freebsd2' \
  514.             --exclude 'generic' --exclude 'irix5' \
  515.             --exclude 'linux1' --exclude 'linux2' \
  516.             --exclude 'mac' --exclude 'stdwin' \
  517.             --exclude 'sunos4' --exclude 'sunos5' \
  518.             --exclude 'tkinter' --exclude 'win' \
  519.             --exclude '.cvsignore' --exclude '*~' -cf - . | \
  520.         (cd $(LIBDEST); gnutar -xf -)
  521.  
  522. # Install the include files: use gnutar, to be faster.
  523. nsinclinstall:
  524.     mkdirs $(INCLUDEPY)
  525.     (cd $(srcdir)/Include; gnutar -cf - *.h) | \
  526.         (cd $(INCLUDEPY); gnutar -xf -)
  527.