blob: 1fe5701fe337164ea2fd6e627734890404a79063 [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
Guido van Rossuma0e9a771994-08-12 13:18:25 +000034# --exec-prefix=... command line option. Note that $(prefix) is
Guido van Rossum433c8ad1994-08-01 12:07:07 +000035# also used when compiling config.c in Modules to set the default
36# module search path, so if you change it later be sure to change it
37# there too and rebuild.
38
39# Install prefix for architecture-independent files
40prefix= /usr/local
41
42# Install prefix for architecture-dependent files
43exec_prefix= $(prefix)
44
45# Programs
46SHELL= /bin/sh
47
48# --with-PACKAGE options for configure script
49# e.g. --with-readline --with-svr5 --with-solaris --with-thread
50# (see README for an explanation)
51WITH=
52
53# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +000054OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000055
56# Subdirectories where to run make recursively
57SUBDIRS= Parser Objects Python Modules
58
59# Other subdirectories
60SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar
61
62# Files and directories to be distributed
63CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
64DISTFILES= README ChangeLog $(CONFIGFILES)
65DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
66DIST= $(DISTFILES) $(DISTDIRS)
67
68# Default target
69all: python
70
71# Build the interpreter
72python: Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +000073 for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +000074 (echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \
Guido van Rossum810a92f1993-12-28 19:39:56 +000075 done
76
Guido van Rossum433c8ad1994-08-01 12:07:07 +000077# Test the interpreter (twice, once without .pyc files, once with)
78TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test
79test: python
80 -rm -f $(srcdir)/Lib/test/*.pyc
81 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
82 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
Guido van Rossum810a92f1993-12-28 19:39:56 +000083
Guido van Rossum433c8ad1994-08-01 12:07:07 +000084# Install the interpreter
85install: python
86 $(INSTALL) python $(exec_prefix)/bin/python
87 @echo If this is your first time, consider make libinstall...
Guido van Rossum810a92f1993-12-28 19:39:56 +000088
Guido van Rossum433c8ad1994-08-01 12:07:07 +000089# Install the library.
90# If your system does not support "cp -r", try "copy -r" or perhaps
Guido van Rossum7522f031994-08-30 12:42:01 +000091# something like find Lib -print | cpio -pacvdmu $(LIBDEST)
92LIBDEST= $(prefix)/lib/python
Guido van Rossum433c8ad1994-08-01 12:07:07 +000093libinstall:
Guido van Rossum7522f031994-08-30 12:42:01 +000094 -if test ! -d $(LIBDEST); \
95 then mkdir $(LIBDEST); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +000096 fi
Guido van Rossum7522f031994-08-30 12:42:01 +000097 cp -r $(srcdir)/Lib/* $(LIBDEST)
98 PYTHONPATH=$(LIBDEST) \
99 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000100
101# install the manual page
102maninstall:
103 $(INSTALL) $(srcdir)/Misc/python.man \
104 $(prefix)/man/man1/python.1
105
106# install the include files
107INCLUDEPY= $(prefix)/include/Py
108inclinstall:
109 -if test ! -d $(INCLUDEPY); \
110 then mkdir $(INCLUDEPY); \
111 fi
112 cp $(srcdir)/Include/*.h $(INCLUDEPY)
113
114# install the lib*.a files and miscellaneous stuff needed by extensions
115LIBP= $(exec_prefix)/lib/python
116LIBPL= $(LIBP)/lib
117libainstall: all
118 -if test ! -d $(LIBP); \
119 then mkdir $(LIBP); \
120 fi
121 -if test ! -d $(LIBPL); \
122 then mkdir $(LIBPL); \
123 fi
124 for i in $(SUBDIRS); do \
125 echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
126 done
127 $(INSTALL) Modules/config.c $(LIBPL)/config.c
128 $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
129 $(INSTALL) Modules/Makefile $(LIBPL)/Makefile
130 $(INSTALL) Modules/Setup $(LIBPL)/Setup
131 $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
132 $(INSTALL) config.h $(LIBPL)/config.h
133 $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
134
135# Build the sub-Makefiles
136Makefiles: config.status
137 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
138 for i in . $(SUBDIRS); do \
139 (echo $$i; cd $$i; $(MAKE) Makefile); \
140 done
141
142# Build the toplevel Makefile
143Makefile: Makefile.in config.status
144 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
145
146# Run the configure script. If config.status already exists,
147# call it with the --recheck argument, which reruns configure with the
148# same options as it was run last time; otherwise run the configure
149# script with options taken from the $(WITH) variable
150config.status: $(srcdir)/configure
151 if test -f config.status; \
152 then $(SHELL) config.status --recheck; \
153 else $(SHELL) $(srcdir)/configure $(WITH); \
154 fi
155
156.PRECIOUS: config.status python
157
158# Rerun configure with the same options as it was run last time,
159# provided the config.status script exists
160recheck:
161 $(SHELL) config.status --recheck
162
163# Rebuild the configure script from configure.in; also rebuild config.h.in
164autoconf:
165 (cd $(srcdir); autoconf; autoheader)
166
167# Create a tags file for vi
168tags::
169 ctags -w -t Include/*.h
170 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
171 sort tags -o tags
172
173# Create a tags file for GNU Emacs
174TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000175 etags Include/*.h
176 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000177
178# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000179depend:
180 for i in $(SUBDIRS); do \
181 (echo $$i; cd $$i; $(MAKE) depend); \
182 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000183
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000184# Sanitation targets -- clean leaves libraries, executables and tags
185# files, which clobber removes those as well
186
Guido van Rossum627b2d71993-12-24 10:39:16 +0000187localclean:
188 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000189
190clean: localclean
191 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000192 (echo $$i; cd $$i; \
193 if test -f Makefile; \
194 then $(MAKE) clean; \
195 else $(MAKE) -f Makefile.*in clean; \
196 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000197 done
198
Guido van Rossum810a92f1993-12-28 19:39:56 +0000199localclobber: localclean
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000200 -rm -f tags TAGS python
Guido van Rossum810a92f1993-12-28 19:39:56 +0000201
202clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000203 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000204 (echo $$i; cd $$i; \
205 if test -f Makefile; \
206 then $(MAKE) clobber; \
207 else $(MAKE) -f Makefile.in clobber; \
208 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000209 done
210
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000211# Make things extra clean, before making a distribution
Guido van Rossum627b2d71993-12-24 10:39:16 +0000212distclean: clobber
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000213 -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber
214 -rm -f config.status config.h Makefile
215 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
216 for f in $$i/*.in; do \
217 f=`basename "$$f" .in`; \
218 if test "$$f" != "*"; then \
219 echo rm -f "$$i/$$f"; \
220 rm -f "$$i/$$f"; \
221 fi; \
222 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000223 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000224
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000225# Find files with funny names
226find:
227 find $(DISTDIRS) -type d \
228 -o -name '*.[chs]' \
229 -o -name '*.py' \
230 -o -name '*.doc' \
231 -o -name '*.sty' \
232 -o -name '*.bib' \
233 -o -name '*.dat' \
234 -o -name '*.el' \
235 -o -name '*.fd' \
236 -o -name '*.in' \
237 -o -name '*.tex' \
238 -o -name '*,[vpt]' \
239 -o -name 'Setup' \
240 -o -name 'Setup.*' \
241 -o -name README \
242 -o -name Makefile \
243 -o -name ChangeLog \
244 -o -name RCS \
245 -o -name Repository \
246 -o -name Entries \
247 -o -name Tag \
248 -o -name tags \
249 -o -name TAGS \
250 -o -name .cvsignore \
251 -o -name MANIFEST \
252 -o -print
Guido van Rossum627b2d71993-12-24 10:39:16 +0000253
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000254# Build a distribution tar file (run make distclean first)
255# (This leaves the RCS and CVS directories in :-( )
256tar:
Guido van Rossum5552eb71994-08-05 15:51:00 +0000257 tar cf - $(DIST) | gzip --best >dist.tar.gz