blob: 0a26902ad4ebc56b1b284d8109374d576e56ae73 [file] [log] [blame]
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001########################################################################
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002# Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3# The Netherlands.
4#
Guido van Rossum433c8ad1994-08-01 12:07:07 +00005# All Rights Reserved
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00006#
7# Permission to use, copy, modify, and distribute this software and its
8# documentation for any purpose and without fee is hereby granted,
Guido van Rossum433c8ad1994-08-01 12:07:07 +00009# provided that the above copyright notice appear in all copies and that
Guido van Rossumaf5b83e1995-01-04 19:02:35 +000010# both that copyright notice and this permission notice appear in
Guido van Rossum433c8ad1994-08-01 12:07:07 +000011# supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012# 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#
17# While CWI is the initial source for this software, a modified version
18# is made available by the Corporation for National Research Initiatives
19# (CNRI) at the Internet address ftp://ftp.python.org.
20#
21# STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24# CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28# PERFORMANCE OF THIS SOFTWARE.
Guido van Rossum433c8ad1994-08-01 12:07:07 +000029########################################################################
Guido van Rossum627b2d71993-12-24 10:39:16 +000030
Guido van Rossum586480b1996-05-28 22:49:08 +000031# Top-level Makefile for Python
32#
33# As distributed, this file is called Makefile.in; it is processed
34# into the real Makefile by running the script ./configure, which
35# replaces things like @spam@ with values appropriate for your system.
36# This means that if you edit Makefile, your changes get lost the next
37# time you run the configure script. Ideally, you can do:
38#
39# ./configure
40# make
41# make test
42# make install
43#
44# The top-level Makefile invokes make recursively in a number of
45# subdirectories (see the SUBDIRS variable below). If you want to,
46# you can invoke make in individual subdirectories. However, the
47# sub-Makefiles are also generated by configure, and the quickest way
48# to make sure they are up to date is by running make (or "make
49# Makefiles") at the top level. This is particularly important for
50# Modules/Makefile, which has to be regenerated every time you edit
51# Modules/Setup. The python executable is built in the Modules
52# directory and then moved to the top-level directory. The recursive
53# makes pass three options to subordinate makes: OPT (a quick way to
Guido van Rossumb535da31996-07-30 18:04:22 +000054# change some compiler options; it usually defaults to -O), prefix and
Guido van Rossum586480b1996-05-28 22:49:08 +000055# exec_prefix (the installation paths).
56#
Guido van Rossumb535da31996-07-30 18:04:22 +000057# If you have a previous version of Python installed that you don't
58# want to overwrite, you can use "make altinstall" instead of "make
59# install". This changes the install procedure so it installs the
60# Python binary as "python<version>". The libraries and include files
61# are always installed in a subdirectory called "python<version>".
62# "make altinstall" does not install the manual page. If you want to
63# make this installation the "official" installation but want to keep
64# the old binary around "just in case", rename the installed python
65# binary to "python<oldversion>" before running "make install".
66# (This only works between different versions, e.g. 1.3 and 1.4 --
67# different betas of the same version will overwrite each other in
68# installation unless you override the VERSION Make variable.)
69#
Guido van Rossum64b65671996-07-30 20:42:12 +000070# In fact, "make install" or "make bininstall" installs the binary
71# as python<version> and makes a hard link to python, so when
72# installing a new version in the future, nothing of the current
73# version will be lost (except for the man page).
74#
Guido van Rossum586480b1996-05-28 22:49:08 +000075# If recursive makes fail, try invoking make as "make MAKE=make".
76#
77# See also the section "Build instructions" in the README file.
Guido van Rossum627b2d71993-12-24 10:39:16 +000078
Guido van Rossum433c8ad1994-08-01 12:07:07 +000079# Substitutions by configure
Guido van Rossum914fbd91997-07-19 19:38:43 +000080VERSION= @VERSION@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000081srcdir= @srcdir@
82VPATH= @srcdir@
Guido van Rossum1eec5281997-07-25 22:34:08 +000083CC= @CC@
Guido van Rossum5aadaf51997-08-19 14:40:11 +000084AR= @AR@
Guido van Rossum4a91df41994-10-10 17:58:27 +000085RANLIB= @RANLIB@
Guido van Rossum1eec5281997-07-25 22:34:08 +000086DEFS= @DEFS@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000087
Guido van Rossumac405f61994-09-12 10:56:06 +000088# Machine-dependent subdirectories
89MACHDEP= @MACHDEP@
90
Guido van Rossum433c8ad1994-08-01 12:07:07 +000091# Install prefix for architecture-independent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000092prefix= @prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000093
94# Install prefix for architecture-dependent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000095exec_prefix= @exec_prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000096
Guido van Rossum90412791994-10-20 22:04:30 +000097# Expanded directories
Guido van Rossumb535da31996-07-30 18:04:22 +000098BINDIR= $(exec_prefix)/bin
99LIBDIR= $(exec_prefix)/lib
100MANDIR= $(prefix)/man
101INCLUDEDIR= $(prefix)/include
102SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +0000103
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000104# Detailed destination directories
105BINLIBDEST= $(LIBDIR)/python$(VERSION)
106LIBDEST= $(SCRIPTDIR)/python$(VERSION)
107INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
108LIBP= $(LIBDIR)/python$(VERSION)
109
Guido van Rossumac405f61994-09-12 10:56:06 +0000110# Symbols used for using shared libraries
111SO= @SO@
112LDSHARED= @LDSHARED@
113CCSHARED= @CCSHARED@
114LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000115DESTSHARED= $(BINLIBDEST)/sharedmodules
Guido van Rossumac405f61994-09-12 10:56:06 +0000116
Guido van Rossum586480b1996-05-28 22:49:08 +0000117# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000118SHELL= /bin/sh
119
Guido van Rossum586480b1996-05-28 22:49:08 +0000120# Portable install script (configure doesn't always guess right)
121INSTALL= @srcdir@/install-sh -c
Guido van Rossumb535da31996-07-30 18:04:22 +0000122INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossum586480b1996-05-28 22:49:08 +0000123INSTALL_DATA= ${INSTALL} -m 644
124
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000125# --with-PACKAGE options for configure script
126# e.g. --with-readline --with-svr5 --with-solaris --with-thread
127# (see README for an explanation)
128WITH=
129
130# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000131OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000132
133# Subdirectories where to run make recursively
134SUBDIRS= Parser Objects Python Modules
135
136# Other subdirectories
Guido van Rossumb535da31996-07-30 18:04:22 +0000137SUBDIRSTOO= Include Lib Doc Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000138
139# Files and directories to be distributed
140CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
141DISTFILES= README ChangeLog $(CONFIGFILES)
142DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
143DIST= $(DISTFILES) $(DISTDIRS)
144
Guido van Rossum1eec5281997-07-25 22:34:08 +0000145# Compilation flags for getbuildinfo.c only
146CFLAGS= $(OPT) -I. $(DEFS)
147
Guido van Rossum914fbd91997-07-19 19:38:43 +0000148LIBRARY= libpython$(VERSION).a
149
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000150# Default target
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000151all: $(LIBRARY) python sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000152
153# Build the interpreter
Guido van Rossum1eec5281997-07-25 22:34:08 +0000154python: $(LIBRARY) buildno
Guido van Rossum86c052e1997-08-20 22:13:15 +0000155 expr `cat buildno` + 1 >buildno1
156 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000157 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
158 $(srcdir)/Modules/getbuildinfo.c
159 $(AR) cr $(LIBRARY) getbuildinfo.o
160 $(RANLIB) $(LIBRARY)
Guido van Rossum914fbd91997-07-19 19:38:43 +0000161 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
162 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
163 LIBRARY=../$(LIBRARY) link
164
Guido van Rossum1eec5281997-07-25 22:34:08 +0000165buildno:
166 echo 0 >buildno
167
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000168# Build the shared modules
169sharedmods: python
170 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
171 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
172 sharedmods
173
Guido van Rossum914fbd91997-07-19 19:38:43 +0000174# Build the library
175$(LIBRARY): $(SUBDIRS)
176 if test ! -f $(LIBRARY); \
177 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
178 else true; fi
179 for i in $(SUBDIRS); do \
180 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000181
182$(SUBDIRS): Makefiles
183
184Parser:
185 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
186 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
187
188Python:
189 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
190 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
191
192Objects:
193 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
194 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
195
Guido van Rossum914fbd91997-07-19 19:38:43 +0000196Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000197 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
198 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000199
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000200# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw9121ab91997-01-02 20:01:44 +0000201TESTOPTS=
Guido van Rossum042a0511997-01-03 15:54:36 +0000202TESTPROG= $(srcdir)/Lib/test/regrtest.py
Barry Warsawdd82bb91997-08-29 21:52:14 +0000203TESTPYTHON= ./python
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000204test: python
205 -rm -f $(srcdir)/Lib/test/*.pyc
Barry Warsawdd82bb91997-08-29 21:52:14 +0000206 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
207 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000208
Guido van Rossum586480b1996-05-28 22:49:08 +0000209# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000210install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000211
Guido van Rossum64b65671996-07-30 20:42:12 +0000212# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000213altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000214
Guido van Rossum64b65671996-07-30 20:42:12 +0000215# Install the interpreter (by creating a hard link to python$(VERSION))
216bininstall: altbininstall
217 -if test -f $(BINDIR)/python; \
218 then rm -f $(BINDIR)/python; \
219 else true; \
220 fi
221 (cd $(BINDIR); ln python$(VERSION) python)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000222
Guido van Rossum3912fd81996-07-24 02:35:43 +0000223# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000224# This goes into $(exec_prefix)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000225altbininstall: python
226 @for i in $(BINDIR); \
227 do \
228 if test ! -d $$i; then \
229 echo "Creating directory $$i"; \
230 mkdir $$i; \
231 chmod 755 $$i; \
232 else true; \
233 fi; \
234 done
235 $(INSTALL_PROGRAM) python $(BINDIR)/python$(VERSION)
236
Guido van Rossum586480b1996-05-28 22:49:08 +0000237# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000238maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000239 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000240 do \
241 if test ! -d $$i; then \
242 echo "Creating directory $$i"; \
243 mkdir $$i; \
244 chmod 755 $$i; \
245 else true; \
246 fi; \
247 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000248 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000249 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000250
Guido van Rossumb535da31996-07-30 18:04:22 +0000251# Install the library
Guido van Rossumb8dccd21996-07-30 21:55:17 +0000252MACHDEPS= $(MACHDEP)
253LIBSUBDIRS= stdwin tkinter test $(MACHDEPS)
Guido van Rossum64b65671996-07-30 20:42:12 +0000254libinstall: python $(srcdir)/Lib/$(MACHDEP)
Guido van Rossumb535da31996-07-30 18:04:22 +0000255 @for i in $(SCRIPTDIR) $(LIBDEST); \
256 do \
257 if test ! -d $$i; then \
258 echo "Creating directory $$i"; \
259 mkdir $$i; \
260 chmod 755 $$i; \
261 else true; \
262 fi; \
263 done
264 @for d in $(LIBSUBDIRS); \
265 do \
266 a=$(srcdir)/Lib/$$d; \
267 if test ! -d $$a; then continue; else true; fi; \
268 b=$(LIBDEST)/$$d; \
269 if test ! -d $$b; then \
270 echo "Creating directory $$b"; \
271 mkdir $$b; \
272 chmod 755 $$b; \
273 else true; \
274 fi; \
275 done
276 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
277 do \
278 if test -x $$i; then \
279 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
280 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
281 else \
282 $(INSTALL_DATA) $$i $(LIBDEST); \
283 echo $(INSTALL_DATA) $$i $(LIBDEST); \
284 fi; \
285 done
286 @for d in $(LIBSUBDIRS); \
287 do \
288 a=$(srcdir)/Lib/$$d; \
289 if test ! -d $$a; then continue; else true; fi; \
290 b=$(LIBDEST)/$$d; \
291 for i in $$a/*; \
292 do \
293 case $$i in \
294 *CVS) ;; \
295 *.pyc) ;; \
296 *~) ;; \
297 *) \
298 if test -x $$i; then \
299 echo $(INSTALL_PROGRAM) $$i $$b; \
300 $(INSTALL_PROGRAM) $$i $$b; \
301 else \
302 echo $(INSTALL_DATA) $$i $$b; \
303 $(INSTALL_DATA) $$i $$b; \
304 fi;; \
305 esac; \
306 done; \
307 done
308 PYTHONPATH=$(LIBDEST) \
309 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000310 PYTHONPATH=$(LIBDEST) \
311 ./python -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000312
Guido van Rossum64b65671996-07-30 20:42:12 +0000313# Create the MACHDEP source directory, if one wasn't distributed..
Guido van Rossumcda848f1996-08-21 20:18:29 +0000314$(srcdir)/Lib/$(MACHDEP):
Guido van Rossum64b65671996-07-30 20:42:12 +0000315 mkdir $(srcdir)/Lib/$(MACHDEP)
316 cp $(srcdir)/Lib/generic/regen $(srcdir)/Lib/$(MACHDEP)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000317 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000318 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossumfc8ebb11996-08-19 21:51:24 +0000319 cd $(srcdir)/Lib/$(MACHDEP); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000320
Guido van Rossum586480b1996-05-28 22:49:08 +0000321# Install the include files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000322inclinstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000323 @for i in $(INCLUDEDIR) $(INCLUDEPY); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000324 do \
325 if test ! -d $$i; then \
326 echo "Creating directory $$i"; \
327 mkdir $$i; \
328 chmod 755 $$i; \
329 else true; \
330 fi; \
331 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000332 @for i in $(srcdir)/Include/*.h; \
333 do \
334 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
335 $(INSTALL_DATA) $$i $(INCLUDEPY); \
336 done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000337
Guido van Rossum914fbd91997-07-19 19:38:43 +0000338# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000339# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000340LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000341libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000342 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000343 do \
344 if test ! -d $$i; then \
345 echo "Creating directory $$i"; \
346 mkdir $$i; \
347 chmod 755 $$i; \
348 else true; \
349 fi; \
350 done
Guido van Rossum914fbd91997-07-19 19:38:43 +0000351 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY)
352 $(RANLIB) $(LIBPL)/$(LIBRARY)
Guido van Rossum6403d281995-01-20 16:51:32 +0000353 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000354 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000355 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
356 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
357 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000358 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Guido van Rossum70a86591996-07-21 02:46:47 +0000359 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossum6403d281995-01-20 16:51:32 +0000360 $(INSTALL_DATA) config.h $(LIBPL)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000361
Guido van Rossum586480b1996-05-28 22:49:08 +0000362# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000363# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000364sharedinstall:
365 cd Modules; $(MAKE) \
366 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000367 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000368 SO="$(SO)" \
369 LDSHARED="$(LDSHARED)" \
370 CCSHARED="$(CCSHARED)" \
371 LINKFORSHARED="$(LINKFORSHARED)" \
372 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000373 prefix="$(prefix)" \
374 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000375 sharedinstall
376
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000377# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000378Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000379 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000380 @for i in . $(SUBDIRS); do \
381 (echo making Makefile in subdirectory $$i; cd $$i; \
382 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000383 done
384
Guido van Rossumd09119e1995-01-17 16:45:08 +0000385# Build the intermediate Makefile in Modules
386Modules/Makefile.pre: config.status
387 $(SHELL) config.status
388
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000389# Build the toplevel Makefile
390Makefile: Makefile.in config.status
391 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
392
393# Run the configure script. If config.status already exists,
394# call it with the --recheck argument, which reruns configure with the
395# same options as it was run last time; otherwise run the configure
396# script with options taken from the $(WITH) variable
397config.status: $(srcdir)/configure
398 if test -f config.status; \
399 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000400 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000401 else $(SHELL) $(srcdir)/configure $(WITH); \
402 fi
403
404.PRECIOUS: config.status python
405
406# Rerun configure with the same options as it was run last time,
407# provided the config.status script exists
408recheck:
409 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000410 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000411
412# Rebuild the configure script from configure.in; also rebuild config.h.in
413autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000414 (cd $(srcdir); autoconf)
415 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000416
417# Create a tags file for vi
418tags::
419 ctags -w -t Include/*.h
420 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
421 sort tags -o tags
422
423# Create a tags file for GNU Emacs
424TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000425 etags Include/*.h
426 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000427
428# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000429depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000430 @for i in $(SUBDIRS); do \
431 (echo making depend in subdirectory $$i; cd $$i; \
432 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000433 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000434
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000435# Sanitation targets -- clean leaves libraries, executables and tags
436# files, which clobber removes those as well
437
Guido van Rossum627b2d71993-12-24 10:39:16 +0000438localclean:
439 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000440
441clean: localclean
442 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000443 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000444 if test -f Makefile; \
445 then $(MAKE) clean; \
446 else $(MAKE) -f Makefile.*in clean; \
447 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000448 done
449
Guido van Rossum810a92f1993-12-28 19:39:56 +0000450localclobber: localclean
Guido van Rossumcf0be041997-08-29 18:42:35 +0000451 -rm -f tags TAGS python $(LIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000452 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000453
454clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000455 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000456 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000457 if test -f Makefile; \
458 then $(MAKE) clobber; \
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000459 else $(MAKE) -f $(srcdir)/Makefile.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000460 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000461 done
462
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000463# Make things extra clean, before making a distribution:
464# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000465distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000466 -$(MAKE) -f $(srcdir)/Makefile.in \
467 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000468 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000469 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000470 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000471 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
472 for f in $$i/*.in; do \
473 f=`basename "$$f" .in`; \
474 if test "$$f" != "*"; then \
475 echo rm -f "$$i/$$f"; \
476 rm -f "$$i/$$f"; \
477 fi; \
478 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000479 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000480
Guido van Rossum586480b1996-05-28 22:49:08 +0000481# Check for smelly exported symbols (not starting with Py/_Py)
482smelly: all
483 for i in $(SUBDIRS); do \
484 echo --- $$i ---; \
485 nm -p $$i/lib$$i.a | \
486 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
487 done
488
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000489# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000490funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000491 find $(DISTDIRS) -type d \
492 -o -name '*.[chs]' \
493 -o -name '*.py' \
494 -o -name '*.doc' \
495 -o -name '*.sty' \
496 -o -name '*.bib' \
497 -o -name '*.dat' \
498 -o -name '*.el' \
499 -o -name '*.fd' \
500 -o -name '*.in' \
501 -o -name '*.tex' \
502 -o -name '*,[vpt]' \
503 -o -name 'Setup' \
504 -o -name 'Setup.*' \
505 -o -name README \
506 -o -name Makefile \
507 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000508 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000509 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000510 -o -name Entries \
511 -o -name Tag \
512 -o -name tags \
513 -o -name TAGS \
514 -o -name .cvsignore \
515 -o -name MANIFEST \
516 -o -print