blob: 3649626e0a5f0e45063b452c93665120866dc12a [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
Guido van Rossumabffd001997-09-11 14:37:59 +0000102CONFINCLUDEDIR= $(exec_prefix)/include
Guido van Rossumb535da31996-07-30 18:04:22 +0000103SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +0000104
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000105# Detailed destination directories
106BINLIBDEST= $(LIBDIR)/python$(VERSION)
107LIBDEST= $(SCRIPTDIR)/python$(VERSION)
108INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
Guido van Rossumabffd001997-09-11 14:37:59 +0000109CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000110LIBP= $(LIBDIR)/python$(VERSION)
111
Guido van Rossumac405f61994-09-12 10:56:06 +0000112# Symbols used for using shared libraries
113SO= @SO@
114LDSHARED= @LDSHARED@
115CCSHARED= @CCSHARED@
116LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumcf809d61997-10-20 23:16:32 +0000117DESTSHARED= $(BINLIBDEST)/lib-dynload
Guido van Rossumac405f61994-09-12 10:56:06 +0000118
Guido van Rossum586480b1996-05-28 22:49:08 +0000119# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000120SHELL= /bin/sh
121
Guido van Rossum586480b1996-05-28 22:49:08 +0000122# Portable install script (configure doesn't always guess right)
123INSTALL= @srcdir@/install-sh -c
Guido van Rossumb535da31996-07-30 18:04:22 +0000124INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossum586480b1996-05-28 22:49:08 +0000125INSTALL_DATA= ${INSTALL} -m 644
126
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000127# --with-PACKAGE options for configure script
128# e.g. --with-readline --with-svr5 --with-solaris --with-thread
129# (see README for an explanation)
130WITH=
131
132# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000133OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000134
135# Subdirectories where to run make recursively
136SUBDIRS= Parser Objects Python Modules
137
138# Other subdirectories
Guido van Rossumb535da31996-07-30 18:04:22 +0000139SUBDIRSTOO= Include Lib Doc Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000140
141# Files and directories to be distributed
142CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
143DISTFILES= README ChangeLog $(CONFIGFILES)
144DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
145DIST= $(DISTFILES) $(DISTDIRS)
146
Guido van Rossum1eec5281997-07-25 22:34:08 +0000147# Compilation flags for getbuildinfo.c only
148CFLAGS= $(OPT) -I. $(DEFS)
149
Guido van Rossum914fbd91997-07-19 19:38:43 +0000150LIBRARY= libpython$(VERSION).a
151
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000152# Default target
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000153all: $(LIBRARY) python sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000154
155# Build the interpreter
Guido van Rossum1eec5281997-07-25 22:34:08 +0000156python: $(LIBRARY) buildno
Guido van Rossum86c052e1997-08-20 22:13:15 +0000157 expr `cat buildno` + 1 >buildno1
158 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000159 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
160 $(srcdir)/Modules/getbuildinfo.c
161 $(AR) cr $(LIBRARY) getbuildinfo.o
162 $(RANLIB) $(LIBRARY)
Guido van Rossum914fbd91997-07-19 19:38:43 +0000163 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
164 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
165 LIBRARY=../$(LIBRARY) link
166
Guido van Rossum1eec5281997-07-25 22:34:08 +0000167buildno:
168 echo 0 >buildno
169
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000170# Build the shared modules
171sharedmods: python
172 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
173 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
174 sharedmods
175
Guido van Rossum914fbd91997-07-19 19:38:43 +0000176# Build the library
177$(LIBRARY): $(SUBDIRS)
178 if test ! -f $(LIBRARY); \
179 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
180 else true; fi
181 for i in $(SUBDIRS); do \
182 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000183
184$(SUBDIRS): Makefiles
185
186Parser:
187 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
188 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
189
190Python:
191 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
192 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
193
194Objects:
195 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
196 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
197
Guido van Rossum914fbd91997-07-19 19:38:43 +0000198Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000199 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
200 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000201
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000202# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw9121ab91997-01-02 20:01:44 +0000203TESTOPTS=
Guido van Rossum042a0511997-01-03 15:54:36 +0000204TESTPROG= $(srcdir)/Lib/test/regrtest.py
Barry Warsawdd82bb91997-08-29 21:52:14 +0000205TESTPYTHON= ./python
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000206test: python
Guido van Rossumcf809d61997-10-20 23:16:32 +0000207 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000208 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
209 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000210
Guido van Rossum586480b1996-05-28 22:49:08 +0000211# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000212install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000213
Guido van Rossum64b65671996-07-30 20:42:12 +0000214# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000215altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000216
Guido van Rossum64b65671996-07-30 20:42:12 +0000217# Install the interpreter (by creating a hard link to python$(VERSION))
218bininstall: altbininstall
219 -if test -f $(BINDIR)/python; \
220 then rm -f $(BINDIR)/python; \
221 else true; \
222 fi
223 (cd $(BINDIR); ln python$(VERSION) python)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000224
Guido van Rossum3912fd81996-07-24 02:35:43 +0000225# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000226# This goes into $(exec_prefix)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000227altbininstall: python
228 @for i in $(BINDIR); \
229 do \
230 if test ! -d $$i; then \
231 echo "Creating directory $$i"; \
232 mkdir $$i; \
233 chmod 755 $$i; \
234 else true; \
235 fi; \
236 done
237 $(INSTALL_PROGRAM) python $(BINDIR)/python$(VERSION)
238
Guido van Rossum586480b1996-05-28 22:49:08 +0000239# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000240maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000241 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000242 do \
243 if test ! -d $$i; then \
244 echo "Creating directory $$i"; \
245 mkdir $$i; \
246 chmod 755 $$i; \
247 else true; \
248 fi; \
249 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000250 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000251 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000252
Guido van Rossumb535da31996-07-30 18:04:22 +0000253# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000254PLATDIR= plat-$(MACHDEP)
255MACHDEPS= $(PLATDIR)
Guido van Rossum38bbbc71997-09-08 01:51:23 +0000256LIBSUBDIRS= lib-stdwin lib-tk test test/output $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000257libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000258 @for i in $(SCRIPTDIR) $(LIBDEST); \
259 do \
260 if test ! -d $$i; then \
261 echo "Creating directory $$i"; \
262 mkdir $$i; \
263 chmod 755 $$i; \
264 else true; \
265 fi; \
266 done
267 @for d in $(LIBSUBDIRS); \
268 do \
269 a=$(srcdir)/Lib/$$d; \
270 if test ! -d $$a; then continue; else true; fi; \
271 b=$(LIBDEST)/$$d; \
272 if test ! -d $$b; then \
273 echo "Creating directory $$b"; \
274 mkdir $$b; \
275 chmod 755 $$b; \
276 else true; \
277 fi; \
278 done
279 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
280 do \
281 if test -x $$i; then \
282 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
283 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
284 else \
285 $(INSTALL_DATA) $$i $(LIBDEST); \
286 echo $(INSTALL_DATA) $$i $(LIBDEST); \
287 fi; \
288 done
289 @for d in $(LIBSUBDIRS); \
290 do \
291 a=$(srcdir)/Lib/$$d; \
292 if test ! -d $$a; then continue; else true; fi; \
293 b=$(LIBDEST)/$$d; \
294 for i in $$a/*; \
295 do \
296 case $$i in \
297 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000298 *.py[co]) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000299 *~) ;; \
300 *) \
301 if test -x $$i; then \
302 echo $(INSTALL_PROGRAM) $$i $$b; \
303 $(INSTALL_PROGRAM) $$i $$b; \
304 else \
305 echo $(INSTALL_DATA) $$i $$b; \
306 $(INSTALL_DATA) $$i $$b; \
307 fi;; \
308 esac; \
309 done; \
310 done
311 PYTHONPATH=$(LIBDEST) \
312 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000313 PYTHONPATH=$(LIBDEST) \
314 ./python -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000315
Guido van Rossum86b7db31997-10-06 00:15:31 +0000316# Create the PLATDIR source directory, if one wasn't distributed..
317$(srcdir)/Lib/$(PLATDIR):
318 mkdir $(srcdir)/Lib/$(PLATDIR)
319 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000320 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000321 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000322 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000323
Guido van Rossum586480b1996-05-28 22:49:08 +0000324# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000325INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000326inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000327 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000328 do \
329 if test ! -d $$i; then \
330 echo "Creating directory $$i"; \
331 mkdir $$i; \
332 chmod 755 $$i; \
333 else true; \
334 fi; \
335 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000336 @for i in $(srcdir)/Include/*.h; \
337 do \
338 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
339 $(INSTALL_DATA) $$i $(INCLUDEPY); \
340 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000341 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000342
Guido van Rossum914fbd91997-07-19 19:38:43 +0000343# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000344# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000345LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000346libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000347 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000348 do \
349 if test ! -d $$i; then \
350 echo "Creating directory $$i"; \
351 mkdir $$i; \
352 chmod 755 $$i; \
353 else true; \
354 fi; \
355 done
Guido van Rossum914fbd91997-07-19 19:38:43 +0000356 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY)
357 $(RANLIB) $(LIBPL)/$(LIBRARY)
Guido van Rossum6403d281995-01-20 16:51:32 +0000358 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000359 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000360 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
361 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
362 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000363 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Guido van Rossum70a86591996-07-21 02:46:47 +0000364 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000365 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000366
Guido van Rossum586480b1996-05-28 22:49:08 +0000367# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000368# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000369sharedinstall:
370 cd Modules; $(MAKE) \
371 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000372 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000373 SO="$(SO)" \
374 LDSHARED="$(LDSHARED)" \
375 CCSHARED="$(CCSHARED)" \
376 LINKFORSHARED="$(LINKFORSHARED)" \
377 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000378 prefix="$(prefix)" \
379 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000380 sharedinstall
381
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000382# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000383Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000384 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000385 @for i in . $(SUBDIRS); do \
386 (echo making Makefile in subdirectory $$i; cd $$i; \
387 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000388 done
389
Guido van Rossumd09119e1995-01-17 16:45:08 +0000390# Build the intermediate Makefile in Modules
391Modules/Makefile.pre: config.status
392 $(SHELL) config.status
393
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000394# Build the toplevel Makefile
395Makefile: Makefile.in config.status
396 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
397
398# Run the configure script. If config.status already exists,
399# call it with the --recheck argument, which reruns configure with the
400# same options as it was run last time; otherwise run the configure
401# script with options taken from the $(WITH) variable
402config.status: $(srcdir)/configure
403 if test -f config.status; \
404 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000405 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000406 else $(SHELL) $(srcdir)/configure $(WITH); \
407 fi
408
409.PRECIOUS: config.status python
410
411# Rerun configure with the same options as it was run last time,
412# provided the config.status script exists
413recheck:
414 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000415 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000416
417# Rebuild the configure script from configure.in; also rebuild config.h.in
418autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000419 (cd $(srcdir); autoconf)
420 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000421
422# Create a tags file for vi
423tags::
424 ctags -w -t Include/*.h
425 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
426 sort tags -o tags
427
428# Create a tags file for GNU Emacs
429TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000430 etags Include/*.h
431 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000432
433# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000434depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000435 @for i in $(SUBDIRS); do \
436 (echo making depend in subdirectory $$i; cd $$i; \
437 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000438 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000439
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000440# Sanitation targets -- clean leaves libraries, executables and tags
441# files, which clobber removes those as well
442
Guido van Rossum627b2d71993-12-24 10:39:16 +0000443localclean:
444 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000445
446clean: localclean
447 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000448 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449 if test -f Makefile; \
450 then $(MAKE) clean; \
451 else $(MAKE) -f Makefile.*in clean; \
452 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000453 done
454
Guido van Rossum810a92f1993-12-28 19:39:56 +0000455localclobber: localclean
Guido van Rossumcf0be041997-08-29 18:42:35 +0000456 -rm -f tags TAGS python $(LIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000457 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000458
459clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000460 -for i in $(SUBDIRS); do \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000461 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000462 if test -f Makefile; \
463 then $(MAKE) clobber; \
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000464 else $(MAKE) -f $(srcdir)/Makefile.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000465 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000466 done
467
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000468# Make things extra clean, before making a distribution:
469# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000470distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000471 -$(MAKE) -f $(srcdir)/Makefile.in \
472 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000473 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000474 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000475 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000476 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
477 for f in $$i/*.in; do \
478 f=`basename "$$f" .in`; \
479 if test "$$f" != "*"; then \
480 echo rm -f "$$i/$$f"; \
481 rm -f "$$i/$$f"; \
482 fi; \
483 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000484 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000485
Guido van Rossum586480b1996-05-28 22:49:08 +0000486# Check for smelly exported symbols (not starting with Py/_Py)
487smelly: all
488 for i in $(SUBDIRS); do \
489 echo --- $$i ---; \
490 nm -p $$i/lib$$i.a | \
491 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
492 done
493
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000494# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000495funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000496 find $(DISTDIRS) -type d \
497 -o -name '*.[chs]' \
498 -o -name '*.py' \
499 -o -name '*.doc' \
500 -o -name '*.sty' \
501 -o -name '*.bib' \
502 -o -name '*.dat' \
503 -o -name '*.el' \
504 -o -name '*.fd' \
505 -o -name '*.in' \
506 -o -name '*.tex' \
507 -o -name '*,[vpt]' \
508 -o -name 'Setup' \
509 -o -name 'Setup.*' \
510 -o -name README \
511 -o -name Makefile \
512 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000513 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000514 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000515 -o -name Entries \
516 -o -name Tag \
517 -o -name tags \
518 -o -name TAGS \
519 -o -name .cvsignore \
520 -o -name MANIFEST \
521 -o -print