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