blob: a70a5810fd03e0989d9ea21716048fa49eb1483d [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@
Guido van Rossum4a91df41994-10-10 17:58:27 +000031RANLIB= @RANLIB@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000032
Guido van Rossumac405f61994-09-12 10:56:06 +000033# Machine-dependent subdirectories
34MACHDEP= @MACHDEP@
35
Guido van Rossum433c8ad1994-08-01 12:07:07 +000036# Install prefixes are treated specially by the configure script:
37# it only changes these lines if it has received a --prefix=... or
Guido van Rossuma0e9a771994-08-12 13:18:25 +000038# --exec-prefix=... command line option. Note that $(prefix) is
Guido van Rossum433c8ad1994-08-01 12:07:07 +000039# also used when compiling config.c in Modules to set the default
40# module search path, so if you change it later be sure to change it
41# there too and rebuild.
42
43# Install prefix for architecture-independent files
44prefix= /usr/local
45
46# Install prefix for architecture-dependent files
47exec_prefix= $(prefix)
48
Guido van Rossumac405f61994-09-12 10:56:06 +000049# Symbols used for using shared libraries
50SO= @SO@
51LDSHARED= @LDSHARED@
52CCSHARED= @CCSHARED@
53LINKFORSHARED= @LINKFORSHARED@
54DESTSHARED= $(prefix)/lib/python/$(MACHDEP)
55
Guido van Rossum433c8ad1994-08-01 12:07:07 +000056# Programs
57SHELL= /bin/sh
58
59# --with-PACKAGE options for configure script
60# e.g. --with-readline --with-svr5 --with-solaris --with-thread
61# (see README for an explanation)
62WITH=
63
64# Compiler options passed to subordinate makes
Guido van Rossum4e8af441994-08-19 15:33:54 +000065OPT= @OPT@
Guido van Rossum433c8ad1994-08-01 12:07:07 +000066
67# Subdirectories where to run make recursively
68SUBDIRS= Parser Objects Python Modules
69
70# Other subdirectories
71SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar
72
73# Files and directories to be distributed
74CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
75DISTFILES= README ChangeLog $(CONFIGFILES)
76DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
77DIST= $(DISTFILES) $(DISTDIRS)
78
79# Default target
80all: python
81
82# Build the interpreter
83python: Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +000084 for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +000085 (echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \
Guido van Rossum810a92f1993-12-28 19:39:56 +000086 done
87
Guido van Rossum433c8ad1994-08-01 12:07:07 +000088# Test the interpreter (twice, once without .pyc files, once with)
89TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test
90test: python
91 -rm -f $(srcdir)/Lib/test/*.pyc
92 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
93 PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
Guido van Rossum810a92f1993-12-28 19:39:56 +000094
Guido van Rossum433c8ad1994-08-01 12:07:07 +000095# Install the interpreter
96install: python
97 $(INSTALL) python $(exec_prefix)/bin/python
98 @echo If this is your first time, consider make libinstall...
Guido van Rossum810a92f1993-12-28 19:39:56 +000099
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000100# Install the library.
101# If your system does not support "cp -r", try "copy -r" or perhaps
Guido van Rossum7522f031994-08-30 12:42:01 +0000102# something like find Lib -print | cpio -pacvdmu $(LIBDEST)
103LIBDEST= $(prefix)/lib/python
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000104libinstall:
Guido van Rossum7522f031994-08-30 12:42:01 +0000105 -if test ! -d $(LIBDEST); \
106 then mkdir $(LIBDEST); \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000107 fi
Guido van Rossum7522f031994-08-30 12:42:01 +0000108 cp -r $(srcdir)/Lib/* $(LIBDEST)
109 PYTHONPATH=$(LIBDEST) \
110 ./python $(LIBDEST)/compileall.py $(LIBDEST)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000111
112# install the manual page
113maninstall:
114 $(INSTALL) $(srcdir)/Misc/python.man \
115 $(prefix)/man/man1/python.1
116
117# install the include files
118INCLUDEPY= $(prefix)/include/Py
119inclinstall:
120 -if test ! -d $(INCLUDEPY); \
121 then mkdir $(INCLUDEPY); \
122 fi
123 cp $(srcdir)/Include/*.h $(INCLUDEPY)
124
125# install the lib*.a files and miscellaneous stuff needed by extensions
126LIBP= $(exec_prefix)/lib/python
127LIBPL= $(LIBP)/lib
128libainstall: all
129 -if test ! -d $(LIBP); \
130 then mkdir $(LIBP); \
131 fi
132 -if test ! -d $(LIBPL); \
133 then mkdir $(LIBPL); \
134 fi
135 for i in $(SUBDIRS); do \
136 echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
Guido van Rossum4a91df41994-10-10 17:58:27 +0000137 $(RANLIB) $(LIBPL)/lib$$i.a; \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000138 done
139 $(INSTALL) Modules/config.c $(LIBPL)/config.c
140 $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
141 $(INSTALL) Modules/Makefile $(LIBPL)/Makefile
142 $(INSTALL) Modules/Setup $(LIBPL)/Setup
143 $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
144 $(INSTALL) config.h $(LIBPL)/config.h
145 $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
146
Guido van Rossumac405f61994-09-12 10:56:06 +0000147# install the dynamically loadable modules
148sharedinstall:
149 cd Modules; $(MAKE) \
150 OPT="$(OPT)" \
151 SO="$(SO)" \
152 LDSHARED="$(LDSHARED)" \
153 CCSHARED="$(CCSHARED)" \
154 LINKFORSHARED="$(LINKFORSHARED)" \
155 DESTSHARED="$(DESTSHARED)" \
156 sharedinstall
157
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000158# Build the sub-Makefiles
159Makefiles: config.status
160 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
161 for i in . $(SUBDIRS); do \
162 (echo $$i; cd $$i; $(MAKE) Makefile); \
163 done
164
165# Build the toplevel Makefile
166Makefile: Makefile.in config.status
167 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
168
169# Run the configure script. If config.status already exists,
170# call it with the --recheck argument, which reruns configure with the
171# same options as it was run last time; otherwise run the configure
172# script with options taken from the $(WITH) variable
173config.status: $(srcdir)/configure
174 if test -f config.status; \
175 then $(SHELL) config.status --recheck; \
176 else $(SHELL) $(srcdir)/configure $(WITH); \
177 fi
178
179.PRECIOUS: config.status python
180
181# Rerun configure with the same options as it was run last time,
182# provided the config.status script exists
183recheck:
184 $(SHELL) config.status --recheck
185
186# Rebuild the configure script from configure.in; also rebuild config.h.in
187autoconf:
188 (cd $(srcdir); autoconf; autoheader)
189
190# Create a tags file for vi
191tags::
192 ctags -w -t Include/*.h
193 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
194 sort tags -o tags
195
196# Create a tags file for GNU Emacs
197TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000198 etags Include/*.h
199 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000200
201# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000202depend:
203 for i in $(SUBDIRS); do \
204 (echo $$i; cd $$i; $(MAKE) depend); \
205 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000206
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000207# Sanitation targets -- clean leaves libraries, executables and tags
208# files, which clobber removes those as well
209
Guido van Rossum627b2d71993-12-24 10:39:16 +0000210localclean:
211 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000212
213clean: localclean
214 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000215 (echo $$i; cd $$i; \
216 if test -f Makefile; \
217 then $(MAKE) clean; \
218 else $(MAKE) -f Makefile.*in clean; \
219 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000220 done
221
Guido van Rossum810a92f1993-12-28 19:39:56 +0000222localclobber: localclean
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000223 -rm -f tags TAGS python
Guido van Rossum810a92f1993-12-28 19:39:56 +0000224
225clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000226 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000227 (echo $$i; cd $$i; \
228 if test -f Makefile; \
229 then $(MAKE) clobber; \
230 else $(MAKE) -f Makefile.in clobber; \
231 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000232 done
233
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000234# Make things extra clean, before making a distribution
Guido van Rossum627b2d71993-12-24 10:39:16 +0000235distclean: clobber
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000236 -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber
237 -rm -f config.status config.h Makefile
238 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
239 for f in $$i/*.in; do \
240 f=`basename "$$f" .in`; \
241 if test "$$f" != "*"; then \
242 echo rm -f "$$i/$$f"; \
243 rm -f "$$i/$$f"; \
244 fi; \
245 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000246 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000247
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000248# Find files with funny names
249find:
250 find $(DISTDIRS) -type d \
251 -o -name '*.[chs]' \
252 -o -name '*.py' \
253 -o -name '*.doc' \
254 -o -name '*.sty' \
255 -o -name '*.bib' \
256 -o -name '*.dat' \
257 -o -name '*.el' \
258 -o -name '*.fd' \
259 -o -name '*.in' \
260 -o -name '*.tex' \
261 -o -name '*,[vpt]' \
262 -o -name 'Setup' \
263 -o -name 'Setup.*' \
264 -o -name README \
265 -o -name Makefile \
266 -o -name ChangeLog \
267 -o -name RCS \
268 -o -name Repository \
269 -o -name Entries \
270 -o -name Tag \
271 -o -name tags \
272 -o -name TAGS \
273 -o -name .cvsignore \
274 -o -name MANIFEST \
275 -o -print
Guido van Rossum627b2d71993-12-24 10:39:16 +0000276
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000277# Build a distribution tar file (run make distclean first)
278# (This leaves the RCS and CVS directories in :-( )
279tar:
Guido van Rossum5552eb71994-08-05 15:51:00 +0000280 tar cf - $(DIST) | gzip --best >dist.tar.gz