Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1 | ######################################################################## |
| 2 | # Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, |
| 3 | # Amsterdam, 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 not be used in advertising or publicity pertaining to |
| 13 | # distribution of the software without specific, written prior permission. |
| 14 | # |
| 15 | # STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO |
| 16 | # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 17 | # FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE |
| 18 | # FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 19 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 20 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 21 | # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | ######################################################################## |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 23 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 24 | # Toplevel Makefile for Python |
| 25 | # Note -- if recursive makes fail, try adding MAKE=make |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 26 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 27 | # Substitutions by configure |
| 28 | srcdir= @srcdir@ |
| 29 | VPATH= @srcdir@ |
| 30 | INSTALL= @INSTALL@ |
Guido van Rossum | 4a91df4 | 1994-10-10 17:58:27 +0000 | [diff] [blame] | 31 | RANLIB= @RANLIB@ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 32 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 33 | # Machine-dependent subdirectories |
| 34 | MACHDEP= @MACHDEP@ |
| 35 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 36 | # Install prefixes are treated specially by the configure script: |
| 37 | # it only changes these lines if it has received a --prefix=... or |
Guido van Rossum | a0e9a77 | 1994-08-12 13:18:25 +0000 | [diff] [blame] | 38 | # --exec-prefix=... command line option. Note that $(prefix) is |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 39 | # also used when compiling config.c in Modules to set the default |
| 40 | # module search path, so if you change it later be sure to change it |
| 41 | # there too and rebuild. |
| 42 | |
| 43 | # Install prefix for architecture-independent files |
| 44 | prefix= /usr/local |
| 45 | |
| 46 | # Install prefix for architecture-dependent files |
| 47 | exec_prefix= $(prefix) |
| 48 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 49 | # Symbols used for using shared libraries |
| 50 | SO= @SO@ |
| 51 | LDSHARED= @LDSHARED@ |
| 52 | CCSHARED= @CCSHARED@ |
| 53 | LINKFORSHARED= @LINKFORSHARED@ |
| 54 | DESTSHARED= $(prefix)/lib/python/$(MACHDEP) |
| 55 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 56 | # Programs |
| 57 | SHELL= /bin/sh |
| 58 | |
| 59 | # --with-PACKAGE options for configure script |
| 60 | # e.g. --with-readline --with-svr5 --with-solaris --with-thread |
| 61 | # (see README for an explanation) |
| 62 | WITH= |
| 63 | |
| 64 | # Compiler options passed to subordinate makes |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 65 | OPT= @OPT@ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 66 | |
| 67 | # Subdirectories where to run make recursively |
| 68 | SUBDIRS= Parser Objects Python Modules |
| 69 | |
| 70 | # Other subdirectories |
| 71 | SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar |
| 72 | |
| 73 | # Files and directories to be distributed |
| 74 | CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in |
| 75 | DISTFILES= README ChangeLog $(CONFIGFILES) |
| 76 | DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy |
| 77 | DIST= $(DISTFILES) $(DISTDIRS) |
| 78 | |
| 79 | # Default target |
| 80 | all: python |
| 81 | |
| 82 | # Build the interpreter |
| 83 | python: Makefiles |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 84 | for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 85 | (echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \ |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 86 | done |
| 87 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 88 | # Test the interpreter (twice, once without .pyc files, once with) |
| 89 | TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test |
| 90 | test: python |
| 91 | -rm -f $(srcdir)/Lib/test/*.pyc |
| 92 | PYTHONPATH=$(TESTPATH) ./python -c 'import autotest' |
| 93 | PYTHONPATH=$(TESTPATH) ./python -c 'import autotest' |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 94 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 95 | # Install the interpreter |
| 96 | install: python |
| 97 | $(INSTALL) python $(exec_prefix)/bin/python |
| 98 | @echo If this is your first time, consider make libinstall... |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 99 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 100 | # Install the library. |
| 101 | # If your system does not support "cp -r", try "copy -r" or perhaps |
Guido van Rossum | 7522f03 | 1994-08-30 12:42:01 +0000 | [diff] [blame] | 102 | # something like find Lib -print | cpio -pacvdmu $(LIBDEST) |
| 103 | LIBDEST= $(prefix)/lib/python |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 104 | libinstall: |
Guido van Rossum | 7522f03 | 1994-08-30 12:42:01 +0000 | [diff] [blame] | 105 | -if test ! -d $(LIBDEST); \ |
| 106 | then mkdir $(LIBDEST); \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 107 | fi |
Guido van Rossum | 7522f03 | 1994-08-30 12:42:01 +0000 | [diff] [blame] | 108 | cp -r $(srcdir)/Lib/* $(LIBDEST) |
| 109 | PYTHONPATH=$(LIBDEST) \ |
| 110 | ./python $(LIBDEST)/compileall.py $(LIBDEST) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 111 | |
| 112 | # install the manual page |
| 113 | maninstall: |
| 114 | $(INSTALL) $(srcdir)/Misc/python.man \ |
| 115 | $(prefix)/man/man1/python.1 |
| 116 | |
| 117 | # install the include files |
| 118 | INCLUDEPY= $(prefix)/include/Py |
| 119 | inclinstall: |
| 120 | -if test ! -d $(INCLUDEPY); \ |
| 121 | then mkdir $(INCLUDEPY); \ |
| 122 | fi |
| 123 | cp $(srcdir)/Include/*.h $(INCLUDEPY) |
| 124 | |
| 125 | # install the lib*.a files and miscellaneous stuff needed by extensions |
| 126 | LIBP= $(exec_prefix)/lib/python |
| 127 | LIBPL= $(LIBP)/lib |
| 128 | libainstall: all |
| 129 | -if test ! -d $(LIBP); \ |
| 130 | then mkdir $(LIBP); \ |
| 131 | fi |
| 132 | -if test ! -d $(LIBPL); \ |
| 133 | then mkdir $(LIBPL); \ |
| 134 | fi |
| 135 | for i in $(SUBDIRS); do \ |
| 136 | echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \ |
Guido van Rossum | 4a91df4 | 1994-10-10 17:58:27 +0000 | [diff] [blame] | 137 | $(RANLIB) $(LIBPL)/lib$$i.a; \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 138 | done |
| 139 | $(INSTALL) Modules/config.c $(LIBPL)/config.c |
| 140 | $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in |
| 141 | $(INSTALL) Modules/Makefile $(LIBPL)/Makefile |
| 142 | $(INSTALL) Modules/Setup $(LIBPL)/Setup |
| 143 | $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup |
| 144 | $(INSTALL) config.h $(LIBPL)/config.h |
| 145 | $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c |
| 146 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 147 | # install the dynamically loadable modules |
| 148 | sharedinstall: |
| 149 | cd Modules; $(MAKE) \ |
| 150 | OPT="$(OPT)" \ |
| 151 | SO="$(SO)" \ |
| 152 | LDSHARED="$(LDSHARED)" \ |
| 153 | CCSHARED="$(CCSHARED)" \ |
| 154 | LINKFORSHARED="$(LINKFORSHARED)" \ |
| 155 | DESTSHARED="$(DESTSHARED)" \ |
| 156 | sharedinstall |
| 157 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 158 | # Build the sub-Makefiles |
| 159 | Makefiles: config.status |
| 160 | (cd Modules; $(MAKE) -f Makefile.pre Makefile) |
| 161 | for i in . $(SUBDIRS); do \ |
| 162 | (echo $$i; cd $$i; $(MAKE) Makefile); \ |
| 163 | done |
| 164 | |
| 165 | # Build the toplevel Makefile |
| 166 | Makefile: Makefile.in config.status |
| 167 | CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status |
| 168 | |
| 169 | # Run the configure script. If config.status already exists, |
| 170 | # call it with the --recheck argument, which reruns configure with the |
| 171 | # same options as it was run last time; otherwise run the configure |
| 172 | # script with options taken from the $(WITH) variable |
| 173 | config.status: $(srcdir)/configure |
| 174 | if test -f config.status; \ |
| 175 | then $(SHELL) config.status --recheck; \ |
| 176 | else $(SHELL) $(srcdir)/configure $(WITH); \ |
| 177 | fi |
| 178 | |
| 179 | .PRECIOUS: config.status python |
| 180 | |
| 181 | # Rerun configure with the same options as it was run last time, |
| 182 | # provided the config.status script exists |
| 183 | recheck: |
| 184 | $(SHELL) config.status --recheck |
| 185 | |
| 186 | # Rebuild the configure script from configure.in; also rebuild config.h.in |
| 187 | autoconf: |
| 188 | (cd $(srcdir); autoconf; autoheader) |
| 189 | |
| 190 | # Create a tags file for vi |
| 191 | tags:: |
| 192 | ctags -w -t Include/*.h |
| 193 | for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done |
| 194 | sort tags -o tags |
| 195 | |
| 196 | # Create a tags file for GNU Emacs |
| 197 | TAGS:: |
Guido van Rossum | 5552eb7 | 1994-08-05 15:51:00 +0000 | [diff] [blame] | 198 | etags Include/*.h |
| 199 | for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 200 | |
| 201 | # Add dependencies to sub-Makefiles |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 202 | depend: |
| 203 | for i in $(SUBDIRS); do \ |
| 204 | (echo $$i; cd $$i; $(MAKE) depend); \ |
| 205 | done |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 206 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 207 | # Sanitation targets -- clean leaves libraries, executables and tags |
| 208 | # files, which clobber removes those as well |
| 209 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 210 | localclean: |
| 211 | -rm -f core *~ [@,#]* *.old *.orig *.rej |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 212 | |
| 213 | clean: localclean |
| 214 | -for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 215 | (echo $$i; cd $$i; \ |
| 216 | if test -f Makefile; \ |
| 217 | then $(MAKE) clean; \ |
| 218 | else $(MAKE) -f Makefile.*in clean; \ |
| 219 | fi); \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 220 | done |
| 221 | |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 222 | localclobber: localclean |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 223 | -rm -f tags TAGS python |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 224 | |
| 225 | clobber: localclobber |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 226 | -for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 227 | (echo $$i; cd $$i; \ |
| 228 | if test -f Makefile; \ |
| 229 | then $(MAKE) clobber; \ |
| 230 | else $(MAKE) -f Makefile.in clobber; \ |
| 231 | fi); \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 232 | done |
| 233 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 234 | # Make things extra clean, before making a distribution |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 235 | distclean: clobber |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 236 | -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber |
| 237 | -rm -f config.status config.h Makefile |
| 238 | -for i in $(SUBDIRS) $(SUBDIRSTOO); do \ |
| 239 | for f in $$i/*.in; do \ |
| 240 | f=`basename "$$f" .in`; \ |
| 241 | if test "$$f" != "*"; then \ |
| 242 | echo rm -f "$$i/$$f"; \ |
| 243 | rm -f "$$i/$$f"; \ |
| 244 | fi; \ |
| 245 | done; \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 246 | done |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 247 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 248 | # Find files with funny names |
| 249 | find: |
| 250 | find $(DISTDIRS) -type d \ |
| 251 | -o -name '*.[chs]' \ |
| 252 | -o -name '*.py' \ |
| 253 | -o -name '*.doc' \ |
| 254 | -o -name '*.sty' \ |
| 255 | -o -name '*.bib' \ |
| 256 | -o -name '*.dat' \ |
| 257 | -o -name '*.el' \ |
| 258 | -o -name '*.fd' \ |
| 259 | -o -name '*.in' \ |
| 260 | -o -name '*.tex' \ |
| 261 | -o -name '*,[vpt]' \ |
| 262 | -o -name 'Setup' \ |
| 263 | -o -name 'Setup.*' \ |
| 264 | -o -name README \ |
| 265 | -o -name Makefile \ |
| 266 | -o -name ChangeLog \ |
| 267 | -o -name RCS \ |
| 268 | -o -name Repository \ |
| 269 | -o -name Entries \ |
| 270 | -o -name Tag \ |
| 271 | -o -name tags \ |
| 272 | -o -name TAGS \ |
| 273 | -o -name .cvsignore \ |
| 274 | -o -name MANIFEST \ |
| 275 | -o -print |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 276 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 277 | # Build a distribution tar file (run make distclean first) |
| 278 | # (This leaves the RCS and CVS directories in :-( ) |
| 279 | tar: |
Guido van Rossum | 5552eb7 | 1994-08-05 15:51:00 +0000 | [diff] [blame] | 280 | tar cf - $(DIST) | gzip --best >dist.tar.gz |