blob: 8d4b96f80941b455d137fa5daa0662c4314e4f14 [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
Guido van Rossumb73172f2000-08-29 15:00:11 +0000106# install process. Default to user-only-writable for all file types.
107DIRMODE= 755
Guido van Rossum6cedf821997-12-02 17:52:37 +0000108EXEMODE= 755
109FILEMODE= 644
110
Guido van Rossum586480b1996-05-28 22:49:08 +0000111# Portable install script (configure doesn't always guess right)
112INSTALL= @srcdir@/install-sh -c
Guido van Rossum6cedf821997-12-02 17:52:37 +0000113INSTALL_PROGRAM=${INSTALL} -m $(EXEMODE)
114INSTALL_DATA= ${INSTALL} -m $(FILEMODE)
Guido van Rossum586480b1996-05-28 22:49:08 +0000115
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000116# Use this to make a link between python$(VERSION) and python in $(BINDIR)
117LN=@LN@
118
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000119# --with-PACKAGE options for configure script
120# e.g. --with-readline --with-svr5 --with-solaris --with-thread
121# (see README for an explanation)
122WITH=
123
124# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000125OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000126
127# Subdirectories where to run make recursively
Thomas Wouters65469832000-08-11 22:26:35 +0000128SUBDIRS= Parser Grammar Objects Python Modules
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000129
130# Other subdirectories
Thomas Wouters65469832000-08-11 22:26:35 +0000131SUBDIRSTOO= Include Lib Misc Demo
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000132
133# Files and directories to be distributed
134CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
135DISTFILES= README ChangeLog $(CONFIGFILES)
136DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
137DIST= $(DISTFILES) $(DISTDIRS)
138
Guido van Rossum1eec5281997-07-25 22:34:08 +0000139# Compilation flags for getbuildinfo.c only
140CFLAGS= $(OPT) -I. $(DEFS)
141
Guido van Rossum914fbd91997-07-19 19:38:43 +0000142LIBRARY= libpython$(VERSION).a
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000143LDLIBRARY= @LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000144
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000145# Default target
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000146all: $(LIBRARY) python$(EXE) sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000147
148# Build the interpreter
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000149python$(EXE): $(LIBRARY) buildno Modules/python.o
Guido van Rossum86c052e1997-08-20 22:13:15 +0000150 expr `cat buildno` + 1 >buildno1
151 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000152 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
153 $(srcdir)/Modules/getbuildinfo.c
154 $(AR) cr $(LIBRARY) getbuildinfo.o
155 $(RANLIB) $(LIBRARY)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000156 @MAKE_LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000157 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
158 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000159 LIBRARY=../$(LDLIBRARY) link
Guido van Rossum914fbd91997-07-19 19:38:43 +0000160
Guido van Rossum370a0831998-10-01 16:42:41 +0000161Modules/python.o: $(srcdir)/Modules/python.c
162 cd Modules; $(MAKE) OPT="$(OPT)" python.o
163
Guido van Rossum1eec5281997-07-25 22:34:08 +0000164buildno:
165 echo 0 >buildno
166
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000167# Build the shared modules
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000168sharedmods: python$(EXE)
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000169 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
170 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
171 sharedmods
172
Guido van Rossum914fbd91997-07-19 19:38:43 +0000173# Build the library
174$(LIBRARY): $(SUBDIRS)
175 if test ! -f $(LIBRARY); \
176 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
177 else true; fi
178 for i in $(SUBDIRS); do \
179 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000180
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000181# This rule is only here for DG/UX!!!
182libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000183 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
184 *dgux*) \
185 test -d dgux || mkdir dgux; \
186 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
187 /bin/rm -rf ./dgux \
188 ;; \
189 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
Guido van Rossumbcb393f1999-11-16 15:58:32 +0000221test: all
Guido van Rossumcf809d61997-10-20 23:16:32 +0000222 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000223 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
224 PYTHONPATH= $(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 Rossum3912fd81996-07-24 02:35:43 +0000257
Guido van Rossum586480b1996-05-28 22:49:08 +0000258# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000259maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000260 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000261 do \
262 if test ! -d $$i; then \
263 echo "Creating directory $$i"; \
264 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000265 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000266 else true; \
267 fi; \
268 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000269 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000270 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000271
Guido van Rossumb535da31996-07-30 18:04:22 +0000272# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000273PLATDIR= plat-$(MACHDEP)
274MACHDEPS= $(PLATDIR)
Fred Drake4247ba62000-06-30 15:46:08 +0000275XMLLIBSUBDIRS= xml xml/dom xml/parser xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000276LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000277 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000278libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000279 @for i in $(SCRIPTDIR) $(LIBDEST); \
280 do \
281 if test ! -d $$i; then \
282 echo "Creating directory $$i"; \
283 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000284 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000285 else true; \
286 fi; \
287 done
288 @for d in $(LIBSUBDIRS); \
289 do \
290 a=$(srcdir)/Lib/$$d; \
291 if test ! -d $$a; then continue; else true; fi; \
292 b=$(LIBDEST)/$$d; \
293 if test ! -d $$b; then \
294 echo "Creating directory $$b"; \
295 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000296 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000297 else true; \
298 fi; \
299 done
300 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
301 do \
302 if test -x $$i; then \
303 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
304 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
305 else \
306 $(INSTALL_DATA) $$i $(LIBDEST); \
307 echo $(INSTALL_DATA) $$i $(LIBDEST); \
308 fi; \
309 done
310 @for d in $(LIBSUBDIRS); \
311 do \
312 a=$(srcdir)/Lib/$$d; \
313 if test ! -d $$a; then continue; else true; fi; \
314 b=$(LIBDEST)/$$d; \
315 for i in $$a/*; \
316 do \
317 case $$i in \
318 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000319 *.py[co]) ;; \
Guido van Rossumb73172f2000-08-29 15:00:11 +0000320 *.orig) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000321 *~) ;; \
322 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000323 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000324 if test -x $$i; then \
325 echo $(INSTALL_PROGRAM) $$i $$b; \
326 $(INSTALL_PROGRAM) $$i $$b; \
327 else \
328 echo $(INSTALL_DATA) $$i $$b; \
329 $(INSTALL_DATA) $$i $$b; \
330 fi;; \
331 esac; \
332 done; \
333 done
334 PYTHONPATH=$(LIBDEST) \
Fred Drake4b0200e2000-07-04 04:15:53 +0000335 ./python$(EXE) -tt $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000336 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000337 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000338
Guido van Rossum86b7db31997-10-06 00:15:31 +0000339# Create the PLATDIR source directory, if one wasn't distributed..
340$(srcdir)/Lib/$(PLATDIR):
341 mkdir $(srcdir)/Lib/$(PLATDIR)
342 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000343 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000344 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000345 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000346
Guido van Rossum586480b1996-05-28 22:49:08 +0000347# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000348INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000349inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000350 @for i in $(INCLDIRSTOMAKE); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000351 do \
352 if test ! -d $$i; then \
353 echo "Creating directory $$i"; \
354 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000355 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000356 else true; \
357 fi; \
358 done
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000359 @for i in $(srcdir)/Include/*.h; \
360 do \
361 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
362 $(INSTALL_DATA) $$i $(INCLUDEPY); \
363 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000364 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365
Guido van Rossum914fbd91997-07-19 19:38:43 +0000366# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000367# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000368LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000369libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000370 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000371 do \
372 if test ! -d $$i; then \
373 echo "Creating directory $$i"; \
374 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000375 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000376 else true; \
377 fi; \
378 done
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000379 @if [ "$(MACHDEP)" != "beos" ] ; then \
380 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
381 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
382 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000383 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000384 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000385 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
386 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
387 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000388 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Barry Warsaw6de72132000-06-30 16:04:18 +0000389 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Guido van Rossum70a86591996-07-21 02:46:47 +0000390 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000391 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000392 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000393 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000394 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000395 echo; echo "Installing support files for building shared extension modules on AIX:"; \
396 $(INSTALL_DATA) Modules/python.exp \
397 $(LIBPL)/python.exp; \
398 echo; echo "$(LIBPL)/python.exp"; \
399 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
400 $(LIBPL)/makexp_aix; \
401 echo "$(LIBPL)/makexp_aix"; \
402 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
403 $(LIBPL)/ld_so_aix; \
404 echo "$(LIBPL)/ld_so_aix"; \
405 echo; echo "See Misc/AIX-NOTES for details."; \
406 else true; \
407 fi
Fred Draked3b1f112000-08-31 22:02:46 +0000408 @if [ "$(MACHDEP)" = "beos" ] ; then \
Fred Drakeb0b7e312000-08-24 18:11:21 +0000409 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
410 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
411 echo; echo "$(LIBPL)/README"; \
412 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
413 echo "$(LIBPL)/README.readline-2.2"; \
414 $(INSTALL_DATA) BeOS/dl_export.h $(LIBPL)/dl_export.h; \
415 echo "$(LIBPL)/dl_export.h"; \
416 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
417 echo "$(LIBPL)/ar-fake"; \
418 $(INSTALL_PROGRAM) BeOS/linkcc $(LIBPL)/linkcc; \
419 echo "$(LIBPL)/linkcc"; \
420 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
421 echo "$(LIBPL)/linkmodule"; \
422 echo; echo "See BeOS/README for details."; \
423 else true; \
424 fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000425
Guido van Rossum586480b1996-05-28 22:49:08 +0000426# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000427# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000428sharedinstall:
429 cd Modules; $(MAKE) \
430 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000431 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000432 SO="$(SO)" \
433 LDSHARED="$(LDSHARED)" \
434 CCSHARED="$(CCSHARED)" \
435 LINKFORSHARED="$(LINKFORSHARED)" \
436 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000437 prefix="$(prefix)" \
438 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000439 sharedinstall
440
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000441# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000442Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000443 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000444 @for i in . $(SUBDIRS); do \
445 (echo making Makefile in subdirectory $$i; cd $$i; \
446 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000447 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000448 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449
Guido van Rossumd09119e1995-01-17 16:45:08 +0000450# Build the intermediate Makefile in Modules
451Modules/Makefile.pre: config.status
452 $(SHELL) config.status
453
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000454# Build the toplevel Makefile
455Makefile: Makefile.in config.status
456 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
457
458# Run the configure script. If config.status already exists,
459# call it with the --recheck argument, which reruns configure with the
460# same options as it was run last time; otherwise run the configure
461# script with options taken from the $(WITH) variable
462config.status: $(srcdir)/configure
463 if test -f config.status; \
464 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000465 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000466 else $(SHELL) $(srcdir)/configure $(WITH); \
467 fi
468
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000469.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000470
471# Rerun configure with the same options as it was run last time,
472# provided the config.status script exists
473recheck:
474 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000475 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000476
477# Rebuild the configure script from configure.in; also rebuild config.h.in
478autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000479 (cd $(srcdir); autoconf)
480 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000481
482# Create a tags file for vi
483tags::
Guido van Rossum251caa52000-07-31 18:26:35 +0000484 cd $(srcdir); \
485 ctags -w -t Include/*.h; \
486 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; \
487 done; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000488 sort tags -o tags
489
490# Create a tags file for GNU Emacs
491TAGS::
Guido van Rossum251caa52000-07-31 18:26:35 +0000492 cd $(srcdir); \
493 etags Include/*.h; \
Guido van Rossum5552eb71994-08-05 15:51:00 +0000494 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000495
496# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000497depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000498 @for i in $(SUBDIRS); do \
499 (echo making depend in subdirectory $$i; cd $$i; \
500 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000501 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000502
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000503# Sanitation targets -- clean leaves libraries, executables and tags
504# files, which clobber removes those as well
505
Guido van Rossum627b2d71993-12-24 10:39:16 +0000506localclean:
507 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000508
509clean: localclean
510 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000511 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000512 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000513 if test -f Makefile; \
514 then $(MAKE) clean; \
515 else $(MAKE) -f Makefile.*in clean; \
516 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000517 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000518 done
519
Guido van Rossum810a92f1993-12-28 19:39:56 +0000520localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000521 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000522 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000523
524clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000525 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000526 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000527 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000528 if test -f Makefile; \
529 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000530 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000531 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000532 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000533 done
534
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000535# Make things extra clean, before making a distribution:
536# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000537distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000538 -$(MAKE) -f $(srcdir)/Makefile.in \
539 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000540 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000541 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000542 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000543 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
544 for f in $$i/*.in; do \
545 f=`basename "$$f" .in`; \
546 if test "$$f" != "*"; then \
547 echo rm -f "$$i/$$f"; \
548 rm -f "$$i/$$f"; \
549 fi; \
550 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000551 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000552
Guido van Rossum586480b1996-05-28 22:49:08 +0000553# Check for smelly exported symbols (not starting with Py/_Py)
554smelly: all
555 for i in $(SUBDIRS); do \
556 echo --- $$i ---; \
557 nm -p $$i/lib$$i.a | \
558 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
559 done
560
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000561# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000562funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000563 find $(DISTDIRS) -type d \
564 -o -name '*.[chs]' \
565 -o -name '*.py' \
566 -o -name '*.doc' \
567 -o -name '*.sty' \
568 -o -name '*.bib' \
569 -o -name '*.dat' \
570 -o -name '*.el' \
571 -o -name '*.fd' \
572 -o -name '*.in' \
573 -o -name '*.tex' \
574 -o -name '*,[vpt]' \
575 -o -name 'Setup' \
576 -o -name 'Setup.*' \
577 -o -name README \
578 -o -name Makefile \
579 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000580 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000581 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000582 -o -name Entries \
583 -o -name Tag \
584 -o -name tags \
585 -o -name TAGS \
586 -o -name .cvsignore \
587 -o -name MANIFEST \
588 -o -print
Fred Drakeb0b7e312000-08-24 18:11:21 +0000589# IF YOU PUT ANYTHING HERE IT WILL GO AWAY