blob: 14d7ef4b24fdeb4dbdbd4947cbdf394584b2d009 [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 Rossum4a91df41994-10-10 17:58:27 +000084RANLIB= @RANLIB@
Guido van Rossum1eec5281997-07-25 22:34:08 +000085DEFS= @DEFS@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000086
Guido van Rossumac405f61994-09-12 10:56:06 +000087# Machine-dependent subdirectories
88MACHDEP= @MACHDEP@
89
Guido van Rossum433c8ad1994-08-01 12:07:07 +000090# Install prefix for architecture-independent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000091prefix= @prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000092
93# Install prefix for architecture-dependent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000094exec_prefix= @exec_prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000095
Guido van Rossum90412791994-10-20 22:04:30 +000096# Expanded directories
Guido van Rossumb535da31996-07-30 18:04:22 +000097BINDIR= $(exec_prefix)/bin
98LIBDIR= $(exec_prefix)/lib
99MANDIR= $(prefix)/man
100INCLUDEDIR= $(prefix)/include
101SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +0000102
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000103# Detailed destination directories
104BINLIBDEST= $(LIBDIR)/python$(VERSION)
105LIBDEST= $(SCRIPTDIR)/python$(VERSION)
106INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
107LIBP= $(LIBDIR)/python$(VERSION)
108
Guido van Rossumac405f61994-09-12 10:56:06 +0000109# Symbols used for using shared libraries
110SO= @SO@
111LDSHARED= @LDSHARED@
112CCSHARED= @CCSHARED@
113LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000114DESTSHARED= $(BINLIBDEST)/sharedmodules
Guido van Rossumac405f61994-09-12 10:56:06 +0000115
Guido van Rossum586480b1996-05-28 22:49:08 +0000116# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000117SHELL= /bin/sh
118
Guido van Rossum586480b1996-05-28 22:49:08 +0000119# Portable install script (configure doesn't always guess right)
120INSTALL= @srcdir@/install-sh -c
Guido van Rossumb535da31996-07-30 18:04:22 +0000121INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossum586480b1996-05-28 22:49:08 +0000122INSTALL_DATA= ${INSTALL} -m 644
123
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000124# --with-PACKAGE options for configure script
125# e.g. --with-readline --with-svr5 --with-solaris --with-thread
126# (see README for an explanation)
127WITH=
128
129# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000130OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000131
132# Subdirectories where to run make recursively
133SUBDIRS= Parser Objects Python Modules
134
135# Other subdirectories
Guido van Rossumb535da31996-07-30 18:04:22 +0000136SUBDIRSTOO= Include Lib Doc Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000137
138# Files and directories to be distributed
139CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
140DISTFILES= README ChangeLog $(CONFIGFILES)
141DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
142DIST= $(DISTFILES) $(DISTDIRS)
143
Guido van Rossum1eec5281997-07-25 22:34:08 +0000144# Compilation flags for getbuildinfo.c only
145CFLAGS= $(OPT) -I. $(DEFS)
146
Guido van Rossum914fbd91997-07-19 19:38:43 +0000147LIBRARY= libpython$(VERSION).a
148
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000149# Default target
Guido van Rossum914fbd91997-07-19 19:38:43 +0000150all: $(LIBRARY) python
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000151
152# Build the interpreter
Guido van Rossum1eec5281997-07-25 22:34:08 +0000153python: $(LIBRARY) buildno
154 expr `cat buildno` + 1 >@buildno
155 mv @buildno buildno
156 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
157 $(srcdir)/Modules/getbuildinfo.c
158 $(AR) cr $(LIBRARY) getbuildinfo.o
159 $(RANLIB) $(LIBRARY)
Guido van Rossum914fbd91997-07-19 19:38:43 +0000160 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
161 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
162 LIBRARY=../$(LIBRARY) link
163
Guido van Rossum1eec5281997-07-25 22:34:08 +0000164buildno:
165 echo 0 >buildno
166
Guido van Rossum914fbd91997-07-19 19:38:43 +0000167# Build the library
168$(LIBRARY): $(SUBDIRS)
169 if test ! -f $(LIBRARY); \
170 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
171 else true; fi
172 for i in $(SUBDIRS); do \
173 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000174
175$(SUBDIRS): Makefiles
176
177Parser:
178 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
179 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
180
181Python:
182 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
183 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
184
185Objects:
186 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
187 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
188
Guido van Rossum914fbd91997-07-19 19:38:43 +0000189Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000190 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
191 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000192
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000193# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw9121ab91997-01-02 20:01:44 +0000194TESTOPTS=
Guido van Rossum042a0511997-01-03 15:54:36 +0000195TESTPROG= $(srcdir)/Lib/test/regrtest.py
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000196test: python
197 -rm -f $(srcdir)/Lib/test/*.pyc
Guido van Rossum36bab7d1997-06-02 23:15:09 +0000198 -PYTHONPATH= ./python $(TESTPROG) $(TESTOPTS)
Guido van Rossumfde51691997-05-22 20:11:55 +0000199 PYTHONPATH= ./python $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000200
Guido van Rossum586480b1996-05-28 22:49:08 +0000201# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000202install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000203
Guido van Rossum64b65671996-07-30 20:42:12 +0000204# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000205altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000206
Guido van Rossum64b65671996-07-30 20:42:12 +0000207# Install the interpreter (by creating a hard link to python$(VERSION))
208bininstall: altbininstall
209 -if test -f $(BINDIR)/python; \
210 then rm -f $(BINDIR)/python; \
211 else true; \
212 fi
213 (cd $(BINDIR); ln python$(VERSION) python)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000214
Guido van Rossum3912fd81996-07-24 02:35:43 +0000215# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000216# This goes into $(exec_prefix)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000217altbininstall: python
218 @for i in $(BINDIR); \
219 do \
220 if test ! -d $$i; then \
221 echo "Creating directory $$i"; \
222 mkdir $$i; \
223 chmod 755 $$i; \
224 else true; \
225 fi; \
226 done
227 $(INSTALL_PROGRAM) python $(BINDIR)/python$(VERSION)
228
Guido van Rossum586480b1996-05-28 22:49:08 +0000229# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000230maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000231 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000232 do \
233 if test ! -d $$i; then \
234 echo "Creating directory $$i"; \
235 mkdir $$i; \
236 chmod 755 $$i; \
237 else true; \
238 fi; \
239 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000240 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000241 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000242
Guido van Rossumb535da31996-07-30 18:04:22 +0000243# Install the library
Guido van Rossumb8dccd21996-07-30 21:55:17 +0000244MACHDEPS= $(MACHDEP)
245LIBSUBDIRS= stdwin tkinter test $(MACHDEPS)
Guido van Rossum64b65671996-07-30 20:42:12 +0000246libinstall: python $(srcdir)/Lib/$(MACHDEP)
Guido van Rossumb535da31996-07-30 18:04:22 +0000247 @for i in $(SCRIPTDIR) $(LIBDEST); \
248 do \
249 if test ! -d $$i; then \
250 echo "Creating directory $$i"; \
251 mkdir $$i; \
252 chmod 755 $$i; \
253 else true; \
254 fi; \
255 done
256 @for d in $(LIBSUBDIRS); \
257 do \
258 a=$(srcdir)/Lib/$$d; \
259 if test ! -d $$a; then continue; else true; fi; \
260 b=$(LIBDEST)/$$d; \
261 if test ! -d $$b; then \
262 echo "Creating directory $$b"; \
263 mkdir $$b; \
264 chmod 755 $$b; \
265 else true; \
266 fi; \
267 done
268 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
269 do \
270 if test -x $$i; then \
271 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
272 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
273 else \
274 $(INSTALL_DATA) $$i $(LIBDEST); \
275 echo $(INSTALL_DATA) $$i $(LIBDEST); \
276 fi; \
277 done
278 @for d in $(LIBSUBDIRS); \
279 do \
280 a=$(srcdir)/Lib/$$d; \
281 if test ! -d $$a; then continue; else true; fi; \
282 b=$(LIBDEST)/$$d; \
283 for i in $$a/*; \
284 do \
285 case $$i in \
286 *CVS) ;; \
287 *.pyc) ;; \
288 *~) ;; \
289 *) \
290 if test -x $$i; then \
291 echo $(INSTALL_PROGRAM) $$i $$b; \
292 $(INSTALL_PROGRAM) $$i $$b; \
293 else \
294 echo $(INSTALL_DATA) $$i $$b; \
295 $(INSTALL_DATA) $$i $$b; \
296 fi;; \
297 esac; \
298 done; \
299 done
300 PYTHONPATH=$(LIBDEST) \
301 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000302 PYTHONPATH=$(LIBDEST) \
303 ./python -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000304
Guido van Rossum64b65671996-07-30 20:42:12 +0000305# Create the MACHDEP source directory, if one wasn't distributed..
Guido van Rossumcda848f1996-08-21 20:18:29 +0000306$(srcdir)/Lib/$(MACHDEP):
Guido van Rossum64b65671996-07-30 20:42:12 +0000307 mkdir $(srcdir)/Lib/$(MACHDEP)
308 cp $(srcdir)/Lib/generic/regen $(srcdir)/Lib/$(MACHDEP)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000309 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000310 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossumfc8ebb11996-08-19 21:51:24 +0000311 cd $(srcdir)/Lib/$(MACHDEP); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000312
Guido van Rossum586480b1996-05-28 22:49:08 +0000313# Install the include files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000314inclinstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000315 @for i in $(INCLUDEDIR) $(INCLUDEPY); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000316 do \
317 if test ! -d $$i; then \
318 echo "Creating directory $$i"; \
319 mkdir $$i; \
320 chmod 755 $$i; \
321 else true; \
322 fi; \
323 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000324 @for i in $(srcdir)/Include/*.h; \
325 do \
326 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
327 $(INSTALL_DATA) $$i $(INCLUDEPY); \
328 done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000329
Guido van Rossum914fbd91997-07-19 19:38:43 +0000330# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000331# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000332LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000333libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000334 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000335 do \
336 if test ! -d $$i; then \
337 echo "Creating directory $$i"; \
338 mkdir $$i; \
339 chmod 755 $$i; \
340 else true; \
341 fi; \
342 done
Guido van Rossum914fbd91997-07-19 19:38:43 +0000343 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY)
344 $(RANLIB) $(LIBPL)/$(LIBRARY)
Guido van Rossum6403d281995-01-20 16:51:32 +0000345 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000346 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000347 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
348 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
349 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000350 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Guido van Rossum70a86591996-07-21 02:46:47 +0000351 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossum6403d281995-01-20 16:51:32 +0000352 $(INSTALL_DATA) config.h $(LIBPL)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000353
Guido van Rossum586480b1996-05-28 22:49:08 +0000354# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000355# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000356sharedinstall:
357 cd Modules; $(MAKE) \
358 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000359 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000360 SO="$(SO)" \
361 LDSHARED="$(LDSHARED)" \
362 CCSHARED="$(CCSHARED)" \
363 LINKFORSHARED="$(LINKFORSHARED)" \
364 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000365 prefix="$(prefix)" \
366 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000367 sharedinstall
368
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000369# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000370Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000371 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000372 @for i in . $(SUBDIRS); do \
373 (echo making Makefile in subdirectory $$i; cd $$i; \
374 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000375 done
376
Guido van Rossumd09119e1995-01-17 16:45:08 +0000377# Build the intermediate Makefile in Modules
378Modules/Makefile.pre: config.status
379 $(SHELL) config.status
380
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000381# Build the toplevel Makefile
382Makefile: Makefile.in config.status
383 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
384
385# Run the configure script. If config.status already exists,
386# call it with the --recheck argument, which reruns configure with the
387# same options as it was run last time; otherwise run the configure
388# script with options taken from the $(WITH) variable
389config.status: $(srcdir)/configure
390 if test -f config.status; \
391 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000392 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000393 else $(SHELL) $(srcdir)/configure $(WITH); \
394 fi
395
396.PRECIOUS: config.status python
397
398# Rerun configure with the same options as it was run last time,
399# provided the config.status script exists
400recheck:
401 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000402 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000403
404# Rebuild the configure script from configure.in; also rebuild config.h.in
405autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000406 (cd $(srcdir); autoconf)
407 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000408
409# Create a tags file for vi
410tags::
411 ctags -w -t Include/*.h
412 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
413 sort tags -o tags
414
415# Create a tags file for GNU Emacs
416TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000417 etags Include/*.h
418 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000419
420# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000421depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000422 @for i in $(SUBDIRS); do \
423 (echo making depend in subdirectory $$i; cd $$i; \
424 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000425 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000426
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000427# Sanitation targets -- clean leaves libraries, executables and tags
428# files, which clobber removes those as well
429
Guido van Rossum627b2d71993-12-24 10:39:16 +0000430localclean:
431 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000432
433clean: localclean
434 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000435 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000436 if test -f Makefile; \
437 then $(MAKE) clean; \
438 else $(MAKE) -f Makefile.*in clean; \
439 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000440 done
441
Guido van Rossum810a92f1993-12-28 19:39:56 +0000442localclobber: localclean
Guido van Rossum914fbd91997-07-19 19:38:43 +0000443 -rm -f tags TAGS python $(LIBRARY)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000444 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000445
446clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000447 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000448 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449 if test -f Makefile; \
450 then $(MAKE) clobber; \
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000451 else $(MAKE) -f $(srcdir)/Makefile.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000452 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000453 done
454
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000455# Make things extra clean, before making a distribution:
456# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000457distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000458 -$(MAKE) -f $(srcdir)/Makefile.in \
459 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000460 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000461 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000462 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
463 for f in $$i/*.in; do \
464 f=`basename "$$f" .in`; \
465 if test "$$f" != "*"; then \
466 echo rm -f "$$i/$$f"; \
467 rm -f "$$i/$$f"; \
468 fi; \
469 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000470 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000471
Guido van Rossum586480b1996-05-28 22:49:08 +0000472# Check for smelly exported symbols (not starting with Py/_Py)
473smelly: all
474 for i in $(SUBDIRS); do \
475 echo --- $$i ---; \
476 nm -p $$i/lib$$i.a | \
477 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
478 done
479
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000480# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000481funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000482 find $(DISTDIRS) -type d \
483 -o -name '*.[chs]' \
484 -o -name '*.py' \
485 -o -name '*.doc' \
486 -o -name '*.sty' \
487 -o -name '*.bib' \
488 -o -name '*.dat' \
489 -o -name '*.el' \
490 -o -name '*.fd' \
491 -o -name '*.in' \
492 -o -name '*.tex' \
493 -o -name '*,[vpt]' \
494 -o -name 'Setup' \
495 -o -name 'Setup.*' \
496 -o -name README \
497 -o -name Makefile \
498 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000499 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000500 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000501 -o -name Entries \
502 -o -name Tag \
503 -o -name tags \
504 -o -name TAGS \
505 -o -name .cvsignore \
506 -o -name MANIFEST \
507 -o -print