blob: 77492d3ffc6b56be5fe15e5312c0d46b21aee2d1 [file] [log] [blame]
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001########################################################################
Guido van Rossumef4bb5f2000-07-01 00:16:13 +00002# Copyright (c) 2000, BeOpen.com.
3# Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4# Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5# All rights reserved.
Guido van Rossumd266eb41996-10-25 14:44:06 +00006#
Guido van Rossumef4bb5f2000-07-01 00:16:13 +00007# See the file "Misc/COPYRIGHT" for information on usage and
8# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00009########################################################################
Guido van Rossum627b2d71993-12-24 10:39:16 +000010
Guido van Rossum586480b1996-05-28 22:49:08 +000011# Top-level Makefile for Python
12#
13# As distributed, this file is called Makefile.in; it is processed
14# into the real Makefile by running the script ./configure, which
15# replaces things like @spam@ with values appropriate for your system.
16# This means that if you edit Makefile, your changes get lost the next
17# time you run the configure script. Ideally, you can do:
18#
19# ./configure
20# make
21# make test
22# make install
23#
24# The top-level Makefile invokes make recursively in a number of
25# subdirectories (see the SUBDIRS variable below). If you want to,
26# you can invoke make in individual subdirectories. However, the
27# sub-Makefiles are also generated by configure, and the quickest way
28# to make sure they are up to date is by running make (or "make
29# Makefiles") at the top level. This is particularly important for
30# Modules/Makefile, which has to be regenerated every time you edit
31# Modules/Setup. The python executable is built in the Modules
32# directory and then moved to the top-level directory. The recursive
33# makes pass three options to subordinate makes: OPT (a quick way to
Guido van Rossumb535da31996-07-30 18:04:22 +000034# change some compiler options; it usually defaults to -O), prefix and
Guido van Rossum586480b1996-05-28 22:49:08 +000035# exec_prefix (the installation paths).
36#
Guido van Rossumb535da31996-07-30 18:04:22 +000037# If you have a previous version of Python installed that you don't
38# want to overwrite, you can use "make altinstall" instead of "make
39# install". This changes the install procedure so it installs the
40# Python binary as "python<version>". The libraries and include files
41# are always installed in a subdirectory called "python<version>".
42# "make altinstall" does not install the manual page. If you want to
43# make this installation the "official" installation but want to keep
44# the old binary around "just in case", rename the installed python
45# binary to "python<oldversion>" before running "make install".
46# (This only works between different versions, e.g. 1.3 and 1.4 --
47# different betas of the same version will overwrite each other in
48# installation unless you override the VERSION Make variable.)
49#
Guido van Rossum64b65671996-07-30 20:42:12 +000050# In fact, "make install" or "make bininstall" installs the binary
51# as python<version> and makes a hard link to python, so when
52# installing a new version in the future, nothing of the current
53# version will be lost (except for the man page).
54#
Guido van Rossum586480b1996-05-28 22:49:08 +000055# If recursive makes fail, try invoking make as "make MAKE=make".
56#
57# See also the section "Build instructions" in the README file.
Guido van Rossum627b2d71993-12-24 10:39:16 +000058
Guido van Rossum433c8ad1994-08-01 12:07:07 +000059# Substitutions by configure
Guido van Rossum914fbd91997-07-19 19:38:43 +000060VERSION= @VERSION@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000061srcdir= @srcdir@
62VPATH= @srcdir@
Guido van Rossum1eec5281997-07-25 22:34:08 +000063CC= @CC@
Guido van Rossum5aadaf51997-08-19 14:40:11 +000064AR= @AR@
Guido van Rossum4a91df41994-10-10 17:58:27 +000065RANLIB= @RANLIB@
Guido van Rossum1eec5281997-07-25 22:34:08 +000066DEFS= @DEFS@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000067
Guido van Rossumac405f61994-09-12 10:56:06 +000068# Machine-dependent subdirectories
69MACHDEP= @MACHDEP@
70
Guido van Rossum433c8ad1994-08-01 12:07:07 +000071# Install prefix for architecture-independent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000072prefix= @prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000073
74# Install prefix for architecture-dependent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000075exec_prefix= @exec_prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000076
Guido van Rossum90412791994-10-20 22:04:30 +000077# Expanded directories
Guido van Rossumb535da31996-07-30 18:04:22 +000078BINDIR= $(exec_prefix)/bin
79LIBDIR= $(exec_prefix)/lib
80MANDIR= $(prefix)/man
81INCLUDEDIR= $(prefix)/include
Guido van Rossumabffd001997-09-11 14:37:59 +000082CONFINCLUDEDIR= $(exec_prefix)/include
Guido van Rossumb535da31996-07-30 18:04:22 +000083SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +000084
Guido van Rossumbed23fe1996-07-31 17:30:37 +000085# Detailed destination directories
86BINLIBDEST= $(LIBDIR)/python$(VERSION)
87LIBDEST= $(SCRIPTDIR)/python$(VERSION)
88INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
Guido van Rossumabffd001997-09-11 14:37:59 +000089CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
Guido van Rossumbed23fe1996-07-31 17:30:37 +000090LIBP= $(LIBDIR)/python$(VERSION)
91
Guido van Rossumac405f61994-09-12 10:56:06 +000092# Symbols used for using shared libraries
93SO= @SO@
94LDSHARED= @LDSHARED@
95CCSHARED= @CCSHARED@
96LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumcf809d61997-10-20 23:16:32 +000097DESTSHARED= $(BINLIBDEST)/lib-dynload
Guido van Rossumac405f61994-09-12 10:56:06 +000098
Guido van Rossum586480b1996-05-28 22:49:08 +000099# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000100SHELL= /bin/sh
101
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000102# Use ``EXE=.exe'' for Unix emulations on DOS/Windows (e.g. GNUWIN32)
103EXE=
104
Guido van Rossum6cedf821997-12-02 17:52:37 +0000105# Modes for directories, executables and data files created by the
106# install process. Default to group-writable directories but
107# user-only-writable for executables and data files.
108DIRMODE= 775
109EXEMODE= 755
110FILEMODE= 644
111
Guido van Rossum586480b1996-05-28 22:49:08 +0000112# Portable install script (configure doesn't always guess right)
113INSTALL= @srcdir@/install-sh -c
Guido van Rossum6cedf821997-12-02 17:52:37 +0000114INSTALL_PROGRAM=${INSTALL} -m $(EXEMODE)
115INSTALL_DATA= ${INSTALL} -m $(FILEMODE)
Guido van Rossum586480b1996-05-28 22:49:08 +0000116
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000117# Use this to make a link between python$(VERSION) and python in $(BINDIR)
118LN=@LN@
119
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000120# --with-PACKAGE options for configure script
121# e.g. --with-readline --with-svr5 --with-solaris --with-thread
122# (see README for an explanation)
123WITH=
124
125# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000126OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000127
128# Subdirectories where to run make recursively
129SUBDIRS= Parser Objects Python Modules
130
131# Other subdirectories
Guido van Rossum15527e91998-05-19 21:15:03 +0000132SUBDIRSTOO= Include Lib Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000133
134# Files and directories to be distributed
135CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
136DISTFILES= README ChangeLog $(CONFIGFILES)
137DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
138DIST= $(DISTFILES) $(DISTDIRS)
139
Guido van Rossum1eec5281997-07-25 22:34:08 +0000140# Compilation flags for getbuildinfo.c only
141CFLAGS= $(OPT) -I. $(DEFS)
142
Guido van Rossum914fbd91997-07-19 19:38:43 +0000143LIBRARY= libpython$(VERSION).a
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000144LDLIBRARY= @LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000145
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000146# Default target
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000147all: $(LIBRARY) python$(EXE) sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000148
149# Build the interpreter
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000150python$(EXE): $(LIBRARY) buildno Modules/python.o
Guido van Rossum86c052e1997-08-20 22:13:15 +0000151 expr `cat buildno` + 1 >buildno1
152 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000153 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
154 $(srcdir)/Modules/getbuildinfo.c
155 $(AR) cr $(LIBRARY) getbuildinfo.o
156 $(RANLIB) $(LIBRARY)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000157 @MAKE_LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000158 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
159 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000160 LIBRARY=../$(LDLIBRARY) link
Guido van Rossum914fbd91997-07-19 19:38:43 +0000161
Guido van Rossum370a0831998-10-01 16:42:41 +0000162Modules/python.o: $(srcdir)/Modules/python.c
163 cd Modules; $(MAKE) OPT="$(OPT)" python.o
164
Guido van Rossum1eec5281997-07-25 22:34:08 +0000165buildno:
166 echo 0 >buildno
167
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000168# Build the shared modules
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000169sharedmods: python$(EXE)
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000170 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
171 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
172 sharedmods
173
Guido van Rossum914fbd91997-07-19 19:38:43 +0000174# Build the library
175$(LIBRARY): $(SUBDIRS)
176 if test ! -f $(LIBRARY); \
177 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
178 else true; fi
179 for i in $(SUBDIRS); do \
180 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000181
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000182# This rule is only here for DG/UX!!!
183libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000184 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
185 *dgux*) \
186 test -d dgux || mkdir dgux; \
187 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
188 /bin/rm -rf ./dgux \
189 ;; \
190 esac
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000191
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000192# This rule is here for OPENSTEP/Rhapsody/MacOSX
193libpython$(VERSION).dylib: $(LIBRARY)
194 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
195
Guido van Rossum4246edd1997-04-23 15:14:24 +0000196$(SUBDIRS): Makefiles
197
198Parser:
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 Warsaw9121ab91997-01-02 20:01:44 +0000215TESTOPTS=
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 Rossum3912fd81996-07-24 02:35:43 +0000254
Guido van Rossum586480b1996-05-28 22:49:08 +0000255# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000256maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000257 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000258 do \
259 if test ! -d $$i; then \
260 echo "Creating directory $$i"; \
261 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000262 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000263 else true; \
264 fi; \
265 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000266 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000267 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000268
Guido van Rossumb535da31996-07-30 18:04:22 +0000269# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000270PLATDIR= plat-$(MACHDEP)
271MACHDEPS= $(PLATDIR)
Fred Drake4247ba62000-06-30 15:46:08 +0000272XMLLIBSUBDIRS= xml xml/dom xml/parser xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000273LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000274 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000275libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000276 @for i in $(SCRIPTDIR) $(LIBDEST); \
277 do \
278 if test ! -d $$i; then \
279 echo "Creating directory $$i"; \
280 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000281 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000282 else true; \
283 fi; \
284 done
285 @for d in $(LIBSUBDIRS); \
286 do \
287 a=$(srcdir)/Lib/$$d; \
288 if test ! -d $$a; then continue; else true; fi; \
289 b=$(LIBDEST)/$$d; \
290 if test ! -d $$b; then \
291 echo "Creating directory $$b"; \
292 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000293 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000294 else true; \
295 fi; \
296 done
297 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
298 do \
299 if test -x $$i; then \
300 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
301 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
302 else \
303 $(INSTALL_DATA) $$i $(LIBDEST); \
304 echo $(INSTALL_DATA) $$i $(LIBDEST); \
305 fi; \
306 done
307 @for d in $(LIBSUBDIRS); \
308 do \
309 a=$(srcdir)/Lib/$$d; \
310 if test ! -d $$a; then continue; else true; fi; \
311 b=$(LIBDEST)/$$d; \
312 for i in $$a/*; \
313 do \
314 case $$i in \
315 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000316 *.py[co]) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000317 *~) ;; \
318 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000319 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000320 if test -x $$i; then \
321 echo $(INSTALL_PROGRAM) $$i $$b; \
322 $(INSTALL_PROGRAM) $$i $$b; \
323 else \
324 echo $(INSTALL_DATA) $$i $$b; \
325 $(INSTALL_DATA) $$i $$b; \
326 fi;; \
327 esac; \
328 done; \
329 done
330 PYTHONPATH=$(LIBDEST) \
Fred Drake4b0200e2000-07-04 04:15:53 +0000331 ./python$(EXE) -tt $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000332 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000333 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000334
Guido van Rossum86b7db31997-10-06 00:15:31 +0000335# Create the PLATDIR source directory, if one wasn't distributed..
336$(srcdir)/Lib/$(PLATDIR):
337 mkdir $(srcdir)/Lib/$(PLATDIR)
338 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000339 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000340 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000341 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000342
Guido van Rossum586480b1996-05-28 22:49:08 +0000343# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000344INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000345inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000346 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000347 do \
348 if test ! -d $$i; then \
349 echo "Creating directory $$i"; \
350 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000351 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000352 else true; \
353 fi; \
354 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000355 @for i in $(srcdir)/Include/*.h; \
356 do \
357 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
358 $(INSTALL_DATA) $$i $(INCLUDEPY); \
359 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000360 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000361
Guido van Rossum914fbd91997-07-19 19:38:43 +0000362# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000363# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000364LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000366 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000367 do \
368 if test ! -d $$i; then \
369 echo "Creating directory $$i"; \
370 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000371 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000372 else true; \
373 fi; \
374 done
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000375 @if [ "$(MACHDEP)" != "beos" ] ; then \
376 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
377 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
378 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000379 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000380 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000381 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
382 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
383 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000384 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Barry Warsaw6de72132000-06-30 16:04:18 +0000385 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Guido van Rossum70a86591996-07-21 02:46:47 +0000386 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000387 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000388 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000389 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000390 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000391 echo; echo "Installing support files for building shared extension modules on AIX:"; \
392 $(INSTALL_DATA) Modules/python.exp \
393 $(LIBPL)/python.exp; \
394 echo; echo "$(LIBPL)/python.exp"; \
395 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
396 $(LIBPL)/makexp_aix; \
397 echo "$(LIBPL)/makexp_aix"; \
398 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
399 $(LIBPL)/ld_so_aix; \
400 echo "$(LIBPL)/ld_so_aix"; \
401 echo; echo "See Misc/AIX-NOTES for details."; \
402 else true; \
403 fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000404
Guido van Rossum586480b1996-05-28 22:49:08 +0000405# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000406# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000407sharedinstall:
408 cd Modules; $(MAKE) \
409 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000410 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000411 SO="$(SO)" \
412 LDSHARED="$(LDSHARED)" \
413 CCSHARED="$(CCSHARED)" \
414 LINKFORSHARED="$(LINKFORSHARED)" \
415 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000416 prefix="$(prefix)" \
417 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000418 sharedinstall
419
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000420# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000421Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000422 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000423 @for i in . $(SUBDIRS); do \
424 (echo making Makefile in subdirectory $$i; cd $$i; \
425 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000426 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000427 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000428
Guido van Rossumd09119e1995-01-17 16:45:08 +0000429# Build the intermediate Makefile in Modules
430Modules/Makefile.pre: config.status
431 $(SHELL) config.status
432
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000433# Build the toplevel Makefile
434Makefile: Makefile.in config.status
435 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
436
437# Run the configure script. If config.status already exists,
438# call it with the --recheck argument, which reruns configure with the
439# same options as it was run last time; otherwise run the configure
440# script with options taken from the $(WITH) variable
441config.status: $(srcdir)/configure
442 if test -f config.status; \
443 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000444 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000445 else $(SHELL) $(srcdir)/configure $(WITH); \
446 fi
447
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000448.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449
450# Rerun configure with the same options as it was run last time,
451# provided the config.status script exists
452recheck:
453 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000454 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000455
456# Rebuild the configure script from configure.in; also rebuild config.h.in
457autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000458 (cd $(srcdir); autoconf)
459 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000460
461# Create a tags file for vi
462tags::
463 ctags -w -t Include/*.h
464 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
465 sort tags -o tags
466
467# Create a tags file for GNU Emacs
468TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000469 etags Include/*.h
470 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000471
472# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000473depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000474 @for i in $(SUBDIRS); do \
475 (echo making depend in subdirectory $$i; cd $$i; \
476 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000477 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000478
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000479# Sanitation targets -- clean leaves libraries, executables and tags
480# files, which clobber removes those as well
481
Guido van Rossum627b2d71993-12-24 10:39:16 +0000482localclean:
483 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000484
485clean: localclean
486 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000487 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000488 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000489 if test -f Makefile; \
490 then $(MAKE) clean; \
491 else $(MAKE) -f Makefile.*in clean; \
492 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000493 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000494 done
495
Guido van Rossum810a92f1993-12-28 19:39:56 +0000496localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000497 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000498 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000499
500clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000501 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000502 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000503 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000504 if test -f Makefile; \
505 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000506 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000507 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000508 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000509 done
510
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000511# Make things extra clean, before making a distribution:
512# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000513distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000514 -$(MAKE) -f $(srcdir)/Makefile.in \
515 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000516 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000517 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000518 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000519 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
520 for f in $$i/*.in; do \
521 f=`basename "$$f" .in`; \
522 if test "$$f" != "*"; then \
523 echo rm -f "$$i/$$f"; \
524 rm -f "$$i/$$f"; \
525 fi; \
526 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000527 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000528
Guido van Rossum586480b1996-05-28 22:49:08 +0000529# Check for smelly exported symbols (not starting with Py/_Py)
530smelly: all
531 for i in $(SUBDIRS); do \
532 echo --- $$i ---; \
533 nm -p $$i/lib$$i.a | \
534 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
535 done
536
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000537# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000538funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000539 find $(DISTDIRS) -type d \
540 -o -name '*.[chs]' \
541 -o -name '*.py' \
542 -o -name '*.doc' \
543 -o -name '*.sty' \
544 -o -name '*.bib' \
545 -o -name '*.dat' \
546 -o -name '*.el' \
547 -o -name '*.fd' \
548 -o -name '*.in' \
549 -o -name '*.tex' \
550 -o -name '*,[vpt]' \
551 -o -name 'Setup' \
552 -o -name 'Setup.*' \
553 -o -name README \
554 -o -name Makefile \
555 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000556 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000557 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000558 -o -name Entries \
559 -o -name Tag \
560 -o -name tags \
561 -o -name TAGS \
562 -o -name .cvsignore \
563 -o -name MANIFEST \
564 -o -print