blob: 14eab14b830338765367ffda32381ac99e97c41e [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 Rossumc9fd6001997-11-11 18:29:22 +0000122# Use ``EXE=.exe'' for Unix emulations on DOS/Windows (e.g. GNUWIN32)
123EXE=
124
Guido van Rossum6cedf821997-12-02 17:52:37 +0000125# Modes for directories, executables and data files created by the
126# install process. Default to group-writable directories but
127# user-only-writable for executables and data files.
128DIRMODE= 775
129EXEMODE= 755
130FILEMODE= 644
131
Guido van Rossum586480b1996-05-28 22:49:08 +0000132# Portable install script (configure doesn't always guess right)
133INSTALL= @srcdir@/install-sh -c
Guido van Rossum6cedf821997-12-02 17:52:37 +0000134INSTALL_PROGRAM=${INSTALL} -m $(EXEMODE)
135INSTALL_DATA= ${INSTALL} -m $(FILEMODE)
Guido van Rossum586480b1996-05-28 22:49:08 +0000136
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000137# Use this to make a link between python$(VERSION) and python in $(BINDIR)
138LN=@LN@
139
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000140# --with-PACKAGE options for configure script
141# e.g. --with-readline --with-svr5 --with-solaris --with-thread
142# (see README for an explanation)
143WITH=
144
145# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000146OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000147
148# Subdirectories where to run make recursively
149SUBDIRS= Parser Objects Python Modules
150
151# Other subdirectories
Guido van Rossum15527e91998-05-19 21:15:03 +0000152SUBDIRSTOO= Include Lib Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000153
154# Files and directories to be distributed
155CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
156DISTFILES= README ChangeLog $(CONFIGFILES)
157DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
158DIST= $(DISTFILES) $(DISTDIRS)
159
Guido van Rossum1eec5281997-07-25 22:34:08 +0000160# Compilation flags for getbuildinfo.c only
161CFLAGS= $(OPT) -I. $(DEFS)
162
Guido van Rossum914fbd91997-07-19 19:38:43 +0000163LIBRARY= libpython$(VERSION).a
164
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000165# Default target
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000166all: $(LIBRARY) python sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000167
168# Build the interpreter
Guido van Rossum1eec5281997-07-25 22:34:08 +0000169python: $(LIBRARY) buildno
Guido van Rossum86c052e1997-08-20 22:13:15 +0000170 expr `cat buildno` + 1 >buildno1
171 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000172 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
173 $(srcdir)/Modules/getbuildinfo.c
174 $(AR) cr $(LIBRARY) getbuildinfo.o
175 $(RANLIB) $(LIBRARY)
Guido van Rossum414f2611998-02-19 21:33:13 +0000176 @DGUX_IS_BROKEN@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000177 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
178 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
179 LIBRARY=../$(LIBRARY) link
180
Guido van Rossum1eec5281997-07-25 22:34:08 +0000181buildno:
182 echo 0 >buildno
183
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000184# Build the shared modules
185sharedmods: python
186 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
187 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
188 sharedmods
189
Guido van Rossum914fbd91997-07-19 19:38:43 +0000190# Build the library
191$(LIBRARY): $(SUBDIRS)
192 if test ! -f $(LIBRARY); \
193 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
194 else true; fi
195 for i in $(SUBDIRS); do \
196 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000197
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000198# This rule is only here for DG/UX!!!
199libpython$(VERSION).so: $(LIBRARY)
200 test -d dgux || mkdir dgux
201 (cd dgux;ar x ../$^;ld -G -o ../$@ * )
202 /bin/rm -rf ./dgux
203
Guido van Rossum4246edd1997-04-23 15:14:24 +0000204$(SUBDIRS): Makefiles
205
206Parser:
207 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
208 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
209
210Python:
211 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
212 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
213
214Objects:
215 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
216 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
217
Guido van Rossum914fbd91997-07-19 19:38:43 +0000218Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000219 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
220 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000221
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000222# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw9121ab91997-01-02 20:01:44 +0000223TESTOPTS=
Guido van Rossum042a0511997-01-03 15:54:36 +0000224TESTPROG= $(srcdir)/Lib/test/regrtest.py
Barry Warsawdd82bb91997-08-29 21:52:14 +0000225TESTPYTHON= ./python
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000226test: python
Guido van Rossumcf809d61997-10-20 23:16:32 +0000227 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000228 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
229 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000230
Guido van Rossum586480b1996-05-28 22:49:08 +0000231# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000232install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000233
Guido van Rossum64b65671996-07-30 20:42:12 +0000234# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000235altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000236
Guido van Rossum64b65671996-07-30 20:42:12 +0000237# Install the interpreter (by creating a hard link to python$(VERSION))
238bininstall: altbininstall
239 -if test -f $(BINDIR)/python; \
240 then rm -f $(BINDIR)/python; \
241 else true; \
242 fi
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000243 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) python$(EXE))
Guido van Rossum810a92f1993-12-28 19:39:56 +0000244
Guido van Rossum3912fd81996-07-24 02:35:43 +0000245# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000246# This goes into $(exec_prefix)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000247altbininstall: python
248 @for i in $(BINDIR); \
249 do \
250 if test ! -d $$i; then \
251 echo "Creating directory $$i"; \
252 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000253 chmod $(DIRMODE) $$i; \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000254 else true; \
255 fi; \
256 done
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000257 $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
Guido van Rossum414f2611998-02-19 21:33:13 +0000258 @DGUX_IS_BROKEN@
Guido van Rossum8b0d95f1997-12-19 23:02:22 +0000259 if test -f libpython$(VERSION).so; then \
260 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
261 else true; \
262 fi
Guido van Rossum3912fd81996-07-24 02:35:43 +0000263
Guido van Rossum586480b1996-05-28 22:49:08 +0000264# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000265maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000266 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000267 do \
268 if test ! -d $$i; then \
269 echo "Creating directory $$i"; \
270 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000271 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000272 else true; \
273 fi; \
274 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000275 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000276 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000277
Guido van Rossumb535da31996-07-30 18:04:22 +0000278# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000279PLATDIR= plat-$(MACHDEP)
280MACHDEPS= $(PLATDIR)
Guido van Rossum38bbbc71997-09-08 01:51:23 +0000281LIBSUBDIRS= lib-stdwin lib-tk test test/output $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000282libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000283 @for i in $(SCRIPTDIR) $(LIBDEST); \
284 do \
285 if test ! -d $$i; then \
286 echo "Creating directory $$i"; \
287 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000288 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000289 else true; \
290 fi; \
291 done
292 @for d in $(LIBSUBDIRS); \
293 do \
294 a=$(srcdir)/Lib/$$d; \
295 if test ! -d $$a; then continue; else true; fi; \
296 b=$(LIBDEST)/$$d; \
297 if test ! -d $$b; then \
298 echo "Creating directory $$b"; \
299 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000300 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000301 else true; \
302 fi; \
303 done
304 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
305 do \
306 if test -x $$i; then \
307 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
308 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
309 else \
310 $(INSTALL_DATA) $$i $(LIBDEST); \
311 echo $(INSTALL_DATA) $$i $(LIBDEST); \
312 fi; \
313 done
314 @for d in $(LIBSUBDIRS); \
315 do \
316 a=$(srcdir)/Lib/$$d; \
317 if test ! -d $$a; then continue; else true; fi; \
318 b=$(LIBDEST)/$$d; \
319 for i in $$a/*; \
320 do \
321 case $$i in \
322 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000323 *.py[co]) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000324 *~) ;; \
325 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000326 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000327 if test -x $$i; then \
328 echo $(INSTALL_PROGRAM) $$i $$b; \
329 $(INSTALL_PROGRAM) $$i $$b; \
330 else \
331 echo $(INSTALL_DATA) $$i $$b; \
332 $(INSTALL_DATA) $$i $$b; \
333 fi;; \
334 esac; \
335 done; \
336 done
337 PYTHONPATH=$(LIBDEST) \
338 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000339 PYTHONPATH=$(LIBDEST) \
340 ./python -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000341
Guido van Rossum86b7db31997-10-06 00:15:31 +0000342# Create the PLATDIR source directory, if one wasn't distributed..
343$(srcdir)/Lib/$(PLATDIR):
344 mkdir $(srcdir)/Lib/$(PLATDIR)
345 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000346 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000347 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000348 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000349
Guido van Rossum586480b1996-05-28 22:49:08 +0000350# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000351INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000352inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000353 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000354 do \
355 if test ! -d $$i; then \
356 echo "Creating directory $$i"; \
357 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000358 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000359 else true; \
360 fi; \
361 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000362 @for i in $(srcdir)/Include/*.h; \
363 do \
364 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
365 $(INSTALL_DATA) $$i $(INCLUDEPY); \
366 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000367 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000368
Guido van Rossum914fbd91997-07-19 19:38:43 +0000369# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000370# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000371LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000372libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000373 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000374 do \
375 if test ! -d $$i; then \
376 echo "Creating directory $$i"; \
377 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000378 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000379 else true; \
380 fi; \
381 done
Guido van Rossum914fbd91997-07-19 19:38:43 +0000382 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY)
383 $(RANLIB) $(LIBPL)/$(LIBRARY)
Guido van Rossum6403d281995-01-20 16:51:32 +0000384 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000385 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000386 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
387 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
388 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000389 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Fred Drakefc5d8b11997-12-09 15:18:33 +0000390 $(INSTALL_DATA) Modules/Setup.thread $(LIBPL)/Setup.thread
Guido van Rossum70a86591996-07-21 02:46:47 +0000391 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000392 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000393 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000394 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000395 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000396 echo; echo "Installing support files for building shared extension modules on AIX:"; \
397 $(INSTALL_DATA) Modules/python.exp \
398 $(LIBPL)/python.exp; \
399 echo; echo "$(LIBPL)/python.exp"; \
400 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
401 $(LIBPL)/makexp_aix; \
402 echo "$(LIBPL)/makexp_aix"; \
403 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
404 $(LIBPL)/ld_so_aix; \
405 echo "$(LIBPL)/ld_so_aix"; \
406 echo; echo "See Misc/AIX-NOTES for details."; \
407 else true; \
408 fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000409
Guido van Rossum586480b1996-05-28 22:49:08 +0000410# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000411# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000412sharedinstall:
413 cd Modules; $(MAKE) \
414 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000415 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000416 SO="$(SO)" \
417 LDSHARED="$(LDSHARED)" \
418 CCSHARED="$(CCSHARED)" \
419 LINKFORSHARED="$(LINKFORSHARED)" \
420 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000421 prefix="$(prefix)" \
422 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000423 sharedinstall
424
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000425# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000426Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000427 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000428 @for i in . $(SUBDIRS); do \
429 (echo making Makefile in subdirectory $$i; cd $$i; \
430 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000431 done
432
Guido van Rossumd09119e1995-01-17 16:45:08 +0000433# Build the intermediate Makefile in Modules
434Modules/Makefile.pre: config.status
435 $(SHELL) config.status
436
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000437# Build the toplevel Makefile
438Makefile: Makefile.in config.status
439 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
440
441# Run the configure script. If config.status already exists,
442# call it with the --recheck argument, which reruns configure with the
443# same options as it was run last time; otherwise run the configure
444# script with options taken from the $(WITH) variable
445config.status: $(srcdir)/configure
446 if test -f config.status; \
447 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000448 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449 else $(SHELL) $(srcdir)/configure $(WITH); \
450 fi
451
452.PRECIOUS: config.status python
453
454# Rerun configure with the same options as it was run last time,
455# provided the config.status script exists
456recheck:
457 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000458 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000459
460# Rebuild the configure script from configure.in; also rebuild config.h.in
461autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000462 (cd $(srcdir); autoconf)
463 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000464
465# Create a tags file for vi
466tags::
467 ctags -w -t Include/*.h
468 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
469 sort tags -o tags
470
471# Create a tags file for GNU Emacs
472TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000473 etags Include/*.h
474 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000475
476# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000477depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000478 @for i in $(SUBDIRS); do \
479 (echo making depend in subdirectory $$i; cd $$i; \
480 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000481 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000482
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000483# Sanitation targets -- clean leaves libraries, executables and tags
484# files, which clobber removes those as well
485
Guido van Rossum627b2d71993-12-24 10:39:16 +0000486localclean:
487 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000488
489clean: localclean
490 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000491 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000492 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000493 if test -f Makefile; \
494 then $(MAKE) clean; \
495 else $(MAKE) -f Makefile.*in clean; \
496 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000497 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000498 done
499
Guido van Rossum810a92f1993-12-28 19:39:56 +0000500localclobber: localclean
Guido van Rossumcf0be041997-08-29 18:42:35 +0000501 -rm -f tags TAGS python $(LIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000502 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000503
504clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000505 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000506 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000507 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000508 if test -f Makefile; \
509 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000510 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000511 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000512 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000513 done
514
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000515# Make things extra clean, before making a distribution:
516# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000517distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000518 -$(MAKE) -f $(srcdir)/Makefile.in \
519 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000520 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000521 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000522 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000523 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
524 for f in $$i/*.in; do \
525 f=`basename "$$f" .in`; \
526 if test "$$f" != "*"; then \
527 echo rm -f "$$i/$$f"; \
528 rm -f "$$i/$$f"; \
529 fi; \
530 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000531 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000532
Guido van Rossum586480b1996-05-28 22:49:08 +0000533# Check for smelly exported symbols (not starting with Py/_Py)
534smelly: all
535 for i in $(SUBDIRS); do \
536 echo --- $$i ---; \
537 nm -p $$i/lib$$i.a | \
538 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
539 done
540
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000541# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000542funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000543 find $(DISTDIRS) -type d \
544 -o -name '*.[chs]' \
545 -o -name '*.py' \
546 -o -name '*.doc' \
547 -o -name '*.sty' \
548 -o -name '*.bib' \
549 -o -name '*.dat' \
550 -o -name '*.el' \
551 -o -name '*.fd' \
552 -o -name '*.in' \
553 -o -name '*.tex' \
554 -o -name '*,[vpt]' \
555 -o -name 'Setup' \
556 -o -name 'Setup.*' \
557 -o -name README \
558 -o -name Makefile \
559 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000560 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000561 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000562 -o -name Entries \
563 -o -name Tag \
564 -o -name tags \
565 -o -name TAGS \
566 -o -name .cvsignore \
567 -o -name MANIFEST \
568 -o -print