blob: ca8d26645f786923668944707e9d2f66c5e3e24f [file] [log] [blame]
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001########################################################################
2# Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
3# Amsterdam, The Netherlands.
4#
5# All Rights Reserved
6#
7# Permission to use, copy, modify, and distribute this software and its
8# documentation for any purpose and without fee is hereby granted,
9# provided that the above copyright notice appear in all copies and that
10# both that copyright notice and this permission notice appear in
11# supporting documentation, and that the names of Stichting Mathematisch
12# Centrum or CWI not be used in advertising or publicity pertaining to
13# distribution of the software without specific, written prior permission.
14#
15# STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17# FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22########################################################################
Guido van Rossum627b2d71993-12-24 10:39:16 +000023
Guido van Rossum433c8ad1994-08-01 12:07:07 +000024# Toplevel Makefile for Python
25# Note -- if recursive makes fail, try adding MAKE=make
Guido van Rossum627b2d71993-12-24 10:39:16 +000026
Guido van Rossum433c8ad1994-08-01 12:07:07 +000027# Substitutions by configure
28srcdir= @srcdir@
29VPATH= @srcdir@
30INSTALL= @INSTALL@
31
32# Install prefixes are treated specially by the configure script:
33# it only changes these lines if it has received a --prefix=... or
34# --exec-prefix-... command line option, or if it has figured out
35# a value by searching for python in $PATH. Note that $(prefix) is
36# also used when compiling config.c in Modules to set the default
37# module search path, so if you change it later be sure to change it
38# there too and rebuild.
39
40# Install prefix for architecture-independent files
41prefix= /usr/local
42
43# Install prefix for architecture-dependent files
44exec_prefix= $(prefix)
45
46# Programs
47SHELL= /bin/sh
48
49# --with-PACKAGE options for configure script
50# e.g. --with-readline --with-svr5 --with-solaris --with-thread
51# (see README for an explanation)
52WITH=
53
54# Compiler options passed to subordinate makes
55OPT= -O
56
57# Subdirectories where to run make recursively
58SUBDIRS= Parser Objects Python Modules
59
60# Other subdirectories
61SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar
62
63# Files and directories to be distributed
64CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
65DISTFILES= README ChangeLog $(CONFIGFILES)
66DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
67DIST= $(DISTFILES) $(DISTDIRS)
68
69# Default target
70all: python
71
72# Build the interpreter
73python: Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +000074 for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +000075 (echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \
Guido van Rossum810a92f1993-12-28 19:39:56 +000076 done
77
Guido van Rossum433c8ad1994-08-01 12:07:07 +000078# Test the interpreter (twice, once without .pyc files, once with)
79TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test
80test: python
81 -rm -f $(srcdir)/Lib/test/*.pyc
82 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
83 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
Guido van Rossum810a92f1993-12-28 19:39:56 +000084
Guido van Rossum433c8ad1994-08-01 12:07:07 +000085# Install the interpreter
86install: python
87 $(INSTALL) python $(exec_prefix)/bin/python
88 @echo If this is your first time, consider make libinstall...
Guido van Rossum810a92f1993-12-28 19:39:56 +000089
Guido van Rossum433c8ad1994-08-01 12:07:07 +000090# Install the library.
91# If your system does not support "cp -r", try "copy -r" or perhaps
92# something like find Lib -print | cpio -pacvdmu $(DESTDIR)/lib/python
93libinstall:
94 -if test ! -d $(prefix)/lib/python; \
95 then mkdir $(prefix)/lib/python; \
96 fi
97 cp -r $(srcdir)/Lib/* $(prefix)/lib/python
98 @echo Ideally, run something to compile all modules now...
99
100# install the manual page
101maninstall:
102 $(INSTALL) $(srcdir)/Misc/python.man \
103 $(prefix)/man/man1/python.1
104
105# install the include files
106INCLUDEPY= $(prefix)/include/Py
107inclinstall:
108 -if test ! -d $(INCLUDEPY); \
109 then mkdir $(INCLUDEPY); \
110 fi
111 cp $(srcdir)/Include/*.h $(INCLUDEPY)
112
113# install the lib*.a files and miscellaneous stuff needed by extensions
114LIBP= $(exec_prefix)/lib/python
115LIBPL= $(LIBP)/lib
116libainstall: all
117 -if test ! -d $(LIBP); \
118 then mkdir $(LIBP); \
119 fi
120 -if test ! -d $(LIBPL); \
121 then mkdir $(LIBPL); \
122 fi
123 for i in $(SUBDIRS); do \
124 echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
125 done
126 $(INSTALL) Modules/config.c $(LIBPL)/config.c
127 $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
128 $(INSTALL) Modules/Makefile $(LIBPL)/Makefile
129 $(INSTALL) Modules/Setup $(LIBPL)/Setup
130 $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
131 $(INSTALL) config.h $(LIBPL)/config.h
132 $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
133
134# Build the sub-Makefiles
135Makefiles: config.status
136 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
137 for i in . $(SUBDIRS); do \
138 (echo $$i; cd $$i; $(MAKE) Makefile); \
139 done
140
141# Build the toplevel Makefile
142Makefile: Makefile.in config.status
143 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
144
145# Run the configure script. If config.status already exists,
146# call it with the --recheck argument, which reruns configure with the
147# same options as it was run last time; otherwise run the configure
148# script with options taken from the $(WITH) variable
149config.status: $(srcdir)/configure
150 if test -f config.status; \
151 then $(SHELL) config.status --recheck; \
152 else $(SHELL) $(srcdir)/configure $(WITH); \
153 fi
154
155.PRECIOUS: config.status python
156
157# Rerun configure with the same options as it was run last time,
158# provided the config.status script exists
159recheck:
160 $(SHELL) config.status --recheck
161
162# Rebuild the configure script from configure.in; also rebuild config.h.in
163autoconf:
164 (cd $(srcdir); autoconf; autoheader)
165
166# Create a tags file for vi
167tags::
168 ctags -w -t Include/*.h
169 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
170 sort tags -o tags
171
172# Create a tags file for GNU Emacs
173TAGS::
174 etags -t Include/*.h
175 for i in $(SUBDIRS); do etags -t -a $$i/*.[ch]; done
176
177# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000178depend:
179 for i in $(SUBDIRS); do \
180 (echo $$i; cd $$i; $(MAKE) depend); \
181 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000182
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000183# Sanitation targets -- clean leaves libraries, executables and tags
184# files, which clobber removes those as well
185
Guido van Rossum627b2d71993-12-24 10:39:16 +0000186localclean:
187 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000188
189clean: localclean
190 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000191 (echo $$i; cd $$i; \
192 if test -f Makefile; \
193 then $(MAKE) clean; \
194 else $(MAKE) -f Makefile.*in clean; \
195 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000196 done
197
Guido van Rossum810a92f1993-12-28 19:39:56 +0000198localclobber: localclean
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000199 -rm -f tags TAGS python
Guido van Rossum810a92f1993-12-28 19:39:56 +0000200
201clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000202 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000203 (echo $$i; cd $$i; \
204 if test -f Makefile; \
205 then $(MAKE) clobber; \
206 else $(MAKE) -f Makefile.in clobber; \
207 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000208 done
209
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000210# Make things extra clean, before making a distribution
Guido van Rossum627b2d71993-12-24 10:39:16 +0000211distclean: clobber
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000212 -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber
213 -rm -f config.status config.h Makefile
214 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
215 for f in $$i/*.in; do \
216 f=`basename "$$f" .in`; \
217 if test "$$f" != "*"; then \
218 echo rm -f "$$i/$$f"; \
219 rm -f "$$i/$$f"; \
220 fi; \
221 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000222 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000223
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000224# Find files with funny names
225find:
226 find $(DISTDIRS) -type d \
227 -o -name '*.[chs]' \
228 -o -name '*.py' \
229 -o -name '*.doc' \
230 -o -name '*.sty' \
231 -o -name '*.bib' \
232 -o -name '*.dat' \
233 -o -name '*.el' \
234 -o -name '*.fd' \
235 -o -name '*.in' \
236 -o -name '*.tex' \
237 -o -name '*,[vpt]' \
238 -o -name 'Setup' \
239 -o -name 'Setup.*' \
240 -o -name README \
241 -o -name Makefile \
242 -o -name ChangeLog \
243 -o -name RCS \
244 -o -name Repository \
245 -o -name Entries \
246 -o -name Tag \
247 -o -name tags \
248 -o -name TAGS \
249 -o -name .cvsignore \
250 -o -name MANIFEST \
251 -o -print
Guido van Rossum627b2d71993-12-24 10:39:16 +0000252
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000253# Build a distribution tar file (run make distclean first)
254# (This leaves the RCS and CVS directories in :-( )
255tar:
Guido van Rossum6085e321993-12-26 18:24:40 +0000256 tar cf - $(DIST) | compress >dist.tar.Z