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