blob: 9a94a7b5e27b432b46a358290906c158cdfd1092 [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
Andrew M. Kuchling95695e22001-01-18 21:20:56 +0000158platform: python$(EXE)
159 ./python$(EXE) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
160
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000161# Build the shared modules
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000162sharedmods: python$(EXE)
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000163 ./python$(EXE) $(srcdir)/setup.py build
164# Old rules for building shared modules using makesetup
Andrew M. Kuchling1c2fb9c2001-01-18 16:10:56 +0000165oldsharedmods:
166 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
167 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
168 sharedmods
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000169
Guido van Rossum914fbd91997-07-19 19:38:43 +0000170# Build the library
171$(LIBRARY): $(SUBDIRS)
172 if test ! -f $(LIBRARY); \
173 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
174 else true; fi
175 for i in $(SUBDIRS); do \
176 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000177
Fred Drake047fe992000-10-09 16:51:49 +0000178# This rule is only here for DG/UX and BeOS!!!
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000179libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000180 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
181 *dgux*) \
182 test -d dgux || mkdir dgux; \
183 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
184 /bin/rm -rf ./dgux \
185 ;; \
Fred Drake047fe992000-10-09 16:51:49 +0000186 beos) \
187 $(srcdir)/BeOS/ar-fake so $(LIBRARY) $@ \
188 ;; \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000189 esac
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000190
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000191# This rule is here for OPENSTEP/Rhapsody/MacOSX
192libpython$(VERSION).dylib: $(LIBRARY)
193 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
194
Guido van Rossum4246edd1997-04-23 15:14:24 +0000195$(SUBDIRS): Makefiles
196
Thomas Wouters65469832000-08-11 22:26:35 +0000197Grammar:
Sjoerd Mullender59bb0802000-08-17 11:38:18 +0000198 cd Grammar ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
Thomas Wouters65469832000-08-11 22:26:35 +0000199 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
200
Guido van Rossum4246edd1997-04-23 15:14:24 +0000201Parser:
202 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
203 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
204
205Python:
206 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
207 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
208
209Objects:
210 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
211 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
212
Guido van Rossum914fbd91997-07-19 19:38:43 +0000213Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000214 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
215 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000216
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000217# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw29d0a002000-08-03 15:52:30 +0000218TESTOPTS= -l
Guido van Rossum042a0511997-01-03 15:54:36 +0000219TESTPROG= $(srcdir)/Lib/test/regrtest.py
Fred Drake9abc25e2000-02-10 17:23:44 +0000220TESTPYTHON= ./python$(EXE) -tt
Andrew M. Kuchling95695e22001-01-18 21:20:56 +0000221test: all platform
Guido van Rossumcf809d61997-10-20 23:16:32 +0000222 -rm -f $(srcdir)/Lib/test/*.py[co]
Guido van Rossum75e00582001-01-19 20:21:59 +0000223 -PYTHONPATH=./build/lib.`cat platform` $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
224 PYTHONPATH=./build/lib.`cat platform` $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000225
Guido van Rossum586480b1996-05-28 22:49:08 +0000226# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000227install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000228
Guido van Rossum64b65671996-07-30 20:42:12 +0000229# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000230altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000231
Guido van Rossum64b65671996-07-30 20:42:12 +0000232# Install the interpreter (by creating a hard link to python$(VERSION))
233bininstall: altbininstall
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000234 -if test -f $(BINDIR)/python$(EXE); \
235 then rm -f $(BINDIR)/python$(EXE); \
Guido van Rossum64b65671996-07-30 20:42:12 +0000236 else true; \
237 fi
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000238 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) python$(EXE))
Guido van Rossum810a92f1993-12-28 19:39:56 +0000239
Guido van Rossum3912fd81996-07-24 02:35:43 +0000240# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000241# This goes into $(exec_prefix)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000242altbininstall: python$(EXE)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000243 @for i in $(BINDIR); \
244 do \
245 if test ! -d $$i; then \
246 echo "Creating directory $$i"; \
247 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000248 chmod $(DIRMODE) $$i; \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000249 else true; \
250 fi; \
251 done
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000252 $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
Guido van Rossum8b0d95f1997-12-19 23:02:22 +0000253 if test -f libpython$(VERSION).so; then \
254 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
255 else true; \
256 fi
Guido van Rossumaef734b2001-01-10 21:09:12 +0000257 if test -f "$(DLLLIBRARY)"; then \
258 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
259 else true; \
260 fi
Guido van Rossum3912fd81996-07-24 02:35:43 +0000261
Guido van Rossum586480b1996-05-28 22:49:08 +0000262# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000263maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000264 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000265 do \
266 if test ! -d $$i; then \
267 echo "Creating directory $$i"; \
268 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000269 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000270 else true; \
271 fi; \
272 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000273 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000274 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000275
Guido van Rossumb535da31996-07-30 18:04:22 +0000276# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000277PLATDIR= plat-$(MACHDEP)
278MACHDEPS= $(PLATDIR)
Martin v. Löwisbc1c1c92000-09-24 19:57:18 +0000279XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000280LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000281 distutils distutils/command $(XMLLIBSUBDIRS) curses $(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 Rossumb73172f2000-08-29 15:00:11 +0000324 *.orig) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000325 *~) ;; \
326 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000327 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000328 if test -x $$i; then \
329 echo $(INSTALL_PROGRAM) $$i $$b; \
330 $(INSTALL_PROGRAM) $$i $$b; \
331 else \
332 echo $(INSTALL_DATA) $$i $$b; \
333 $(INSTALL_DATA) $$i $$b; \
334 fi;; \
335 esac; \
336 done; \
337 done
Guido van Rossum10912852000-09-05 04:46:32 +0000338 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
Guido van Rossumb535da31996-07-30 18:04:22 +0000339 PYTHONPATH=$(LIBDEST) \
Fred Drake4b0200e2000-07-04 04:15:53 +0000340 ./python$(EXE) -tt $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000341 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000342 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000343
Guido van Rossum86b7db31997-10-06 00:15:31 +0000344# Create the PLATDIR source directory, if one wasn't distributed..
345$(srcdir)/Lib/$(PLATDIR):
346 mkdir $(srcdir)/Lib/$(PLATDIR)
347 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000348 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000349 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossumfdddb312000-10-09 19:31:40 +0000350 export EXE; EXE="$(EXE)"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000351 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000352
Guido van Rossum586480b1996-05-28 22:49:08 +0000353# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000354INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000355inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000356 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000357 do \
358 if test ! -d $$i; then \
359 echo "Creating directory $$i"; \
360 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000361 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000362 else true; \
363 fi; \
364 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000365 @for i in $(srcdir)/Include/*.h; \
366 do \
367 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
368 $(INSTALL_DATA) $$i $(INCLUDEPY); \
369 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000370 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000371
Guido van Rossum914fbd91997-07-19 19:38:43 +0000372# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000373# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000374LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000375libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000376 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000377 do \
378 if test ! -d $$i; then \
379 echo "Creating directory $$i"; \
380 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000381 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000382 else true; \
383 fi; \
384 done
Guido van Rossumaef734b2001-01-10 21:09:12 +0000385 @if test -d $(LDLIBRARY); then :; else \
386 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
387 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000388 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000389 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000390 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000391 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
392 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
393 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000394 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Barry Warsaw6de72132000-06-30 16:04:18 +0000395 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Guido van Rossum70a86591996-07-21 02:46:47 +0000396 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000397 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000398 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000399 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000400 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000401 echo; echo "Installing support files for building shared extension modules on AIX:"; \
402 $(INSTALL_DATA) Modules/python.exp \
403 $(LIBPL)/python.exp; \
404 echo; echo "$(LIBPL)/python.exp"; \
405 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
406 $(LIBPL)/makexp_aix; \
407 echo "$(LIBPL)/makexp_aix"; \
408 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
409 $(LIBPL)/ld_so_aix; \
410 echo "$(LIBPL)/ld_so_aix"; \
411 echo; echo "See Misc/AIX-NOTES for details."; \
412 else true; \
413 fi
Fred Drake047fe992000-10-09 16:51:49 +0000414 @case "$(MACHDEP)" in beos*) \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000415 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
416 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
417 echo; echo "$(LIBPL)/README"; \
418 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
419 echo "$(LIBPL)/README.readline-2.2"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000420 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
421 echo "$(LIBPL)/ar-fake"; \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000422 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
423 echo "$(LIBPL)/linkmodule"; \
424 echo; echo "See BeOS/README for details."; \
Fred Drake047fe992000-10-09 16:51:49 +0000425 ;; \
426 esac
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000427
Guido van Rossum586480b1996-05-28 22:49:08 +0000428# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000429# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000430sharedinstall:
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000431 ./python$(EXE) $(srcdir)/setup.py install
432# Old rules for installing shared modules built using makesetup
Andrew M. Kuchling1c2fb9c2001-01-18 16:10:56 +0000433oldsharedinstall:
434 cd Modules; $(MAKE) \
435 OPT="$(OPT)" \
436 VERSION="$(VERSION)" \
437 SO="$(SO)" \
438 LDSHARED="$(LDSHARED)" \
439 CCSHARED="$(CCSHARED)" \
440 LINKFORSHARED="$(LINKFORSHARED)" \
441 DESTSHARED="$(DESTSHARED)" \
442 prefix="$(prefix)" \
443 exec_prefix="$(exec_prefix)" \
444 sharedinstall
Guido van Rossumac405f61994-09-12 10:56:06 +0000445
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000446# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000447Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000448 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000449 @for i in . $(SUBDIRS); do \
450 (echo making Makefile in subdirectory $$i; cd $$i; \
451 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000452 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000453 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000454
Guido van Rossumd09119e1995-01-17 16:45:08 +0000455# Build the intermediate Makefile in Modules
456Modules/Makefile.pre: config.status
457 $(SHELL) config.status
458
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000459# Build the toplevel Makefile
460Makefile: Makefile.in config.status
461 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
462
463# Run the configure script. If config.status already exists,
464# call it with the --recheck argument, which reruns configure with the
465# same options as it was run last time; otherwise run the configure
466# script with options taken from the $(WITH) variable
467config.status: $(srcdir)/configure
468 if test -f config.status; \
469 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000470 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000471 else $(SHELL) $(srcdir)/configure $(WITH); \
472 fi
473
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000474.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000475
476# Rerun configure with the same options as it was run last time,
477# provided the config.status script exists
478recheck:
479 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000480 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000481
482# Rebuild the configure script from configure.in; also rebuild config.h.in
483autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000484 (cd $(srcdir); autoconf)
485 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000486
487# Create a tags file for vi
488tags::
Guido van Rossum251caa52000-07-31 18:26:35 +0000489 cd $(srcdir); \
490 ctags -w -t Include/*.h; \
491 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; \
492 done; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000493 sort tags -o tags
494
495# Create a tags file for GNU Emacs
496TAGS::
Guido van Rossum251caa52000-07-31 18:26:35 +0000497 cd $(srcdir); \
498 etags Include/*.h; \
Guido van Rossum5552eb71994-08-05 15:51:00 +0000499 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000500
501# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000502depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000503 @for i in $(SUBDIRS); do \
504 (echo making depend in subdirectory $$i; cd $$i; \
505 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000506 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000507
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000508# Sanitation targets -- clean leaves libraries, executables and tags
509# files, which clobber removes those as well
510
Guido van Rossum627b2d71993-12-24 10:39:16 +0000511localclean:
512 -rm -f core *~ [@,#]* *.old *.orig *.rej
Andrew M. Kuchling6f477a62001-01-18 04:40:27 +0000513 -rm -rf build
Guido van Rossum627b2d71993-12-24 10:39:16 +0000514
515clean: localclean
516 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000517 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000518 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000519 if test -f Makefile; \
520 then $(MAKE) clean; \
521 else $(MAKE) -f Makefile.*in clean; \
522 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000523 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000524 done
525
Guido van Rossum810a92f1993-12-28 19:39:56 +0000526localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000527 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Andrew M. Kuchlingba77fc82001-01-17 18:54:54 +0000528 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000529
530clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000531 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000532 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000533 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000534 if test -f Makefile; \
535 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000536 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000537 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000538 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000539 done
540
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000541# Make things extra clean, before making a distribution:
542# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000543distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000544 -$(MAKE) -f $(srcdir)/Makefile.in \
545 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000546 -rm -f config.status config.log config.cache config.h Makefile
Andrew M. Kuchling95695e22001-01-18 21:20:56 +0000547 -rm -f buildno platform
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000548 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000549 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
550 for f in $$i/*.in; do \
551 f=`basename "$$f" .in`; \
552 if test "$$f" != "*"; then \
553 echo rm -f "$$i/$$f"; \
554 rm -f "$$i/$$f"; \
555 fi; \
556 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000557 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000558
Guido van Rossum586480b1996-05-28 22:49:08 +0000559# Check for smelly exported symbols (not starting with Py/_Py)
560smelly: all
561 for i in $(SUBDIRS); do \
562 echo --- $$i ---; \
563 nm -p $$i/lib$$i.a | \
564 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
565 done
566
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000567# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000568funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000569 find $(DISTDIRS) -type d \
570 -o -name '*.[chs]' \
571 -o -name '*.py' \
572 -o -name '*.doc' \
573 -o -name '*.sty' \
574 -o -name '*.bib' \
575 -o -name '*.dat' \
576 -o -name '*.el' \
577 -o -name '*.fd' \
578 -o -name '*.in' \
579 -o -name '*.tex' \
580 -o -name '*,[vpt]' \
581 -o -name 'Setup' \
582 -o -name 'Setup.*' \
583 -o -name README \
584 -o -name Makefile \
585 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000586 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000587 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000588 -o -name Entries \
589 -o -name Tag \
590 -o -name tags \
591 -o -name TAGS \
592 -o -name .cvsignore \
593 -o -name MANIFEST \
594 -o -print
Fred Drakeb0b7e312000-08-24 18:11:21 +0000595# IF YOU PUT ANYTHING HERE IT WILL GO AWAY