blob: 211c242fb3df40afded2866430e1537c25459845 [file] [log] [blame]
Guido van Rossum586480b1996-05-28 22:49:08 +00001# Top-level Makefile for Python
2#
3# As distributed, this file is called Makefile.in; it is processed
4# into the real Makefile by running the script ./configure, which
5# replaces things like @spam@ with values appropriate for your system.
6# This means that if you edit Makefile, your changes get lost the next
7# time you run the configure script. Ideally, you can do:
8#
9# ./configure
10# make
11# make test
12# make install
13#
14# The top-level Makefile invokes make recursively in a number of
15# subdirectories (see the SUBDIRS variable below). If you want to,
16# you can invoke make in individual subdirectories. However, the
17# sub-Makefiles are also generated by configure, and the quickest way
18# to make sure they are up to date is by running make (or "make
19# Makefiles") at the top level. This is particularly important for
20# Modules/Makefile, which has to be regenerated every time you edit
21# Modules/Setup. The python executable is built in the Modules
22# directory and then moved to the top-level directory. The recursive
23# makes pass three options to subordinate makes: OPT (a quick way to
Guido van Rossumb535da31996-07-30 18:04:22 +000024# change some compiler options; it usually defaults to -O), prefix and
Guido van Rossum586480b1996-05-28 22:49:08 +000025# exec_prefix (the installation paths).
26#
Guido van Rossumb535da31996-07-30 18:04:22 +000027# If you have a previous version of Python installed that you don't
28# want to overwrite, you can use "make altinstall" instead of "make
29# install". This changes the install procedure so it installs the
30# Python binary as "python<version>". The libraries and include files
31# are always installed in a subdirectory called "python<version>".
32# "make altinstall" does not install the manual page. If you want to
33# make this installation the "official" installation but want to keep
34# the old binary around "just in case", rename the installed python
35# binary to "python<oldversion>" before running "make install".
36# (This only works between different versions, e.g. 1.3 and 1.4 --
37# different betas of the same version will overwrite each other in
38# installation unless you override the VERSION Make variable.)
39#
Guido van Rossum64b65671996-07-30 20:42:12 +000040# In fact, "make install" or "make bininstall" installs the binary
41# as python<version> and makes a hard link to python, so when
42# installing a new version in the future, nothing of the current
43# version will be lost (except for the man page).
44#
Guido van Rossum586480b1996-05-28 22:49:08 +000045# If recursive makes fail, try invoking make as "make MAKE=make".
46#
47# See also the section "Build instructions" in the README file.
Guido van Rossum627b2d71993-12-24 10:39:16 +000048
Guido van Rossum433c8ad1994-08-01 12:07:07 +000049# Substitutions by configure
Guido van Rossum914fbd91997-07-19 19:38:43 +000050VERSION= @VERSION@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000051srcdir= @srcdir@
52VPATH= @srcdir@
Guido van Rossum1eec5281997-07-25 22:34:08 +000053CC= @CC@
Guido van Rossum5aadaf51997-08-19 14:40:11 +000054AR= @AR@
Guido van Rossum4a91df41994-10-10 17:58:27 +000055RANLIB= @RANLIB@
Guido van Rossum1eec5281997-07-25 22:34:08 +000056DEFS= @DEFS@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000057
Guido van Rossumac405f61994-09-12 10:56:06 +000058# Machine-dependent subdirectories
59MACHDEP= @MACHDEP@
60
Guido van Rossum433c8ad1994-08-01 12:07:07 +000061# Install prefix for architecture-independent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000062prefix= @prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000063
64# Install prefix for architecture-dependent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000065exec_prefix= @exec_prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000066
Guido van Rossum90412791994-10-20 22:04:30 +000067# Expanded directories
Guido van Rossumb535da31996-07-30 18:04:22 +000068BINDIR= $(exec_prefix)/bin
69LIBDIR= $(exec_prefix)/lib
70MANDIR= $(prefix)/man
71INCLUDEDIR= $(prefix)/include
Guido van Rossumabffd001997-09-11 14:37:59 +000072CONFINCLUDEDIR= $(exec_prefix)/include
Guido van Rossumb535da31996-07-30 18:04:22 +000073SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +000074
Guido van Rossumbed23fe1996-07-31 17:30:37 +000075# Detailed destination directories
76BINLIBDEST= $(LIBDIR)/python$(VERSION)
77LIBDEST= $(SCRIPTDIR)/python$(VERSION)
78INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
Guido van Rossumabffd001997-09-11 14:37:59 +000079CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
Guido van Rossumbed23fe1996-07-31 17:30:37 +000080LIBP= $(LIBDIR)/python$(VERSION)
81
Guido van Rossumac405f61994-09-12 10:56:06 +000082# Symbols used for using shared libraries
83SO= @SO@
84LDSHARED= @LDSHARED@
85CCSHARED= @CCSHARED@
86LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumcf809d61997-10-20 23:16:32 +000087DESTSHARED= $(BINLIBDEST)/lib-dynload
Guido van Rossumac405f61994-09-12 10:56:06 +000088
Guido van Rossum586480b1996-05-28 22:49:08 +000089# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +000090SHELL= /bin/sh
91
Guido van Rossumff555e32000-09-22 15:38:21 +000092# Executable suffix (.exe on Windows and Mac OS X)
93EXE= @EXE@
Guido van Rossumc9fd6001997-11-11 18:29:22 +000094
Guido van Rossum6cedf821997-12-02 17:52:37 +000095# Modes for directories, executables and data files created by the
Guido van Rossumb73172f2000-08-29 15:00:11 +000096# install process. Default to user-only-writable for all file types.
97DIRMODE= 755
Guido van Rossum6cedf821997-12-02 17:52:37 +000098EXEMODE= 755
99FILEMODE= 644
100
Guido van Rossum586480b1996-05-28 22:49:08 +0000101# Portable install script (configure doesn't always guess right)
102INSTALL= @srcdir@/install-sh -c
Guido van Rossum6cedf821997-12-02 17:52:37 +0000103INSTALL_PROGRAM=${INSTALL} -m $(EXEMODE)
104INSTALL_DATA= ${INSTALL} -m $(FILEMODE)
Guido van Rossum586480b1996-05-28 22:49:08 +0000105
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000106# Use this to make a link between python$(VERSION) and python in $(BINDIR)
107LN=@LN@
108
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000109# --with-PACKAGE options for configure script
110# e.g. --with-readline --with-svr5 --with-solaris --with-thread
111# (see README for an explanation)
112WITH=
113
114# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000115OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000116
117# Subdirectories where to run make recursively
Thomas Wouters65469832000-08-11 22:26:35 +0000118SUBDIRS= Parser Grammar Objects Python Modules
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000119
120# Other subdirectories
Thomas Wouters65469832000-08-11 22:26:35 +0000121SUBDIRSTOO= Include Lib Misc Demo
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000122
123# Files and directories to be distributed
124CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
125DISTFILES= README ChangeLog $(CONFIGFILES)
126DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
127DIST= $(DISTFILES) $(DISTDIRS)
128
Guido van Rossum1eec5281997-07-25 22:34:08 +0000129# Compilation flags for getbuildinfo.c only
130CFLAGS= $(OPT) -I. $(DEFS)
131
Guido van Rossum914fbd91997-07-19 19:38:43 +0000132LIBRARY= libpython$(VERSION).a
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000133LDLIBRARY= @LDLIBRARY@
Guido van Rossumaef734b2001-01-10 21:09:12 +0000134@SET_DLLLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000135
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000136# Default target
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000137all: $(LIBRARY) python$(EXE) sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000138
139# Build the interpreter
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000140python$(EXE): $(LIBRARY) buildno Modules/python.o
Guido van Rossum86c052e1997-08-20 22:13:15 +0000141 expr `cat buildno` + 1 >buildno1
142 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000143 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
144 $(srcdir)/Modules/getbuildinfo.c
145 $(AR) cr $(LIBRARY) getbuildinfo.o
146 $(RANLIB) $(LIBRARY)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000147 @MAKE_LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000148 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
149 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000150 LIBRARY=../$(LDLIBRARY) link
Guido van Rossum914fbd91997-07-19 19:38:43 +0000151
Guido van Rossum370a0831998-10-01 16:42:41 +0000152Modules/python.o: $(srcdir)/Modules/python.c
153 cd Modules; $(MAKE) OPT="$(OPT)" python.o
154
Guido van Rossum1eec5281997-07-25 22:34:08 +0000155buildno:
156 echo 0 >buildno
157
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000158# Build the shared modules
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000159sharedmods: python$(EXE)
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000160 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
161 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
162 sharedmods
163
Guido van Rossum914fbd91997-07-19 19:38:43 +0000164# Build the library
165$(LIBRARY): $(SUBDIRS)
166 if test ! -f $(LIBRARY); \
167 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
168 else true; fi
169 for i in $(SUBDIRS); do \
170 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000171
Fred Drake047fe992000-10-09 16:51:49 +0000172# This rule is only here for DG/UX and BeOS!!!
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000173libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000174 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
175 *dgux*) \
176 test -d dgux || mkdir dgux; \
177 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
178 /bin/rm -rf ./dgux \
179 ;; \
Fred Drake047fe992000-10-09 16:51:49 +0000180 beos) \
181 $(srcdir)/BeOS/ar-fake so $(LIBRARY) $@ \
182 ;; \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000183 esac
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000184
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000185# This rule is here for OPENSTEP/Rhapsody/MacOSX
186libpython$(VERSION).dylib: $(LIBRARY)
187 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
188
Guido van Rossum4246edd1997-04-23 15:14:24 +0000189$(SUBDIRS): Makefiles
190
Thomas Wouters65469832000-08-11 22:26:35 +0000191Grammar:
Sjoerd Mullender59bb0802000-08-17 11:38:18 +0000192 cd Grammar ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
Thomas Wouters65469832000-08-11 22:26:35 +0000193 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
194
Guido van Rossum4246edd1997-04-23 15:14:24 +0000195Parser:
196 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
197 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
198
199Python:
200 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
201 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
202
203Objects:
204 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
205 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
206
Guido van Rossum914fbd91997-07-19 19:38:43 +0000207Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000208 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
209 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000210
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000211# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw29d0a002000-08-03 15:52:30 +0000212TESTOPTS= -l
Guido van Rossum042a0511997-01-03 15:54:36 +0000213TESTPROG= $(srcdir)/Lib/test/regrtest.py
Fred Drake9abc25e2000-02-10 17:23:44 +0000214TESTPYTHON= ./python$(EXE) -tt
Guido van Rossumbcb393f1999-11-16 15:58:32 +0000215test: all
Guido van Rossumcf809d61997-10-20 23:16:32 +0000216 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000217 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
218 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000219
Guido van Rossum586480b1996-05-28 22:49:08 +0000220# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000221install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000222
Guido van Rossum64b65671996-07-30 20:42:12 +0000223# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000224altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000225
Guido van Rossum64b65671996-07-30 20:42:12 +0000226# Install the interpreter (by creating a hard link to python$(VERSION))
227bininstall: altbininstall
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000228 -if test -f $(BINDIR)/python$(EXE); \
229 then rm -f $(BINDIR)/python$(EXE); \
Guido van Rossum64b65671996-07-30 20:42:12 +0000230 else true; \
231 fi
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000232 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) python$(EXE))
Guido van Rossum810a92f1993-12-28 19:39:56 +0000233
Guido van Rossum3912fd81996-07-24 02:35:43 +0000234# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000235# This goes into $(exec_prefix)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000236altbininstall: python$(EXE)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000237 @for i in $(BINDIR); \
238 do \
239 if test ! -d $$i; then \
240 echo "Creating directory $$i"; \
241 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000242 chmod $(DIRMODE) $$i; \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000243 else true; \
244 fi; \
245 done
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000246 $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
Guido van Rossum8b0d95f1997-12-19 23:02:22 +0000247 if test -f libpython$(VERSION).so; then \
248 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
249 else true; \
250 fi
Guido van Rossumaef734b2001-01-10 21:09:12 +0000251 if test -f "$(DLLLIBRARY)"; then \
252 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
253 else true; \
254 fi
Guido van Rossum3912fd81996-07-24 02:35:43 +0000255
Guido van Rossum586480b1996-05-28 22:49:08 +0000256# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000257maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000258 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000259 do \
260 if test ! -d $$i; then \
261 echo "Creating directory $$i"; \
262 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000263 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000264 else true; \
265 fi; \
266 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000267 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000268 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000269
Guido van Rossumb535da31996-07-30 18:04:22 +0000270# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000271PLATDIR= plat-$(MACHDEP)
272MACHDEPS= $(PLATDIR)
Martin v. Löwisbc1c1c92000-09-24 19:57:18 +0000273XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000274LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000275 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000276libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000277 @for i in $(SCRIPTDIR) $(LIBDEST); \
278 do \
279 if test ! -d $$i; then \
280 echo "Creating directory $$i"; \
281 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000282 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000283 else true; \
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 if test ! -d $$b; then \
292 echo "Creating directory $$b"; \
293 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000294 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000295 else true; \
296 fi; \
297 done
298 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
299 do \
300 if test -x $$i; then \
301 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
302 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
303 else \
304 $(INSTALL_DATA) $$i $(LIBDEST); \
305 echo $(INSTALL_DATA) $$i $(LIBDEST); \
306 fi; \
307 done
308 @for d in $(LIBSUBDIRS); \
309 do \
310 a=$(srcdir)/Lib/$$d; \
311 if test ! -d $$a; then continue; else true; fi; \
312 b=$(LIBDEST)/$$d; \
313 for i in $$a/*; \
314 do \
315 case $$i in \
316 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000317 *.py[co]) ;; \
Guido van Rossumb73172f2000-08-29 15:00:11 +0000318 *.orig) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000319 *~) ;; \
320 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000321 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000322 if test -x $$i; then \
323 echo $(INSTALL_PROGRAM) $$i $$b; \
324 $(INSTALL_PROGRAM) $$i $$b; \
325 else \
326 echo $(INSTALL_DATA) $$i $$b; \
327 $(INSTALL_DATA) $$i $$b; \
328 fi;; \
329 esac; \
330 done; \
331 done
Guido van Rossum10912852000-09-05 04:46:32 +0000332 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
Guido van Rossumb535da31996-07-30 18:04:22 +0000333 PYTHONPATH=$(LIBDEST) \
Fred Drake4b0200e2000-07-04 04:15:53 +0000334 ./python$(EXE) -tt $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000335 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000336 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000337
Guido van Rossum86b7db31997-10-06 00:15:31 +0000338# Create the PLATDIR source directory, if one wasn't distributed..
339$(srcdir)/Lib/$(PLATDIR):
340 mkdir $(srcdir)/Lib/$(PLATDIR)
341 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000342 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000343 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossumfdddb312000-10-09 19:31:40 +0000344 export EXE; EXE="$(EXE)"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000345 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000346
Guido van Rossum586480b1996-05-28 22:49:08 +0000347# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000348INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000349inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000350 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000351 do \
352 if test ! -d $$i; then \
353 echo "Creating directory $$i"; \
354 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000355 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000356 else true; \
357 fi; \
358 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000359 @for i in $(srcdir)/Include/*.h; \
360 do \
361 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
362 $(INSTALL_DATA) $$i $(INCLUDEPY); \
363 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000364 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365
Guido van Rossum914fbd91997-07-19 19:38:43 +0000366# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000367# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000368LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000369libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000370 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000371 do \
372 if test ! -d $$i; then \
373 echo "Creating directory $$i"; \
374 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000375 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000376 else true; \
377 fi; \
378 done
Guido van Rossumaef734b2001-01-10 21:09:12 +0000379 @if test -d $(LDLIBRARY); then :; else \
380 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
381 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000382 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000383 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000384 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000385 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
386 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
387 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000388 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Barry Warsaw6de72132000-06-30 16:04:18 +0000389 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Guido van Rossum70a86591996-07-21 02:46:47 +0000390 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000391 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000392 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000393 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000394 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000395 echo; echo "Installing support files for building shared extension modules on AIX:"; \
396 $(INSTALL_DATA) Modules/python.exp \
397 $(LIBPL)/python.exp; \
398 echo; echo "$(LIBPL)/python.exp"; \
399 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
400 $(LIBPL)/makexp_aix; \
401 echo "$(LIBPL)/makexp_aix"; \
402 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
403 $(LIBPL)/ld_so_aix; \
404 echo "$(LIBPL)/ld_so_aix"; \
405 echo; echo "See Misc/AIX-NOTES for details."; \
406 else true; \
407 fi
Fred Drake047fe992000-10-09 16:51:49 +0000408 @case "$(MACHDEP)" in beos*) \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000409 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
410 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
411 echo; echo "$(LIBPL)/README"; \
412 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
413 echo "$(LIBPL)/README.readline-2.2"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000414 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
415 echo "$(LIBPL)/ar-fake"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000416 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
417 echo "$(LIBPL)/linkmodule"; \
418 echo; echo "See BeOS/README for details."; \
Fred Drake047fe992000-10-09 16:51:49 +0000419 ;; \
420 esac
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000421
Guido van Rossum586480b1996-05-28 22:49:08 +0000422# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000423# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000424sharedinstall:
425 cd Modules; $(MAKE) \
426 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000427 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000428 SO="$(SO)" \
429 LDSHARED="$(LDSHARED)" \
430 CCSHARED="$(CCSHARED)" \
431 LINKFORSHARED="$(LINKFORSHARED)" \
432 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000433 prefix="$(prefix)" \
434 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000435 sharedinstall
436
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000437# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000438Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000439 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000440 @for i in . $(SUBDIRS); do \
441 (echo making Makefile in subdirectory $$i; cd $$i; \
442 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000443 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000444 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000445
Guido van Rossumd09119e1995-01-17 16:45:08 +0000446# Build the intermediate Makefile in Modules
447Modules/Makefile.pre: config.status
448 $(SHELL) config.status
449
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000450# Build the toplevel Makefile
451Makefile: Makefile.in config.status
452 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
453
454# Run the configure script. If config.status already exists,
455# call it with the --recheck argument, which reruns configure with the
456# same options as it was run last time; otherwise run the configure
457# script with options taken from the $(WITH) variable
458config.status: $(srcdir)/configure
459 if test -f config.status; \
460 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000461 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000462 else $(SHELL) $(srcdir)/configure $(WITH); \
463 fi
464
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000465.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000466
467# Rerun configure with the same options as it was run last time,
468# provided the config.status script exists
469recheck:
470 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000471 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000472
473# Rebuild the configure script from configure.in; also rebuild config.h.in
474autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000475 (cd $(srcdir); autoconf)
476 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000477
478# Create a tags file for vi
479tags::
Guido van Rossum251caa52000-07-31 18:26:35 +0000480 cd $(srcdir); \
481 ctags -w -t Include/*.h; \
482 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; \
483 done; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000484 sort tags -o tags
485
486# Create a tags file for GNU Emacs
487TAGS::
Guido van Rossum251caa52000-07-31 18:26:35 +0000488 cd $(srcdir); \
489 etags Include/*.h; \
Guido van Rossum5552eb71994-08-05 15:51:00 +0000490 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000491
492# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000493depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000494 @for i in $(SUBDIRS); do \
495 (echo making depend in subdirectory $$i; cd $$i; \
496 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000497 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000498
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000499# Sanitation targets -- clean leaves libraries, executables and tags
500# files, which clobber removes those as well
501
Guido van Rossum627b2d71993-12-24 10:39:16 +0000502localclean:
503 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000504
505clean: localclean
506 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000507 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000508 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000509 if test -f Makefile; \
510 then $(MAKE) clean; \
511 else $(MAKE) -f Makefile.*in clean; \
512 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000513 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000514 done
515
Guido van Rossum810a92f1993-12-28 19:39:56 +0000516localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000517 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000518 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000519
520clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000521 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000522 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000523 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000524 if test -f Makefile; \
525 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000526 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000527 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000528 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000529 done
530
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000531# Make things extra clean, before making a distribution:
532# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000533distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000534 -$(MAKE) -f $(srcdir)/Makefile.in \
535 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000536 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000537 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000538 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000539 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
540 for f in $$i/*.in; do \
541 f=`basename "$$f" .in`; \
542 if test "$$f" != "*"; then \
543 echo rm -f "$$i/$$f"; \
544 rm -f "$$i/$$f"; \
545 fi; \
546 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000547 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000548
Guido van Rossum586480b1996-05-28 22:49:08 +0000549# Check for smelly exported symbols (not starting with Py/_Py)
550smelly: all
551 for i in $(SUBDIRS); do \
552 echo --- $$i ---; \
553 nm -p $$i/lib$$i.a | \
554 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
555 done
556
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000557# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000558funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000559 find $(DISTDIRS) -type d \
560 -o -name '*.[chs]' \
561 -o -name '*.py' \
562 -o -name '*.doc' \
563 -o -name '*.sty' \
564 -o -name '*.bib' \
565 -o -name '*.dat' \
566 -o -name '*.el' \
567 -o -name '*.fd' \
568 -o -name '*.in' \
569 -o -name '*.tex' \
570 -o -name '*,[vpt]' \
571 -o -name 'Setup' \
572 -o -name 'Setup.*' \
573 -o -name README \
574 -o -name Makefile \
575 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000576 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000577 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000578 -o -name Entries \
579 -o -name Tag \
580 -o -name tags \
581 -o -name TAGS \
582 -o -name .cvsignore \
583 -o -name MANIFEST \
584 -o -print
Fred Drakeb0b7e312000-08-24 18:11:21 +0000585# IF YOU PUT ANYTHING HERE IT WILL GO AWAY