blob: 04f7a47fdb2c9a7e11e58b056dde718d3fd44124 [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
91# something like find Lib -print | cpio -pacvdmu $(DESTDIR)/lib/python
92libinstall:
93 -if test ! -d $(prefix)/lib/python; \
94 then mkdir $(prefix)/lib/python; \
95 fi
96 cp -r $(srcdir)/Lib/* $(prefix)/lib/python
97 @echo Ideally, run something to compile all modules now...
98
99# install the manual page
100maninstall:
101 $(INSTALL) $(srcdir)/Misc/python.man \
102 $(prefix)/man/man1/python.1
103
104# install the include files
105INCLUDEPY= $(prefix)/include/Py
106inclinstall:
107 -if test ! -d $(INCLUDEPY); \
108 then mkdir $(INCLUDEPY); \
109 fi
110 cp $(srcdir)/Include/*.h $(INCLUDEPY)
111
112# install the lib*.a files and miscellaneous stuff needed by extensions
113LIBP= $(exec_prefix)/lib/python
114LIBPL= $(LIBP)/lib
115libainstall: all
116 -if test ! -d $(LIBP); \
117 then mkdir $(LIBP); \
118 fi
119 -if test ! -d $(LIBPL); \
120 then mkdir $(LIBPL); \
121 fi
122 for i in $(SUBDIRS); do \
123 echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
124 done
125 $(INSTALL) Modules/config.c $(LIBPL)/config.c
126 $(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
127 $(INSTALL) Modules/Makefile $(LIBPL)/Makefile
128 $(INSTALL) Modules/Setup $(LIBPL)/Setup
129 $(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
130 $(INSTALL) config.h $(LIBPL)/config.h
131 $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
132
133# Build the sub-Makefiles
134Makefiles: config.status
135 (cd Modules; $(MAKE) -f Makefile.pre Makefile)
136 for i in . $(SUBDIRS); do \
137 (echo $$i; cd $$i; $(MAKE) Makefile); \
138 done
139
140# Build the toplevel Makefile
141Makefile: Makefile.in config.status
142 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
143
144# Run the configure script. If config.status already exists,
145# call it with the --recheck argument, which reruns configure with the
146# same options as it was run last time; otherwise run the configure
147# script with options taken from the $(WITH) variable
148config.status: $(srcdir)/configure
149 if test -f config.status; \
150 then $(SHELL) config.status --recheck; \
151 else $(SHELL) $(srcdir)/configure $(WITH); \
152 fi
153
154.PRECIOUS: config.status python
155
156# Rerun configure with the same options as it was run last time,
157# provided the config.status script exists
158recheck:
159 $(SHELL) config.status --recheck
160
161# Rebuild the configure script from configure.in; also rebuild config.h.in
162autoconf:
163 (cd $(srcdir); autoconf; autoheader)
164
165# Create a tags file for vi
166tags::
167 ctags -w -t Include/*.h
168 for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
169 sort tags -o tags
170
171# Create a tags file for GNU Emacs
172TAGS::
Guido van Rossum5552eb71994-08-05 15:51:00 +0000173 etags Include/*.h
174 for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000175
176# Add dependencies to sub-Makefiles
Guido van Rossum810a92f1993-12-28 19:39:56 +0000177depend:
178 for i in $(SUBDIRS); do \
179 (echo $$i; cd $$i; $(MAKE) depend); \
180 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000181
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000182# Sanitation targets -- clean leaves libraries, executables and tags
183# files, which clobber removes those as well
184
Guido van Rossum627b2d71993-12-24 10:39:16 +0000185localclean:
186 -rm -f core *~ [@,#]* *.old *.orig *.rej
Guido van Rossum627b2d71993-12-24 10:39:16 +0000187
188clean: localclean
189 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000190 (echo $$i; cd $$i; \
191 if test -f Makefile; \
192 then $(MAKE) clean; \
193 else $(MAKE) -f Makefile.*in clean; \
194 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000195 done
196
Guido van Rossum810a92f1993-12-28 19:39:56 +0000197localclobber: localclean
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000198 -rm -f tags TAGS python
Guido van Rossum810a92f1993-12-28 19:39:56 +0000199
200clobber: localclobber
Guido van Rossum627b2d71993-12-24 10:39:16 +0000201 -for i in $(SUBDIRS); do \
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000202 (echo $$i; cd $$i; \
203 if test -f Makefile; \
204 then $(MAKE) clobber; \
205 else $(MAKE) -f Makefile.in clobber; \
206 fi); \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000207 done
208
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000209# Make things extra clean, before making a distribution
Guido van Rossum627b2d71993-12-24 10:39:16 +0000210distclean: clobber
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000211 -$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber
212 -rm -f config.status config.h Makefile
213 -for i in $(SUBDIRS) $(SUBDIRSTOO); do \
214 for f in $$i/*.in; do \
215 f=`basename "$$f" .in`; \
216 if test "$$f" != "*"; then \
217 echo rm -f "$$i/$$f"; \
218 rm -f "$$i/$$f"; \
219 fi; \
220 done; \
Guido van Rossum627b2d71993-12-24 10:39:16 +0000221 done
Guido van Rossum627b2d71993-12-24 10:39:16 +0000222
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000223# Find files with funny names
224find:
225 find $(DISTDIRS) -type d \
226 -o -name '*.[chs]' \
227 -o -name '*.py' \
228 -o -name '*.doc' \
229 -o -name '*.sty' \
230 -o -name '*.bib' \
231 -o -name '*.dat' \
232 -o -name '*.el' \
233 -o -name '*.fd' \
234 -o -name '*.in' \
235 -o -name '*.tex' \
236 -o -name '*,[vpt]' \
237 -o -name 'Setup' \
238 -o -name 'Setup.*' \
239 -o -name README \
240 -o -name Makefile \
241 -o -name ChangeLog \
242 -o -name RCS \
243 -o -name Repository \
244 -o -name Entries \
245 -o -name Tag \
246 -o -name tags \
247 -o -name TAGS \
248 -o -name .cvsignore \
249 -o -name MANIFEST \
250 -o -print
Guido van Rossum627b2d71993-12-24 10:39:16 +0000251
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000252# Build a distribution tar file (run make distclean first)
253# (This leaves the RCS and CVS directories in :-( )
254tar:
Guido van Rossum5552eb71994-08-05 15:51:00 +0000255 tar cf - $(DIST) | gzip --best >dist.tar.gz