blob: 41dbacb1243c4753fed934a5f5e4bb73c073b0c1 [file] [log] [blame]
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001########################################################################
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002# Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3# The Netherlands.
4#
Guido van Rossum433c8ad1994-08-01 12:07:07 +00005# All Rights Reserved
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00006#
7# Permission to use, copy, modify, and distribute this software and its
8# documentation for any purpose and without fee is hereby granted,
Guido van Rossum433c8ad1994-08-01 12:07:07 +00009# provided that the above copyright notice appear in all copies and that
Guido van Rossumaf5b83e1995-01-04 19:02:35 +000010# both that copyright notice and this permission notice appear in
Guido van Rossum433c8ad1994-08-01 12:07:07 +000011# supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012# Centrum or CWI or Corporation for National Research Initiatives or
13# CNRI not be used in advertising or publicity pertaining to
14# distribution of the software without specific, written prior
15# permission.
16#
17# While CWI is the initial source for this software, a modified version
18# is made available by the Corporation for National Research Initiatives
19# (CNRI) at the Internet address ftp://ftp.python.org.
20#
21# STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24# CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28# PERFORMANCE OF THIS SOFTWARE.
Guido van Rossum433c8ad1994-08-01 12:07:07 +000029########################################################################
Guido van Rossum627b2d71993-12-24 10:39:16 +000030
Guido van Rossum586480b1996-05-28 22:49:08 +000031# Top-level Makefile for Python
32#
33# As distributed, this file is called Makefile.in; it is processed
34# into the real Makefile by running the script ./configure, which
35# replaces things like @spam@ with values appropriate for your system.
36# This means that if you edit Makefile, your changes get lost the next
37# time you run the configure script. Ideally, you can do:
38#
39# ./configure
40# make
41# make test
42# make install
43#
44# The top-level Makefile invokes make recursively in a number of
45# subdirectories (see the SUBDIRS variable below). If you want to,
46# you can invoke make in individual subdirectories. However, the
47# sub-Makefiles are also generated by configure, and the quickest way
48# to make sure they are up to date is by running make (or "make
49# Makefiles") at the top level. This is particularly important for
50# Modules/Makefile, which has to be regenerated every time you edit
51# Modules/Setup. The python executable is built in the Modules
52# directory and then moved to the top-level directory. The recursive
53# makes pass three options to subordinate makes: OPT (a quick way to
Guido van Rossumb535da31996-07-30 18:04:22 +000054# change some compiler options; it usually defaults to -O), prefix and
Guido van Rossum586480b1996-05-28 22:49:08 +000055# exec_prefix (the installation paths).
56#
Guido van Rossumb535da31996-07-30 18:04:22 +000057# If you have a previous version of Python installed that you don't
58# want to overwrite, you can use "make altinstall" instead of "make
59# install". This changes the install procedure so it installs the
60# Python binary as "python<version>". The libraries and include files
61# are always installed in a subdirectory called "python<version>".
62# "make altinstall" does not install the manual page. If you want to
63# make this installation the "official" installation but want to keep
64# the old binary around "just in case", rename the installed python
65# binary to "python<oldversion>" before running "make install".
66# (This only works between different versions, e.g. 1.3 and 1.4 --
67# different betas of the same version will overwrite each other in
68# installation unless you override the VERSION Make variable.)
69#
Guido van Rossum64b65671996-07-30 20:42:12 +000070# In fact, "make install" or "make bininstall" installs the binary
71# as python<version> and makes a hard link to python, so when
72# installing a new version in the future, nothing of the current
73# version will be lost (except for the man page).
74#
Guido van Rossum586480b1996-05-28 22:49:08 +000075# If recursive makes fail, try invoking make as "make MAKE=make".
76#
77# See also the section "Build instructions" in the README file.
Guido van Rossum627b2d71993-12-24 10:39:16 +000078
Guido van Rossum433c8ad1994-08-01 12:07:07 +000079# Substitutions by configure
Guido van Rossum914fbd91997-07-19 19:38:43 +000080VERSION= @VERSION@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000081srcdir= @srcdir@
82VPATH= @srcdir@
Guido van Rossum1eec5281997-07-25 22:34:08 +000083CC= @CC@
Guido van Rossum5aadaf51997-08-19 14:40:11 +000084AR= @AR@
Guido van Rossum4a91df41994-10-10 17:58:27 +000085RANLIB= @RANLIB@
Guido van Rossum1eec5281997-07-25 22:34:08 +000086DEFS= @DEFS@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000087
Guido van Rossumac405f61994-09-12 10:56:06 +000088# Machine-dependent subdirectories
89MACHDEP= @MACHDEP@
90
Guido van Rossum433c8ad1994-08-01 12:07:07 +000091# Install prefix for architecture-independent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000092prefix= @prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000093
94# Install prefix for architecture-dependent files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000095exec_prefix= @exec_prefix@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000096
Guido van Rossum90412791994-10-20 22:04:30 +000097# Expanded directories
Guido van Rossumb535da31996-07-30 18:04:22 +000098BINDIR= $(exec_prefix)/bin
99LIBDIR= $(exec_prefix)/lib
100MANDIR= $(prefix)/man
101INCLUDEDIR= $(prefix)/include
Guido van Rossumabffd001997-09-11 14:37:59 +0000102CONFINCLUDEDIR= $(exec_prefix)/include
Guido van Rossumb535da31996-07-30 18:04:22 +0000103SCRIPTDIR= $(prefix)/lib
Guido van Rossum90412791994-10-20 22:04:30 +0000104
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000105# Detailed destination directories
106BINLIBDEST= $(LIBDIR)/python$(VERSION)
107LIBDEST= $(SCRIPTDIR)/python$(VERSION)
108INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
Guido van Rossumabffd001997-09-11 14:37:59 +0000109CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
Guido van Rossumbed23fe1996-07-31 17:30:37 +0000110LIBP= $(LIBDIR)/python$(VERSION)
111
Guido van Rossumac405f61994-09-12 10:56:06 +0000112# Symbols used for using shared libraries
113SO= @SO@
114LDSHARED= @LDSHARED@
115CCSHARED= @CCSHARED@
116LINKFORSHARED= @LINKFORSHARED@
Guido van Rossumcf809d61997-10-20 23:16:32 +0000117DESTSHARED= $(BINLIBDEST)/lib-dynload
Guido van Rossumac405f61994-09-12 10:56:06 +0000118
Guido van Rossum586480b1996-05-28 22:49:08 +0000119# Shell used by make (some versions default to the login shell, which is bad)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000120SHELL= /bin/sh
121
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000122# Use ``EXE=.exe'' for Unix emulations on DOS/Windows (e.g. GNUWIN32)
123EXE=
124
Guido van Rossum6cedf821997-12-02 17:52:37 +0000125# Modes for directories, executables and data files created by the
126# install process. Default to group-writable directories but
127# user-only-writable for executables and data files.
128DIRMODE= 775
129EXEMODE= 755
130FILEMODE= 644
131
Guido van Rossum586480b1996-05-28 22:49:08 +0000132# Portable install script (configure doesn't always guess right)
133INSTALL= @srcdir@/install-sh -c
Guido van Rossum6cedf821997-12-02 17:52:37 +0000134INSTALL_PROGRAM=${INSTALL} -m $(EXEMODE)
135INSTALL_DATA= ${INSTALL} -m $(FILEMODE)
Guido van Rossum586480b1996-05-28 22:49:08 +0000136
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000137# Use this to make a link between python$(VERSION) and python in $(BINDIR)
138LN=@LN@
139
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000140# --with-PACKAGE options for configure script
141# e.g. --with-readline --with-svr5 --with-solaris --with-thread
142# (see README for an explanation)
143WITH=
144
145# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +0000146OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000147
148# Subdirectories where to run make recursively
149SUBDIRS= Parser Objects Python Modules
150
151# Other subdirectories
Guido van Rossum15527e91998-05-19 21:15:03 +0000152SUBDIRSTOO= Include Lib Misc Demo Grammar
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000153
154# Files and directories to be distributed
155CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
156DISTFILES= README ChangeLog $(CONFIGFILES)
157DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
158DIST= $(DISTFILES) $(DISTDIRS)
159
Guido van Rossum1eec5281997-07-25 22:34:08 +0000160# Compilation flags for getbuildinfo.c only
161CFLAGS= $(OPT) -I. $(DEFS)
162
Guido van Rossum914fbd91997-07-19 19:38:43 +0000163LIBRARY= libpython$(VERSION).a
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000164LDLIBRARY= @LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000165
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000166# Default target
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000167all: $(LIBRARY) python$(EXE) sharedmods
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000168
169# Build the interpreter
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000170python$(EXE): $(LIBRARY) buildno Modules/python.o
Guido van Rossum86c052e1997-08-20 22:13:15 +0000171 expr `cat buildno` + 1 >buildno1
172 mv -f buildno1 buildno
Guido van Rossum1eec5281997-07-25 22:34:08 +0000173 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
174 $(srcdir)/Modules/getbuildinfo.c
175 $(AR) cr $(LIBRARY) getbuildinfo.o
176 $(RANLIB) $(LIBRARY)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000177 @MAKE_LDLIBRARY@
Guido van Rossum914fbd91997-07-19 19:38:43 +0000178 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
179 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000180 LIBRARY=../$(LDLIBRARY) link
Guido van Rossum914fbd91997-07-19 19:38:43 +0000181
Guido van Rossum370a0831998-10-01 16:42:41 +0000182Modules/python.o: $(srcdir)/Modules/python.c
183 cd Modules; $(MAKE) OPT="$(OPT)" python.o
184
Guido van Rossum1eec5281997-07-25 22:34:08 +0000185buildno:
186 echo 0 >buildno
187
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000188# Build the shared modules
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000189sharedmods: python$(EXE)
Guido van Rossum506ef9e1997-08-18 14:22:24 +0000190 cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
191 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
192 sharedmods
193
Guido van Rossum914fbd91997-07-19 19:38:43 +0000194# Build the library
195$(LIBRARY): $(SUBDIRS)
196 if test ! -f $(LIBRARY); \
197 then for i in $(SUBDIRS); do rm -f $$i/add2lib; done; true; \
198 else true; fi
199 for i in $(SUBDIRS); do \
200 (cd $$i; $(MAKE) VERSION="$(VERSION)" add2lib); done
Guido van Rossum4246edd1997-04-23 15:14:24 +0000201
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000202# This rule is only here for DG/UX!!!
203libpython$(VERSION).so: $(LIBRARY)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000204 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
205 *dgux*) \
206 test -d dgux || mkdir dgux; \
207 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
208 /bin/rm -rf ./dgux \
209 ;; \
210 esac
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000211
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000212# This rule is here for OPENSTEP/Rhapsody/MacOSX
213libpython$(VERSION).dylib: $(LIBRARY)
214 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
215
Guido van Rossum4246edd1997-04-23 15:14:24 +0000216$(SUBDIRS): Makefiles
217
218Parser:
219 cd Parser ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
220 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
221
222Python:
223 cd Python ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
224 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
225
226Objects:
227 cd Objects ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
228 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
229
Guido van Rossum914fbd91997-07-19 19:38:43 +0000230Modules: Parser Python Objects
Guido van Rossum4246edd1997-04-23 15:14:24 +0000231 cd Modules ; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
232 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
Guido van Rossum810a92f1993-12-28 19:39:56 +0000233
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000234# Test the interpreter (twice, once without .pyc files, once with)
Barry Warsaw9121ab91997-01-02 20:01:44 +0000235TESTOPTS=
Guido van Rossum042a0511997-01-03 15:54:36 +0000236TESTPROG= $(srcdir)/Lib/test/regrtest.py
Fred Drake9abc25e2000-02-10 17:23:44 +0000237TESTPYTHON= ./python$(EXE) -tt
Guido van Rossumbcb393f1999-11-16 15:58:32 +0000238test: all
Guido van Rossumcf809d61997-10-20 23:16:32 +0000239 -rm -f $(srcdir)/Lib/test/*.py[co]
Barry Warsawdd82bb91997-08-29 21:52:14 +0000240 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
241 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Guido van Rossum810a92f1993-12-28 19:39:56 +0000242
Guido van Rossum586480b1996-05-28 22:49:08 +0000243# Install everything
Guido van Rossum6d472981996-07-30 21:41:56 +0000244install: altinstall bininstall maninstall
Guido van Rossum586480b1996-05-28 22:49:08 +0000245
Guido van Rossum64b65671996-07-30 20:42:12 +0000246# Install almost everything without disturbing previous versions
Guido van Rossumb535da31996-07-30 18:04:22 +0000247altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
Guido van Rossum3912fd81996-07-24 02:35:43 +0000248
Guido van Rossum64b65671996-07-30 20:42:12 +0000249# Install the interpreter (by creating a hard link to python$(VERSION))
250bininstall: altbininstall
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000251 -if test -f $(BINDIR)/python$(EXE); \
252 then rm -f $(BINDIR)/python$(EXE); \
Guido van Rossum64b65671996-07-30 20:42:12 +0000253 else true; \
254 fi
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000255 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) python$(EXE))
Guido van Rossum810a92f1993-12-28 19:39:56 +0000256
Guido van Rossum3912fd81996-07-24 02:35:43 +0000257# Install the interpreter with $(VERSION) affixed
Guido van Rossum64b65671996-07-30 20:42:12 +0000258# This goes into $(exec_prefix)
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000259altbininstall: python$(EXE)
Guido van Rossum3912fd81996-07-24 02:35:43 +0000260 @for i in $(BINDIR); \
261 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 Rossum3912fd81996-07-24 02:35:43 +0000266 else true; \
267 fi; \
268 done
Guido van Rossumc9fd6001997-11-11 18:29:22 +0000269 $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
Guido van Rossum8b0d95f1997-12-19 23:02:22 +0000270 if test -f libpython$(VERSION).so; then \
271 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
272 else true; \
273 fi
Guido van Rossum3912fd81996-07-24 02:35:43 +0000274
Guido van Rossum586480b1996-05-28 22:49:08 +0000275# Install the manual page
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000276maninstall:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000277 @for i in $(MANDIR) $(MANDIR)/man1; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000278 do \
279 if test ! -d $$i; then \
280 echo "Creating directory $$i"; \
281 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000282 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000283 else true; \
284 fi; \
285 done
Guido van Rossum6403d281995-01-20 16:51:32 +0000286 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
Guido van Rossum90412791994-10-20 22:04:30 +0000287 $(MANDIR)/man1/python.1
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000288
Guido van Rossumb535da31996-07-30 18:04:22 +0000289# Install the library
Guido van Rossum86b7db31997-10-06 00:15:31 +0000290PLATDIR= plat-$(MACHDEP)
291MACHDEPS= $(PLATDIR)
Fred Drake4247ba62000-06-30 15:46:08 +0000292XMLLIBSUBDIRS= xml xml/dom xml/parser xml/sax
Guido van Rossum0f7bd3c2000-04-24 14:57:21 +0000293LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
Fred Drake4247ba62000-06-30 15:46:08 +0000294 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Guido van Rossum86b7db31997-10-06 00:15:31 +0000295libinstall: python $(srcdir)/Lib/$(PLATDIR)
Guido van Rossumb535da31996-07-30 18:04:22 +0000296 @for i in $(SCRIPTDIR) $(LIBDEST); \
297 do \
298 if test ! -d $$i; then \
299 echo "Creating directory $$i"; \
300 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000301 chmod $(DIRMODE) $$i; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000302 else true; \
303 fi; \
304 done
305 @for d in $(LIBSUBDIRS); \
306 do \
307 a=$(srcdir)/Lib/$$d; \
308 if test ! -d $$a; then continue; else true; fi; \
309 b=$(LIBDEST)/$$d; \
310 if test ! -d $$b; then \
311 echo "Creating directory $$b"; \
312 mkdir $$b; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000313 chmod $(DIRMODE) $$b; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000314 else true; \
315 fi; \
316 done
317 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
318 do \
319 if test -x $$i; then \
320 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
321 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
322 else \
323 $(INSTALL_DATA) $$i $(LIBDEST); \
324 echo $(INSTALL_DATA) $$i $(LIBDEST); \
325 fi; \
326 done
327 @for d in $(LIBSUBDIRS); \
328 do \
329 a=$(srcdir)/Lib/$$d; \
330 if test ! -d $$a; then continue; else true; fi; \
331 b=$(LIBDEST)/$$d; \
332 for i in $$a/*; \
333 do \
334 case $$i in \
335 *CVS) ;; \
Guido van Rossumcf809d61997-10-20 23:16:32 +0000336 *.py[co]) ;; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000337 *~) ;; \
338 *) \
Guido van Rossum8e29a591997-12-02 19:18:27 +0000339 if test -d $$i; then continue; fi; \
Guido van Rossumb535da31996-07-30 18:04:22 +0000340 if test -x $$i; then \
341 echo $(INSTALL_PROGRAM) $$i $$b; \
342 $(INSTALL_PROGRAM) $$i $$b; \
343 else \
344 echo $(INSTALL_DATA) $$i $$b; \
345 $(INSTALL_DATA) $$i $$b; \
346 fi;; \
347 esac; \
348 done; \
349 done
350 PYTHONPATH=$(LIBDEST) \
Fred Drake9abc25e2000-02-10 17:23:44 +0000351 ./python$(EXE) -t $(LIBDEST)/compileall.py $(LIBDEST)
Fred Drakedb5a41f1997-03-13 14:14:29 +0000352 PYTHONPATH=$(LIBDEST) \
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000353 ./python$(EXE) -O $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossumb535da31996-07-30 18:04:22 +0000354
Guido van Rossum86b7db31997-10-06 00:15:31 +0000355# Create the PLATDIR source directory, if one wasn't distributed..
356$(srcdir)/Lib/$(PLATDIR):
357 mkdir $(srcdir)/Lib/$(PLATDIR)
358 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
Guido van Rossum04831d11996-09-10 18:21:32 +0000359 export PATH; PATH="`pwd`:$$PATH"; \
Guido van Rossumf71bd681996-08-28 19:23:01 +0000360 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Guido van Rossum86b7db31997-10-06 00:15:31 +0000361 cd $(srcdir)/Lib/$(PLATDIR); ./regen
Guido van Rossum64b65671996-07-30 20:42:12 +0000362
Guido van Rossum586480b1996-05-28 22:49:08 +0000363# Install the include files
Guido van Rossumabffd001997-09-11 14:37:59 +0000364INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365inclinstall:
Guido van Rossumabffd001997-09-11 14:37:59 +0000366 @for i in $(INCLDIRSTOMAKE); \
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 Rossumbfc1bbe1996-06-20 14:30:38 +0000375 @for i in $(srcdir)/Include/*.h; \
376 do \
377 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
378 $(INSTALL_DATA) $$i $(INCLUDEPY); \
379 done
Guido van Rossumabffd001997-09-11 14:37:59 +0000380 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000381
Guido van Rossum914fbd91997-07-19 19:38:43 +0000382# Install the library and miscellaneous stuff needed for extending/embedding
Guido van Rossum64b65671996-07-30 20:42:12 +0000383# This goes into $(exec_prefix)
Guido van Rossumb535da31996-07-30 18:04:22 +0000384LIBPL= $(LIBP)/config
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000385libainstall: all
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000386 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
Guido van Rossum586480b1996-05-28 22:49:08 +0000387 do \
388 if test ! -d $$i; then \
389 echo "Creating directory $$i"; \
390 mkdir $$i; \
Guido van Rossum6cedf821997-12-02 17:52:37 +0000391 chmod $(DIRMODE) $$i; \
Guido van Rossum586480b1996-05-28 22:49:08 +0000392 else true; \
393 fi; \
394 done
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000395 @if [ "$(MACHDEP)" != "beos" ] ; then \
396 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
397 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
398 fi
Guido van Rossum6403d281995-01-20 16:51:32 +0000399 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Guido van Rossum895e1051997-07-19 22:53:39 +0000400 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
Guido van Rossum6403d281995-01-20 16:51:32 +0000401 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
402 $(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
403 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
Guido van Rossumded2e201997-07-19 22:00:45 +0000404 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
Fred Drakefc5d8b11997-12-09 15:18:33 +0000405 $(INSTALL_DATA) Modules/Setup.thread $(LIBPL)/Setup.thread
Guido van Rossum70a86591996-07-21 02:46:47 +0000406 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
Guido van Rossumd99d7141997-10-04 04:35:24 +0000407 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
Guido van Rossume475d861997-10-29 19:07:30 +0000408 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
Guido van Rossum69f65801998-03-03 21:47:00 +0000409 @if [ -s Modules/python.exp -a \
Guido van Rossuma58153e1998-05-05 20:40:18 +0000410 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
Guido van Rossum69f65801998-03-03 21:47:00 +0000411 echo; echo "Installing support files for building shared extension modules on AIX:"; \
412 $(INSTALL_DATA) Modules/python.exp \
413 $(LIBPL)/python.exp; \
414 echo; echo "$(LIBPL)/python.exp"; \
415 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
416 $(LIBPL)/makexp_aix; \
417 echo "$(LIBPL)/makexp_aix"; \
418 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
419 $(LIBPL)/ld_so_aix; \
420 echo "$(LIBPL)/ld_so_aix"; \
421 echo; echo "See Misc/AIX-NOTES for details."; \
422 else true; \
423 fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000424
Guido van Rossum586480b1996-05-28 22:49:08 +0000425# Install the dynamically loadable modules
Guido van Rossum64b65671996-07-30 20:42:12 +0000426# This goes into $(exec_prefix)
Guido van Rossumac405f61994-09-12 10:56:06 +0000427sharedinstall:
428 cd Modules; $(MAKE) \
429 OPT="$(OPT)" \
Guido van Rossumb535da31996-07-30 18:04:22 +0000430 VERSION="$(VERSION)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000431 SO="$(SO)" \
432 LDSHARED="$(LDSHARED)" \
433 CCSHARED="$(CCSHARED)" \
434 LINKFORSHARED="$(LINKFORSHARED)" \
435 DESTSHARED="$(DESTSHARED)" \
Guido van Rossum3912fd81996-07-24 02:35:43 +0000436 prefix="$(prefix)" \
437 exec_prefix="$(exec_prefix)" \
Guido van Rossumac405f61994-09-12 10:56:06 +0000438 sharedinstall
439
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000440# Build the sub-Makefiles
Guido van Rossumd09119e1995-01-17 16:45:08 +0000441Makefiles: config.status Modules/Makefile.pre
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000442 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000443 @for i in . $(SUBDIRS); do \
444 (echo making Makefile in subdirectory $$i; cd $$i; \
445 $(MAKE) Makefile); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000446 done
Guido van Rossum2a570041998-10-07 22:51:56 +0000447 -(rm -f Modules/hassignal; cd Modules; $(MAKE) hassignal)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000448
Guido van Rossumd09119e1995-01-17 16:45:08 +0000449# Build the intermediate Makefile in Modules
450Modules/Makefile.pre: config.status
451 $(SHELL) config.status
452
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000453# Build the toplevel Makefile
454Makefile: Makefile.in config.status
455 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
456
457# Run the configure script. If config.status already exists,
458# call it with the --recheck argument, which reruns configure with the
459# same options as it was run last time; otherwise run the configure
460# script with options taken from the $(WITH) variable
461config.status: $(srcdir)/configure
462 if test -f config.status; \
463 then $(SHELL) config.status --recheck; \
Guido van Rossumfb00a991995-01-12 12:26:50 +0000464 $(SHELL) config.status; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000465 else $(SHELL) $(srcdir)/configure $(WITH); \
466 fi
467
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000468.PRECIOUS: config.status python$(EXE)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000469
470# Rerun configure with the same options as it was run last time,
471# provided the config.status script exists
472recheck:
473 $(SHELL) config.status --recheck
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000474 $(SHELL) config.status
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000475
476# Rebuild the configure script from configure.in; also rebuild config.h.in
477autoconf:
Guido van Rossum00682671996-06-28 20:15:41 +0000478 (cd $(srcdir); autoconf)
479 (cd $(srcdir); autoheader)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000480
481# Create a tags file for vi
482tags::
483 ctags -w -t Include/*.h
484 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
485 sort tags -o tags
486
487# Create a tags file for GNU Emacs
488TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000489 etags Include/*.h
490 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000491
492# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000493depend:
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000494 @for i in $(SUBDIRS); do \
495 (echo making depend in subdirectory $$i; cd $$i; \
496 $(MAKE) depend); \
Guido van Rossum810a92f1993-12-28 19:39:56 +0000497 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000498
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000499# Sanitation targets -- clean leaves libraries, executables and tags
500# files, which clobber removes those as well
501
Guido van Rossum627b2d71993-12-24 10:39:16 +0000502localclean:
503 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000504
505clean: localclean
506 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000507 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000508 (echo making clean in subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000509 if test -f Makefile; \
510 then $(MAKE) clean; \
511 else $(MAKE) -f Makefile.*in clean; \
512 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000513 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000514 done
515
Guido van Rossum810a92f1993-12-28 19:39:56 +0000516localclobber: localclean
Guido van Rossum717d1fd1999-02-23 15:43:15 +0000517 -rm -f tags TAGS python$(EXE) $(LIBRARY) $(LDLIBRARY) *.o
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000518 -rm -f config.log config.cache config.h
Guido van Rossum810a92f1993-12-28 19:39:56 +0000519
520clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000521 -for i in $(SUBDIRS); do \
Guido van Rossum15527e91998-05-19 21:15:03 +0000522 if test -d $$i; then \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000523 (echo clobbering subdirectory $$i; cd $$i; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000524 if test -f Makefile; \
525 then $(MAKE) clobber; \
Guido van Rossum15527e91998-05-19 21:15:03 +0000526 else $(MAKE) -f $(srcdir)/Makefile*.in clobber; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000527 fi); \
Guido van Rossum15527e91998-05-19 21:15:03 +0000528 else true; fi; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000529 done
530
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000531# Make things extra clean, before making a distribution:
532# remove all generated files, even Makefile[.pre]
Guido van Rossum627b2d71993-12-24 10:39:16 +0000533distclean: clobber
Guido van Rossum7b4d4601995-03-22 12:27:16 +0000534 -$(MAKE) -f $(srcdir)/Makefile.in \
535 SUBDIRS="$(SUBDIRSTOO)" clobber
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000536 -rm -f config.status config.log config.cache config.h Makefile
Guido van Rossumcf0be041997-08-29 18:42:35 +0000537 -rm -f buildno
Guido van Rossume7abf4e1995-09-18 22:12:20 +0000538 -rm -f Modules/Makefile
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000539 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
540 for f in $$i/*.in; do \
541 f=`basename "$$f" .in`; \
542 if test "$$f" != "*"; then \
543 echo rm -f "$$i/$$f"; \
544 rm -f "$$i/$$f"; \
545 fi; \
546 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000547 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000548
Guido van Rossum586480b1996-05-28 22:49:08 +0000549# Check for smelly exported symbols (not starting with Py/_Py)
550smelly: all
551 for i in $(SUBDIRS); do \
552 echo --- $$i ---; \
553 nm -p $$i/lib$$i.a | \
554 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
555 done
556
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000557# Find files with funny names
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000558funny:
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000559 find $(DISTDIRS) -type d \
560 -o -name '*.[chs]' \
561 -o -name '*.py' \
562 -o -name '*.doc' \
563 -o -name '*.sty' \
564 -o -name '*.bib' \
565 -o -name '*.dat' \
566 -o -name '*.el' \
567 -o -name '*.fd' \
568 -o -name '*.in' \
569 -o -name '*.tex' \
570 -o -name '*,[vpt]' \
571 -o -name 'Setup' \
572 -o -name 'Setup.*' \
573 -o -name README \
574 -o -name Makefile \
575 -o -name ChangeLog \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000576 -o -name Repository \
Guido van Rossumbfc1bbe1996-06-20 14:30:38 +0000577 -o -name Root \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000578 -o -name Entries \
579 -o -name Tag \
580 -o -name tags \
581 -o -name TAGS \
582 -o -name .cvsignore \
583 -o -name MANIFEST \
584 -o -print