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 | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 49 | # Expanded directories |
| 50 | MANDIR=$(prefix)/man |
| 51 | BINDIR=$(exec_prefix)/bin |
| 52 | LIBDIR=$(exec_prefix)/lib |
| 53 | INCLUDEDIR=$(prefix)/include |
| 54 | SCRIPTDIR=$(prefix)/lib |
| 55 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 56 | # Symbols used for using shared libraries |
| 57 | SO= @SO@ |
| 58 | LDSHARED= @LDSHARED@ |
| 59 | CCSHARED= @CCSHARED@ |
| 60 | LINKFORSHARED= @LINKFORSHARED@ |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 61 | DESTSHARED= $(SCRIPTDIR)/python/$(MACHDEP) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 62 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 63 | # Programs |
| 64 | SHELL= /bin/sh |
| 65 | |
| 66 | # --with-PACKAGE options for configure script |
| 67 | # e.g. --with-readline --with-svr5 --with-solaris --with-thread |
| 68 | # (see README for an explanation) |
| 69 | WITH= |
| 70 | |
| 71 | # Compiler options passed to subordinate makes |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 72 | OPT= @OPT@ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 73 | |
| 74 | # Subdirectories where to run make recursively |
| 75 | SUBDIRS= Parser Objects Python Modules |
| 76 | |
| 77 | # Other subdirectories |
| 78 | SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar |
| 79 | |
| 80 | # Files and directories to be distributed |
| 81 | CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in |
| 82 | DISTFILES= README ChangeLog $(CONFIGFILES) |
| 83 | DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy |
| 84 | DIST= $(DISTFILES) $(DISTDIRS) |
| 85 | |
| 86 | # Default target |
| 87 | all: python |
| 88 | |
| 89 | # Build the interpreter |
| 90 | python: Makefiles |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 91 | for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 92 | (echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \ |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 93 | done |
| 94 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 95 | # Test the interpreter (twice, once without .pyc files, once with) |
| 96 | TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test |
| 97 | test: python |
| 98 | -rm -f $(srcdir)/Lib/test/*.pyc |
| 99 | PYTHONPATH=$(TESTPATH) ./python -c 'import autotest' |
| 100 | PYTHONPATH=$(TESTPATH) ./python -c 'import autotest' |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 101 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 102 | # Install the interpreter |
| 103 | install: python |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 104 | $(INSTALL) python $(BINDIR)/python |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 105 | @echo If this is your first time, consider make libinstall... |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 106 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 107 | # Install the library. |
| 108 | # 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] | 109 | # something like find Lib -print | cpio -pacvdmu $(LIBDEST) |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 110 | LIBDEST= $(SCRIPTDIR)/python |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 111 | libinstall: |
Guido van Rossum | 7522f03 | 1994-08-30 12:42:01 +0000 | [diff] [blame] | 112 | -if test ! -d $(LIBDEST); \ |
| 113 | then mkdir $(LIBDEST); \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 114 | fi |
Guido van Rossum | 7522f03 | 1994-08-30 12:42:01 +0000 | [diff] [blame] | 115 | cp -r $(srcdir)/Lib/* $(LIBDEST) |
| 116 | PYTHONPATH=$(LIBDEST) \ |
| 117 | ./python $(LIBDEST)/compileall.py $(LIBDEST) |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 118 | cd Modules; make sharedinstall |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 119 | |
| 120 | # install the manual page |
| 121 | maninstall: |
| 122 | $(INSTALL) $(srcdir)/Misc/python.man \ |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 123 | $(MANDIR)/man1/python.1 |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 124 | |
| 125 | # install the include files |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 126 | INCLUDEPY= $(INCLUDEDIR)/Py |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 127 | inclinstall: |
| 128 | -if test ! -d $(INCLUDEPY); \ |
| 129 | then mkdir $(INCLUDEPY); \ |
| 130 | fi |
| 131 | cp $(srcdir)/Include/*.h $(INCLUDEPY) |
| 132 | |
| 133 | # install the lib*.a files and miscellaneous stuff needed by extensions |
Guido van Rossum | 9041279 | 1994-10-20 22:04:30 +0000 | [diff] [blame] | 134 | LIBP= $(LIBDIR)/python |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 135 | LIBPL= $(LIBP)/lib |
| 136 | libainstall: all |
| 137 | -if test ! -d $(LIBP); \ |
| 138 | then mkdir $(LIBP); \ |
| 139 | fi |
| 140 | -if test ! -d $(LIBPL); \ |
| 141 | then mkdir $(LIBPL); \ |
| 142 | fi |
| 143 | for i in $(SUBDIRS); do \ |
| 144 | echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \ |
Guido van Rossum | 4a91df4 | 1994-10-10 17:58:27 +0000 | [diff] [blame] | 145 | $(RANLIB) $(LIBPL)/lib$$i.a; \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 146 | done |
| 147 | $(INSTALL) Modules/config.c $(LIBPL)/config.c |
| 148 | $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in |
| 149 | $(INSTALL) Modules/Makefile $(LIBPL)/Makefile |
| 150 | $(INSTALL) Modules/Setup $(LIBPL)/Setup |
| 151 | $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup |
| 152 | $(INSTALL) config.h $(LIBPL)/config.h |
| 153 | $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c |
| 154 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 155 | # install the dynamically loadable modules |
| 156 | sharedinstall: |
| 157 | cd Modules; $(MAKE) \ |
| 158 | OPT="$(OPT)" \ |
| 159 | SO="$(SO)" \ |
| 160 | LDSHARED="$(LDSHARED)" \ |
| 161 | CCSHARED="$(CCSHARED)" \ |
| 162 | LINKFORSHARED="$(LINKFORSHARED)" \ |
| 163 | DESTSHARED="$(DESTSHARED)" \ |
| 164 | sharedinstall |
| 165 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 166 | # Build the sub-Makefiles |
| 167 | Makefiles: config.status |
| 168 | (cd Modules; $(MAKE) -f Makefile.pre Makefile) |
| 169 | for i in . $(SUBDIRS); do \ |
| 170 | (echo $$i; cd $$i; $(MAKE) Makefile); \ |
| 171 | done |
| 172 | |
| 173 | # Build the toplevel Makefile |
| 174 | Makefile: Makefile.in config.status |
| 175 | CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status |
| 176 | |
| 177 | # Run the configure script. If config.status already exists, |
| 178 | # call it with the --recheck argument, which reruns configure with the |
| 179 | # same options as it was run last time; otherwise run the configure |
| 180 | # script with options taken from the $(WITH) variable |
| 181 | config.status: $(srcdir)/configure |
| 182 | if test -f config.status; \ |
| 183 | then $(SHELL) config.status --recheck; \ |
| 184 | else $(SHELL) $(srcdir)/configure $(WITH); \ |
| 185 | fi |
| 186 | |
| 187 | .PRECIOUS: config.status python |
| 188 | |
| 189 | # Rerun configure with the same options as it was run last time, |
| 190 | # provided the config.status script exists |
| 191 | recheck: |
| 192 | $(SHELL) config.status --recheck |
| 193 | |
| 194 | # Rebuild the configure script from configure.in; also rebuild config.h.in |
| 195 | autoconf: |
| 196 | (cd $(srcdir); autoconf; autoheader) |
| 197 | |
| 198 | # Create a tags file for vi |
| 199 | tags:: |
| 200 | ctags -w -t Include/*.h |
| 201 | for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done |
| 202 | sort tags -o tags |
| 203 | |
| 204 | # Create a tags file for GNU Emacs |
| 205 | TAGS:: |
Guido van Rossum | 5552eb7 | 1994-08-05 15:51:00 +0000 | [diff] [blame] | 206 | etags Include/*.h |
| 207 | for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 208 | |
| 209 | # Add dependencies to sub-Makefiles |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 210 | depend: |
| 211 | for i in $(SUBDIRS); do \ |
| 212 | (echo $$i; cd $$i; $(MAKE) depend); \ |
| 213 | done |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 214 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 215 | # Sanitation targets -- clean leaves libraries, executables and tags |
| 216 | # files, which clobber removes those as well |
| 217 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 218 | localclean: |
| 219 | -rm -f core *~ [@,#]* *.old *.orig *.rej |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 220 | |
| 221 | clean: localclean |
| 222 | -for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 223 | (echo $$i; cd $$i; \ |
| 224 | if test -f Makefile; \ |
| 225 | then $(MAKE) clean; \ |
| 226 | else $(MAKE) -f Makefile.*in clean; \ |
| 227 | fi); \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 228 | done |
| 229 | |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 230 | localclobber: localclean |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 231 | -rm -f tags TAGS python |
Guido van Rossum | 810a92f | 1993-12-28 19:39:56 +0000 | [diff] [blame] | 232 | |
| 233 | clobber: localclobber |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 234 | -for i in $(SUBDIRS); do \ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 235 | (echo $$i; cd $$i; \ |
| 236 | if test -f Makefile; \ |
| 237 | then $(MAKE) clobber; \ |
| 238 | else $(MAKE) -f Makefile.in clobber; \ |
| 239 | fi); \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 240 | done |
| 241 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 242 | # Make things extra clean, before making a distribution |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 243 | distclean: clobber |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 244 | -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber |
| 245 | -rm -f config.status config.h Makefile |
| 246 | -for i in $(SUBDIRS) $(SUBDIRSTOO); do \ |
| 247 | for f in $$i/*.in; do \ |
| 248 | f=`basename "$$f" .in`; \ |
| 249 | if test "$$f" != "*"; then \ |
| 250 | echo rm -f "$$i/$$f"; \ |
| 251 | rm -f "$$i/$$f"; \ |
| 252 | fi; \ |
| 253 | done; \ |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 254 | done |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 255 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 256 | # Find files with funny names |
| 257 | find: |
| 258 | find $(DISTDIRS) -type d \ |
| 259 | -o -name '*.[chs]' \ |
| 260 | -o -name '*.py' \ |
| 261 | -o -name '*.doc' \ |
| 262 | -o -name '*.sty' \ |
| 263 | -o -name '*.bib' \ |
| 264 | -o -name '*.dat' \ |
| 265 | -o -name '*.el' \ |
| 266 | -o -name '*.fd' \ |
| 267 | -o -name '*.in' \ |
| 268 | -o -name '*.tex' \ |
| 269 | -o -name '*,[vpt]' \ |
| 270 | -o -name 'Setup' \ |
| 271 | -o -name 'Setup.*' \ |
| 272 | -o -name README \ |
| 273 | -o -name Makefile \ |
| 274 | -o -name ChangeLog \ |
| 275 | -o -name RCS \ |
| 276 | -o -name Repository \ |
| 277 | -o -name Entries \ |
| 278 | -o -name Tag \ |
| 279 | -o -name tags \ |
| 280 | -o -name TAGS \ |
| 281 | -o -name .cvsignore \ |
| 282 | -o -name MANIFEST \ |
| 283 | -o -print |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 284 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 285 | # Build a distribution tar file (run make distclean first) |
| 286 | # (This leaves the RCS and CVS directories in :-( ) |
| 287 | tar: |
Guido van Rossum | 5552eb7 | 1994-08-05 15:51:00 +0000 | [diff] [blame] | 288 | tar cf - $(DIST) | gzip --best >dist.tar.gz |