1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
########################################################################
# Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
# The Netherlands.
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the names of Stichting Mathematisch
# Centrum or CWI not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior permission.
#
# STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
########################################################################
# Toplevel Makefile for Python
# Note -- if recursive makes fail, try adding MAKE=make
# Substitutions by configure
srcdir= @srcdir@
VPATH= @srcdir@
INSTALL= @INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA= @INSTALL_DATA@
RANLIB= @RANLIB@
# Machine-dependent subdirectories
MACHDEP= @MACHDEP@
# Install prefix for architecture-independent files
prefix= @prefix@
# Install prefix for architecture-dependent files
exec_prefix= @exec_prefix@
# Expanded directories
MANDIR=$(prefix)/man
BINDIR=$(exec_prefix)/bin
LIBDIR=$(exec_prefix)/lib
INCLUDEDIR=$(prefix)/include
SCRIPTDIR=$(prefix)/lib
# Symbols used for using shared libraries
SO= @SO@
LDSHARED= @LDSHARED@
CCSHARED= @CCSHARED@
LINKFORSHARED= @LINKFORSHARED@
DESTSHARED= $(SCRIPTDIR)/python/$(MACHDEP)
# Programs
SHELL= /bin/sh
# --with-PACKAGE options for configure script
# e.g. --with-readline --with-svr5 --with-solaris --with-thread
# (see README for an explanation)
WITH=
# Compiler options passed to subordinate makes
OPT= @OPT@
# Subdirectories where to run make recursively
SUBDIRS= Parser Objects Python Modules
# Other subdirectories
SUBDIRSTOO= Include Lib Doc Misc Demo readline Grammar
# Files and directories to be distributed
CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.in
DISTFILES= README ChangeLog $(CONFIGFILES)
DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
DIST= $(DISTFILES) $(DISTDIRS)
# Default target
all: python
# Build the interpreter
python: Makefiles
for i in $(SUBDIRS); do \
(echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \
done
# Test the interpreter (twice, once without .pyc files, once with)
TESTPATH= $(srcdir)/Lib:$(srcdir)/Lib/test:./Modules
test: python
-rm -f $(srcdir)/Lib/test/*.pyc
PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
# Install the interpreter
install: python
$(INSTALL_PROGRAM) python $(BINDIR)/python
@echo If this is your first time, consider make libinstall...
# Install the library.
# If your system does not support "cp -r", try "copy -r" or perhaps
# something like find Lib -print | cpio -pacvdmu $(LIBDEST)
LIBDEST= $(SCRIPTDIR)/python
libinstall:
-if test ! -d $(LIBDEST); \
then mkdir $(LIBDEST); \
fi
cp -r $(srcdir)/Lib/* $(LIBDEST)
PYTHONPATH=$(LIBDEST) \
./python $(LIBDEST)/compileall.py $(LIBDEST)
$(MAKE) sharedinstall
# install the manual page
maninstall:
$(INSTALL_DATA) $(srcdir)/Misc/python.man \
$(MANDIR)/man1/python.1
# install the include files
INCLUDEPY= $(INCLUDEDIR)/Py
inclinstall:
-if test ! -d $(INCLUDEPY); \
then mkdir $(INCLUDEPY); \
fi
$(INSTALL_DATA) $(srcdir)/Include/*.h $(INCLUDEPY)
# install the lib*.a files and miscellaneous stuff needed by extensions
LIBP= $(LIBDIR)/python
LIBPL= $(LIBP)/lib
libainstall: all
-if test ! -d $(LIBP); \
then mkdir $(LIBP); \
fi
-if test ! -d $(LIBPL); \
then mkdir $(LIBPL); \
fi
for i in $(SUBDIRS); do \
echo $$i; $(INSTALL_DATA) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
$(RANLIB) $(LIBPL)/lib$$i.a; \
done
$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
$(INSTALL_DATA) Modules/Makefile $(LIBPL)/Makefile
$(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
$(INSTALL_DATA) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
$(INSTALL_DATA) config.h $(LIBPL)/config.h
$(INSTALL_DATA) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
# install the dynamically loadable modules
sharedinstall:
cd Modules; $(MAKE) \
OPT="$(OPT)" \
SO="$(SO)" \
LDSHARED="$(LDSHARED)" \
CCSHARED="$(CCSHARED)" \
LINKFORSHARED="$(LINKFORSHARED)" \
DESTSHARED="$(DESTSHARED)" \
sharedinstall
# Build the sub-Makefiles
Makefiles: config.status Modules/Makefile.pre
(cd Modules; $(MAKE) -f Makefile.pre Makefile)
for i in . $(SUBDIRS); do \
(echo $$i; cd $$i; $(MAKE) Makefile); \
done
# Build the intermediate Makefile in Modules
Modules/Makefile.pre: config.status
$(SHELL) config.status
# Build the toplevel Makefile
Makefile: Makefile.in config.status
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
# Run the configure script. If config.status already exists,
# call it with the --recheck argument, which reruns configure with the
# same options as it was run last time; otherwise run the configure
# script with options taken from the $(WITH) variable
config.status: $(srcdir)/configure
if test -f config.status; \
then $(SHELL) config.status --recheck; \
$(SHELL) config.status; \
else $(SHELL) $(srcdir)/configure $(WITH); \
fi
.PRECIOUS: config.status python
# Rerun configure with the same options as it was run last time,
# provided the config.status script exists
recheck:
$(SHELL) config.status --recheck
$(SHELL) config.status
# Rebuild the configure script from configure.in; also rebuild config.h.in
autoconf:
(cd $(srcdir); autoconf; autoheader)
# Create a tags file for vi
tags::
ctags -w -t Include/*.h
for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
sort tags -o tags
# Create a tags file for GNU Emacs
TAGS::
etags Include/*.h
for i in $(SUBDIRS); do etags -a $$i/*.[ch]; done
# Add dependencies to sub-Makefiles
depend:
for i in $(SUBDIRS); do \
(echo $$i; cd $$i; $(MAKE) depend); \
done
# Sanitation targets -- clean leaves libraries, executables and tags
# files, which clobber removes those as well
localclean:
-rm -f core *~ [@,#]* *.old *.orig *.rej
clean: localclean
-for i in $(SUBDIRS); do \
(echo $$i; cd $$i; \
if test -f Makefile; \
then $(MAKE) clean; \
else $(MAKE) -f Makefile.*in clean; \
fi); \
done
localclobber: localclean
-rm -f tags TAGS python
-rm -f config.log config.cache config.h Makefile
clobber: localclobber
-for i in $(SUBDIRS); do \
(echo $$i; cd $$i; \
if test -f Makefile; \
then $(MAKE) clobber; \
else $(MAKE) -f $(srcdir)/Makefile.in clobber; \
fi); \
done
# Make things extra clean, before making a distribution
distclean: clobber
-$(MAKE) -f $(srcdir)/Makefile.in \
SUBDIRS="$(SUBDIRSTOO)" clobber
-rm -f config.status config.log config.cache config.h Makefile
-for i in $(SUBDIRS) $(SUBDIRSTOO); do \
for f in $$i/*.in; do \
f=`basename "$$f" .in`; \
if test "$$f" != "*"; then \
echo rm -f "$$i/$$f"; \
rm -f "$$i/$$f"; \
fi; \
done; \
done
# Find files with funny names
find:
find $(DISTDIRS) -type d \
-o -name '*.[chs]' \
-o -name '*.py' \
-o -name '*.doc' \
-o -name '*.sty' \
-o -name '*.bib' \
-o -name '*.dat' \
-o -name '*.el' \
-o -name '*.fd' \
-o -name '*.in' \
-o -name '*.tex' \
-o -name '*,[vpt]' \
-o -name 'Setup' \
-o -name 'Setup.*' \
-o -name README \
-o -name Makefile \
-o -name ChangeLog \
-o -name RCS \
-o -name Repository \
-o -name Entries \
-o -name Tag \
-o -name tags \
-o -name TAGS \
-o -name .cvsignore \
-o -name MANIFEST \
-o -print
# Build a distribution tar file (run make distclean first)
# (This leaves the RCS and CVS directories in :-( )
tar:
tar cf - $(DIST) | gzip --best >dist.tar.gz
|