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