blob: 48d3f0cc90c80c8932577fca17f4cbd1ae7d1605 [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)
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000160 ./python$(EXE) $(srcdir)/setup.py build
161# Old rules for building shared modules using makesetup
Andrew M. Kuchling1c2fb9c2001-01-18 16:10:56 +0000162oldsharedmods:
163 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
164 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
165 sharedmods
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000166
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
Fred Drake047fe992000-10-09 16:51:49 +0000175# This rule is only here for DG/UX and BeOS!!!
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000176libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000177 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
178 *dgux*) \
179 test -d dgux || mkdir dgux; \
180 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
181 /bin/rm -rf ./dgux \
182 ;; \
Fred Drake047fe992000-10-09 16:51:49 +0000183 beos) \
184 $(srcdir)/BeOS/ar-fake so $(LIBRARY) $@ \
185 ;; \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000186 esac
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000187
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000188# This rule is here for OPENSTEP/Rhapsody/MacOSX
189libpython$(VERSION).dylib: $(LIBRARY)
190 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
191
Guido van Rossum4246edd1997-04-23 15:14:24 +0000192$(SUBDIRS): Makefiles
193
Thomas Wouters65469832000-08-11 22:26:35 +0000194Grammar:
Sjoerd Mullender59bb0802000-08-17 11:38:18 +0000195 cd Grammar ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
Thomas Wouters65469832000-08-11 22:26:35 +0000196 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
197
Guido van Rossum4246edd1997-04-23 15:14:24 +0000198Parser:
199 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
200 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
201
202Python:
203 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
204 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
205
206Objects:
207 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
208 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
209
Guido van Rossum914fbd91997-07-19 19:38:43 +0000210Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000211 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
212 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000213
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000214# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw29d0a002000-08-03 15:52:30 +0000215TESTOPTS= -l
Guido van Rossum042a0511997-01-03 15:54:36 +0000216TESTPROG= $(srcdir)/Lib/test/regrtest.py
Fred Drake9abc25e2000-02-10 17:23:44 +0000217TESTPYTHON= ./python$(EXE) -tt
Guido van Rossumbcb393f1999-11-16 15:58:32 +0000218test: all
Guido van Rossumcf809d61997-10-20 23:16:32 +0000219 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000220 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
221 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000222
Guido van Rossum586480b1996-05-28 22:49:08 +0000223# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000224install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000225
Guido van Rossum64b65671996-07-30 20:42:12 +0000226# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000227altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000228
Guido van Rossum64b65671996-07-30 20:42:12 +0000229# Install the interpreter (by creating a hard link to python$(VERSION))
230bininstall: altbininstall
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000231 -if test -f $(BINDIR)/python$(EXE); \
232 then rm -f $(BINDIR)/python$(EXE); \
Guido van Rossum64b65671996-07-30 20:42:12 +0000233 else true; \
234 fi
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000235 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) python$(EXE))
Guido van Rossum810a92f1993-12-28 19:39:56 +0000236
Guido van Rossum3912fd81996-07-24 02:35:43 +0000237# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000238# This goes into $(exec_prefix)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000239altbininstall: python$(EXE)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000240 @for i in $(BINDIR); \
241 do \
242 if test ! -d $$i; then \
243 echo "Creating directory $$i"; \
244 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000245 chmod $(DIRMODE) $$i; \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000246 else true; \
247 fi; \
248 done
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000249 $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
Guido van Rossum8b0d95f1997-12-19 23:02:22 +0000250 if test -f libpython$(VERSION).so; then \
251 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
252 else true; \
253 fi
Guido van Rossumaef734b2001-01-10 21:09:12 +0000254 if test -f "$(DLLLIBRARY)"; then \
255 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
256 else true; \
257 fi
Guido van Rossum3912fd81996-07-24 02:35:43 +0000258
Guido van Rossum586480b1996-05-28 22:49:08 +0000259# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000260maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000261 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000262 do \
263 if test ! -d $$i; then \
264 echo "Creating directory $$i"; \
265 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000266 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000267 else true; \
268 fi; \
269 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000270 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000271 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000272
Guido van Rossumb535da31996-07-30 18:04:22 +0000273# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000274PLATDIR= plat-$(MACHDEP)
275MACHDEPS= $(PLATDIR)
Martin v. Löwisbc1c1c92000-09-24 19:57:18 +0000276XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000277LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000278 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000279libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000280 @for i in $(SCRIPTDIR) $(LIBDEST); \
281 do \
282 if test ! -d $$i; then \
283 echo "Creating directory $$i"; \
284 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000285 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000286 else true; \
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 if test ! -d $$b; then \
295 echo "Creating directory $$b"; \
296 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000297 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000298 else true; \
299 fi; \
300 done
301 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
302 do \
303 if test -x $$i; then \
304 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
305 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
306 else \
307 $(INSTALL_DATA) $$i $(LIBDEST); \
308 echo $(INSTALL_DATA) $$i $(LIBDEST); \
309 fi; \
310 done
311 @for d in $(LIBSUBDIRS); \
312 do \
313 a=$(srcdir)/Lib/$$d; \
314 if test ! -d $$a; then continue; else true; fi; \
315 b=$(LIBDEST)/$$d; \
316 for i in $$a/*; \
317 do \
318 case $$i in \
319 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000320 *.py[co]) ;; \
Guido van Rossumb73172f2000-08-29 15:00:11 +0000321 *.orig) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000322 *~) ;; \
323 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000324 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000325 if test -x $$i; then \
326 echo $(INSTALL_PROGRAM) $$i $$b; \
327 $(INSTALL_PROGRAM) $$i $$b; \
328 else \
329 echo $(INSTALL_DATA) $$i $$b; \
330 $(INSTALL_DATA) $$i $$b; \
331 fi;; \
332 esac; \
333 done; \
334 done
Guido van Rossum10912852000-09-05 04:46:32 +0000335 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
Guido van Rossumb535da31996-07-30 18:04:22 +0000336 PYTHONPATH=$(LIBDEST) \
Fred Drake4b0200e2000-07-04 04:15:53 +0000337 ./python$(EXE) -tt $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000338 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000339 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000340
Guido van Rossum86b7db31997-10-06 00:15:31 +0000341# Create the PLATDIR source directory, if one wasn't distributed..
342$(srcdir)/Lib/$(PLATDIR):
343 mkdir $(srcdir)/Lib/$(PLATDIR)
344 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000345 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000346 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossumfdddb312000-10-09 19:31:40 +0000347 export EXE; EXE="$(EXE)"; \
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 Rossumaef734b2001-01-10 21:09:12 +0000382 @if test -d $(LDLIBRARY); then :; else \
383 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
384 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000385 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000386 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000387 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000388 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
389 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
390 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000391 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Barry Warsaw6de72132000-06-30 16:04:18 +0000392 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Guido van Rossum70a86591996-07-21 02:46:47 +0000393 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000394 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000395 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000396 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000397 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000398 echo; echo "Installing support files for building shared extension modules on AIX:"; \
399 $(INSTALL_DATA) Modules/python.exp \
400 $(LIBPL)/python.exp; \
401 echo; echo "$(LIBPL)/python.exp"; \
402 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
403 $(LIBPL)/makexp_aix; \
404 echo "$(LIBPL)/makexp_aix"; \
405 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
406 $(LIBPL)/ld_so_aix; \
407 echo "$(LIBPL)/ld_so_aix"; \
408 echo; echo "See Misc/AIX-NOTES for details."; \
409 else true; \
410 fi
Fred Drake047fe992000-10-09 16:51:49 +0000411 @case "$(MACHDEP)" in beos*) \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000412 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
413 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
414 echo; echo "$(LIBPL)/README"; \
415 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
416 echo "$(LIBPL)/README.readline-2.2"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000417 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
418 echo "$(LIBPL)/ar-fake"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000419 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
420 echo "$(LIBPL)/linkmodule"; \
421 echo; echo "See BeOS/README for details."; \
Fred Drake047fe992000-10-09 16:51:49 +0000422 ;; \
423 esac
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000424
Guido van Rossum586480b1996-05-28 22:49:08 +0000425# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000426# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000427sharedinstall:
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000428 ./python$(EXE) $(srcdir)/setup.py install
429# Old rules for installing shared modules built using makesetup
Andrew M. Kuchling1c2fb9c2001-01-18 16:10:56 +0000430oldsharedinstall:
431 cd Modules; $(MAKE) \
432 OPT="$(OPT)" \
433 VERSION="$(VERSION)" \
434 SO="$(SO)" \
435 LDSHARED="$(LDSHARED)" \
436 CCSHARED="$(CCSHARED)" \
437 LINKFORSHARED="$(LINKFORSHARED)" \
438 DESTSHARED="$(DESTSHARED)" \
439 prefix="$(prefix)" \
440 exec_prefix="$(exec_prefix)" \
441 sharedinstall
Guido van Rossumac405f61994-09-12 10:56:06 +0000442
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000443# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000444Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000445 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000446 @for i in . $(SUBDIRS); do \
447 (echo making Makefile in subdirectory $$i; cd $$i; \
448 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000450 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000451
Guido van Rossumd09119e1995-01-17 16:45:08 +0000452# Build the intermediate Makefile in Modules
453Modules/Makefile.pre: config.status
454 $(SHELL) config.status
455
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000456# Build the toplevel Makefile
457Makefile: Makefile.in config.status
458 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
459
460# Run the configure script. If config.status already exists,
461# call it with the --recheck argument, which reruns configure with the
462# same options as it was run last time; otherwise run the configure
463# script with options taken from the $(WITH) variable
464config.status: $(srcdir)/configure
465 if test -f config.status; \
466 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000467 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000468 else $(SHELL) $(srcdir)/configure $(WITH); \
469 fi
470
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000471.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000472
473# Rerun configure with the same options as it was run last time,
474# provided the config.status script exists
475recheck:
476 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000477 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000478
479# Rebuild the configure script from configure.in; also rebuild config.h.in
480autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000481 (cd $(srcdir); autoconf)
482 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000483
484# Create a tags file for vi
485tags::
Guido van Rossum251caa52000-07-31 18:26:35 +0000486 cd $(srcdir); \
487 ctags -w -t Include/*.h; \
488 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; \
489 done; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000490 sort tags -o tags
491
492# Create a tags file for GNU Emacs
493TAGS::
Guido van Rossum251caa52000-07-31 18:26:35 +0000494 cd $(srcdir); \
495 etags Include/*.h; \
Guido van Rossum5552eb71994-08-05 15:51:00 +0000496 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000497
498# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000499depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000500 @for i in $(SUBDIRS); do \
501 (echo making depend in subdirectory $$i; cd $$i; \
502 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000503 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000504
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000505# Sanitation targets -- clean leaves libraries, executables and tags
506# files, which clobber removes those as well
507
Guido van Rossum627b2d71993-12-24 10:39:16 +0000508localclean:
509 -rm -f core *~ [@,#]* *.old *.orig *.rej
Andrew M. Kuchling6f477a62001-01-18 04:40:27 +0000510 -rm -rf build
Guido van Rossum627b2d71993-12-24 10:39:16 +0000511
512clean: localclean
513 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000514 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000515 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000516 if test -f Makefile; \
517 then $(MAKE) clean; \
518 else $(MAKE) -f Makefile.*in clean; \
519 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000520 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000521 done
522
Guido van Rossum810a92f1993-12-28 19:39:56 +0000523localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000524 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000525 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000526
527clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000528 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000529 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000530 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000531 if test -f Makefile; \
532 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000533 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000534 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000535 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000536 done
537
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000538# Make things extra clean, before making a distribution:
539# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000540distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000541 -$(MAKE) -f $(srcdir)/Makefile.in \
542 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000543 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000544 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000545 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000546 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
547 for f in $$i/*.in; do \
548 f=`basename "$$f" .in`; \
549 if test "$$f" != "*"; then \
550 echo rm -f "$$i/$$f"; \
551 rm -f "$$i/$$f"; \
552 fi; \
553 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000554 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000555
Guido van Rossum586480b1996-05-28 22:49:08 +0000556# Check for smelly exported symbols (not starting with Py/_Py)
557smelly: all
558 for i in $(SUBDIRS); do \
559 echo --- $$i ---; \
560 nm -p $$i/lib$$i.a | \
561 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
562 done
563
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000564# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000565funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000566 find $(DISTDIRS) -type d \
567 -o -name '*.[chs]' \
568 -o -name '*.py' \
569 -o -name '*.doc' \
570 -o -name '*.sty' \
571 -o -name '*.bib' \
572 -o -name '*.dat' \
573 -o -name '*.el' \
574 -o -name '*.fd' \
575 -o -name '*.in' \
576 -o -name '*.tex' \
577 -o -name '*,[vpt]' \
578 -o -name 'Setup' \
579 -o -name 'Setup.*' \
580 -o -name README \
581 -o -name Makefile \
582 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000583 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000584 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000585 -o -name Entries \
586 -o -name Tag \
587 -o -name tags \
588 -o -name TAGS \
589 -o -name .cvsignore \
590 -o -name MANIFEST \
591 -o -print
Fred Drakeb0b7e312000-08-24 18:11:21 +0000592# IF YOU PUT ANYTHING HERE IT WILL GO AWAY