blob: 8bb3fc629d148b2335c26bc62f77371183522640 [file] [log] [blame]
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001# Top-level Makefile for Python
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00002#
Neil Schemenauer85515ad2001-01-24 17:11:43 +00003# As distributed, this file is called Makefile.pre.in; it is processed
4# into the real Makefile by running the script ./configure, which
5# replaces things like @spam@ with values appropriate for your system.
6# This means that if you edit Makefile, your changes get lost the next
7# time you run the configure script. Ideally, you can do:
Guido van Rossum7cb32ae2001-08-17 15:32:31 +00008#
Neil Schemenauer85515ad2001-01-24 17:11:43 +00009# ./configure
10# make
11# make test
12# make install
Guido van Rossum7cb32ae2001-08-17 15:32:31 +000013#
Neil Schemenauer85515ad2001-01-24 17:11:43 +000014# If you have a previous version of Python installed that you don't
15# want to overwrite, you can use "make altinstall" instead of "make
Neil Schemenauer2b2681a2001-02-16 04:16:34 +000016# install". Refer to the "Installing" section in the README file for
17# additional details.
Guido van Rossum7cb32ae2001-08-17 15:32:31 +000018#
Neil Schemenauer85515ad2001-01-24 17:11:43 +000019# See also the section "Build instructions" in the README file.
20
21# === Variables set by makesetup ===
22
23MODOBJS= _MODOBJS_
24MODLIBS= _MODLIBS_
25
26# === Variables set by configure
27VERSION= @VERSION@
28srcdir= @srcdir@
29VPATH= @srcdir@
30
31CC= @CC@
32CXX= @CXX@
33LINKCC= @LINKCC@
34AR= @AR@
35RANLIB= @RANLIB@
36
37# Shell used by make (some versions default to the login shell, which is bad)
38SHELL= /bin/sh
39
40# Use this to make a link between python$(VERSION) and python in $(BINDIR)
41LN= @LN@
42
43# Portable install script (configure doesn't always guess right)
44INSTALL= @INSTALL@
45INSTALL_PROGRAM=@INSTALL_PROGRAM@
Neil Schemenauer3f5cc202001-04-10 23:03:35 +000046INSTALL_SCRIPT= @INSTALL_SCRIPT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000047INSTALL_DATA= @INSTALL_DATA@
48# Shared libraries must be installed with executable mode on some systems;
49# rather than figuring out exactly which, we always give them executable mode.
50# Also, making them read-only seems to be a good idea...
51INSTALL_SHARED= ${INSTALL} -m 555
52
53MAKESETUP= $(srcdir)/Modules/makesetup
54
55# Compiler options
56OPT= @OPT@
Neil Schemenauer89e90d62001-06-02 06:16:02 +000057CFLAGS= $(OPT)
Guido van Rossumfb0e5452002-07-30 19:06:51 +000058CPPFLAGS= -I. -I$(srcdir)/Include
Neil Schemenauer85515ad2001-01-24 17:11:43 +000059LDFLAGS= @LDFLAGS@
60LDLAST= @LDLAST@
61SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000062CCSHARED= @CCSHARED@
63LINKFORSHARED= @LINKFORSHARED@
64# Extra C flags added for building the interpreter object files.
65CFLAGSFORSHARED=@CFLAGSFORSHARED@
66# C flags used for building the interpreter object files
Mark Hammond8235ea12002-07-19 06:55:41 +000067PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000068
Neil Schemenauer85515ad2001-01-24 17:11:43 +000069
70# Machine-dependent subdirectories
71MACHDEP= @MACHDEP@
72
73# Install prefix for architecture-independent files
74prefix= @prefix@
75
76# Install prefix for architecture-dependent files
77exec_prefix= @exec_prefix@
78
79# Expanded directories
80BINDIR= $(exec_prefix)/bin
81LIBDIR= $(exec_prefix)/lib
Martin v. Löwisd429ab62001-08-02 06:20:20 +000082MANDIR= @mandir@
83INCLUDEDIR= @includedir@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000084CONFINCLUDEDIR= $(exec_prefix)/include
85SCRIPTDIR= $(prefix)/lib
86
87# Detailed destination directories
88BINLIBDEST= $(LIBDIR)/python$(VERSION)
89LIBDEST= $(SCRIPTDIR)/python$(VERSION)
90INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
91CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
92LIBP= $(LIBDIR)/python$(VERSION)
93
94# Symbols used for using shared libraries
95SO= @SO@
96LDSHARED= @LDSHARED@
Neil Schemenauer75e33892001-02-16 03:36:53 +000097BLDSHARED= @BLDSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000098DESTSHARED= $(BINLIBDEST)/lib-dynload
99
100# Executable suffix (.exe on Windows and Mac OS X)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000101EXE= @EXEEXT@
Jack Jansen1999ef42001-12-06 21:47:20 +0000102BUILDEXE= @BUILDEXEEXT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000103
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000104# Short name and location for Mac OS X Python framework
105PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
106PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
107PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
108PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
109
Martin v. Löwis1142de32002-03-29 16:28:31 +0000110# Environment to run shared python without installed libraries
111RUNSHARED= @RUNSHARED@
112
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000113# Modes for directories, executables and data files created by the
114# install process. Default to user-only-writable for all file types.
115DIRMODE= 755
116EXEMODE= 755
117FILEMODE= 644
118
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000119# configure script arguments
120CONFIG_ARGS= @CONFIG_ARGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000121
122
123# Subdirectories with code
124SRCDIRS= @SRCDIRS@
125
126# Other subdirectories
127SUBDIRSTOO= Include Lib Misc Demo
128
129# Files and directories to be distributed
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000130CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000131DISTFILES= README ChangeLog $(CONFIGFILES)
132DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
133DIST= $(DISTFILES) $(DISTDIRS)
134
135
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000136LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000137LDLIBRARY= @LDLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000138BLDLIBRARY= @BLDLIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000139DLLLIBRARY= @DLLLIBRARY@
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000140LDLIBRARYDIR= @LDLIBRARYDIR@
Martin v. Löwis1142de32002-03-29 16:28:31 +0000141INSTSONAME= @INSTSONAME@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000142
143
144LIBS= @LIBS@
145LIBM= @LIBM@
146LIBC= @LIBC@
147SYSLIBS= $(LIBM) $(LIBC)
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000148SHLIBS= @SHLIBS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000149
150MAINOBJ= @MAINOBJ@
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000151THREADOBJ= @THREADOBJ@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000152DLINCLDIR= @DLINCLDIR@
153DYNLOADFILE= @DYNLOADFILE@
Jack Jansenc49e5b72001-06-19 15:00:23 +0000154MACHDEP_OBJS= @MACHDEP_OBJS@
Martin v. Löwis339d0f72001-08-17 18:39:25 +0000155UNICODE_OBJS= @UNICODE_OBJS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000156
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000157PYTHON= python$(EXE)
Jack Jansen1999ef42001-12-06 21:47:20 +0000158BUILDPYTHON= python$(BUILDEXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000159
160# === Definitions added by makesetup ===
161
162
163##########################################################################
164# Modules
165MODULE_OBJS= \
166 Modules/config.o \
167 Modules/getpath.o \
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +0000168 Modules/main.o \
169 Modules/gcmodule.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000170
171# Used of signalmodule.o is not available
172SIGNAL_OBJS= @SIGNAL_OBJS@
173
174
175##########################################################################
176# Grammar
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000177GRAMMAR_H= $(srcdir)/Include/graminit.h
178GRAMMAR_C= $(srcdir)/Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000179GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
180
181
182##########################################################################
183# Parser
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000184PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000185
186POBJS= \
187 Parser/acceler.o \
188 Parser/grammar1.o \
189 Parser/listnode.o \
190 Parser/node.o \
191 Parser/parser.o \
192 Parser/parsetok.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000193 Parser/bitset.o \
194 Parser/metagrammar.o
195
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000196PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000197
198PGOBJS= \
Neil Schemenauerfd1030e2002-04-22 03:05:25 +0000199 Objects/obmalloc.o \
Guido van Rossumf2272522001-12-04 03:54:08 +0000200 Python/mysnprintf.o \
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000201 Parser/tokenizer_pgen.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000202 Parser/firstsets.o \
203 Parser/grammar.o \
204 Parser/pgen.o \
205 Parser/printgrammar.o \
206 Parser/pgenmain.o
207
208PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
209
210
211##########################################################################
212# Python
213PYTHON_OBJS= \
214 Python/bltinmodule.o \
215 Python/exceptions.o \
216 Python/ceval.o \
217 Python/compile.o \
218 Python/codecs.o \
219 Python/errors.o \
220 Python/frozen.o \
221 Python/frozenmain.o \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000222 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000223 Python/getargs.o \
224 Python/getcompiler.o \
225 Python/getcopyright.o \
226 Python/getmtime.o \
227 Python/getplatform.o \
228 Python/getversion.o \
229 Python/graminit.o \
230 Python/import.o \
231 Python/importdl.o \
232 Python/marshal.o \
233 Python/modsupport.o \
234 Python/mystrtoul.o \
Marc-André Lemburge5006eb2001-07-31 13:24:44 +0000235 Python/mysnprintf.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000236 Python/pyfpe.o \
237 Python/pystate.o \
238 Python/pythonrun.o \
239 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000240 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000241 Python/sysmodule.o \
242 Python/traceback.o \
243 Python/getopt.o \
244 Python/$(DYNLOADFILE) \
Jack Jansenc49e5b72001-06-19 15:00:23 +0000245 $(MACHDEP_OBJS) \
Martin v. Löwis2d7e2642002-04-05 16:50:53 +0000246 $(THREADOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000247
248
249##########################################################################
250# Objects
251OBJECT_OBJS= \
252 Objects/abstract.o \
Guido van Rossum77f6a652002-04-03 22:41:51 +0000253 Objects/boolobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000254 Objects/bufferobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000255 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000256 Objects/classobject.o \
257 Objects/cobject.o \
258 Objects/complexobject.o \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000259 Objects/descrobject.o \
Guido van Rossum7dab2422002-04-26 19:40:56 +0000260 Objects/enumobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000261 Objects/fileobject.o \
262 Objects/floatobject.o \
263 Objects/frameobject.o \
264 Objects/funcobject.o \
265 Objects/intobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000266 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000267 Objects/listobject.o \
268 Objects/longobject.o \
269 Objects/dictobject.o \
270 Objects/methodobject.o \
271 Objects/moduleobject.o \
272 Objects/object.o \
Tim Peters1221c0a2002-03-23 00:20:15 +0000273 Objects/obmalloc.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000274 Objects/rangeobject.o \
275 Objects/sliceobject.o \
276 Objects/stringobject.o \
Guido van Rossum98bf58f2001-10-18 20:34:25 +0000277 Objects/structseq.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000278 Objects/tupleobject.o \
279 Objects/typeobject.o \
Fred Drake502ed822001-10-05 21:56:02 +0000280 Objects/weakrefobject.o \
Martin v. Löwis339d0f72001-08-17 18:39:25 +0000281 $(UNICODE_OBJS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000282
283
284##########################################################################
285# objects that get linked into the Python library
286LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000287 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000288 $(PARSER_OBJS) \
289 $(OBJECT_OBJS) \
290 $(PYTHON_OBJS) \
291 $(MODULE_OBJS) \
292 $(SIGNAL_OBJS) \
293 $(MODOBJS)
294
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000295#########################################################################
296# Rules
297
298# Default target
Jack Jansen1999ef42001-12-06 21:47:20 +0000299all: $(BUILDPYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000300
301# Build the interpreter
Martin v. Löwis1142de32002-03-29 16:28:31 +0000302$(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
Fred Drakea1a84e72001-03-06 05:52:16 +0000303 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
304 Modules/$(MAINOBJ) \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000305 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000306
Jack Jansen1999ef42001-12-06 21:47:20 +0000307platform: $(BUILDPYTHON)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000308 $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000309
310
311# Build the shared modules
Jack Jansen1999ef42001-12-06 21:47:20 +0000312sharedmods: $(BUILDPYTHON)
Guido van Rossum1140cb22001-09-12 18:59:25 +0000313 case $$MAKEFLAGS in \
Martin v. Löwis1142de32002-03-29 16:28:31 +0000314 *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
315 *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
Guido van Rossum1140cb22001-09-12 18:59:25 +0000316 esac
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000317
Neil Schemenauer18821822001-01-27 21:42:38 +0000318# buildno should really depend on something like LIBRARY_SRC
319buildno: $(PARSER_OBJS) \
320 $(OBJECT_OBJS) \
321 $(PYTHON_OBJS) \
322 $(MODULE_OBJS) \
323 $(SIGNAL_OBJS) \
324 $(MODOBJS) \
325 $(srcdir)/Modules/getbuildinfo.c
326 if test -f buildno; then \
327 expr `cat buildno` + 1 >buildno1; \
328 mv -f buildno1 buildno; \
329 else echo 1 >buildno; fi
330
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000331# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000332# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000333$(LIBRARY): $(LIBRARY_OBJS)
334 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000335 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000336 $(AR) cr $@ $(PARSER_OBJS)
337 $(AR) cr $@ $(OBJECT_OBJS)
338 $(AR) cr $@ $(PYTHON_OBJS)
339 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
340 $(AR) cr $@ $(MODOBJS)
341 $(RANLIB) $@
342
Martin v. Löwis1142de32002-03-29 16:28:31 +0000343libpython$(VERSION).so: $(LIBRARY_OBJS)
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000344 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000345
346libpython$(VERSION).sl: $(LIBRARY_OBJS)
347 $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000348
Jack Jansenea0c3822002-08-01 21:57:49 +0000349# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
350# minimal framework (not including the Lib directory and such) in the current
351# directory.
352RESSRCDIR=$(srcdir)/Mac/OSXResources/framework
353$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
354 $(LIBRARY) \
355 $(RESSRCDIR)/Info.plist \
356 $(RESSRCDIR)/version.plist \
357 $(RESSRCDIR)/English.lproj/InfoPlist.strings
Jack Jansen246debb2002-02-12 21:30:53 +0000358 $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000359 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000360 -framework System @LIBTOOL_CRUFT@
Jack Jansenea0c3822002-08-01 21:57:49 +0000361 $(INSTALL) -d -m $(DIRMODE) \
362 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
363 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
364 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
365 $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
366 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
367 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
368 $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
Jack Jansenc736b8d2002-08-04 21:17:20 +0000369 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
370 $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python
371 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
372 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000373
374# This rule builds the Cygwin Python DLL
375libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000376 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
377 $(LIBS) $(MODLIBS) $(SYSLIBS)
378
379
380oldsharedmods: $(SHAREDMODS)
381
382
383Makefile Modules/config.c: Makefile.pre \
384 $(srcdir)/Modules/config.c.in \
385 $(MAKESETUP) \
386 Modules/Setup.config \
387 Modules/Setup \
388 Modules/Setup.local
389 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
390 -s Modules \
391 Modules/Setup.config \
392 Modules/Setup.local \
393 Modules/Setup
394 @mv config.c Modules
395 @echo "The Makefile was updated, you may need to re-run make."
396
397
398Modules/Setup: $(srcdir)/Modules/Setup.dist
399 @if test -f Modules/Setup; then \
400 echo "-----------------------------------------------"; \
401 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
402 echo "check to make sure you have all the updates you"; \
403 echo "need in your Modules/Setup file."; \
Guido van Rossumbb29b9c2001-09-29 00:42:19 +0000404 echo "Usually, copying Setup.dist to Setup will work."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000405 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000406 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000407
408############################################################################
409# Special rules for object files
410
411Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000412 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000413
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000414Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000415 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
416 -DPREFIX='"$(prefix)"' \
417 -DEXEC_PREFIX='"$(exec_prefix)"' \
418 -DVERSION='"$(VERSION)"' \
419 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000420 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000421
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000422Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
423 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000424
425
426$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000427 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000428
429$(PGEN): $(PGENOBJS)
430 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
431
432Parser/grammar.o: $(srcdir)/Parser/grammar.c \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000433 $(srcdir)/Include/token.h \
434 $(srcdir)/Include/grammar.h
435Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
436
Martin v. Löwis00f1e3f2002-08-04 17:29:52 +0000437Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
438
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000439
Neil Schemenauer40417742001-02-27 02:45:36 +0000440Python/compile.o Python/symtable.o: $(GRAMMAR_H)
441
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000442Python/getplatform.o: $(srcdir)/Python/getplatform.c
Mark Hammond8235ea12002-07-19 06:55:41 +0000443 $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000444
445Python/importdl.o: $(srcdir)/Python/importdl.c
Mark Hammond8235ea12002-07-19 06:55:41 +0000446 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000447
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000448Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
449 $(srcdir)/Objects/unicodetype_db.h
450
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000451############################################################################
452# Header files
453
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000454PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000455 Include/Python.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000456 Include/abstract.h \
Guido van Rossum77f6a652002-04-03 22:41:51 +0000457 Include/boolobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000458 Include/bufferobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000459 Include/ceval.h \
460 Include/classobject.h \
461 Include/cobject.h \
462 Include/codecs.h \
463 Include/compile.h \
464 Include/complexobject.h \
Tim Peters6d6c1a32001-08-02 04:15:00 +0000465 Include/descrobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000466 Include/dictobject.h \
Guido van Rossum7dab2422002-04-26 19:40:56 +0000467 Include/enumobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000468 Include/fileobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000469 Include/floatobject.h \
470 Include/funcobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000471 Include/import.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000472 Include/intobject.h \
473 Include/intrcheck.h \
474 Include/iterobject.h \
475 Include/listobject.h \
476 Include/longobject.h \
477 Include/methodobject.h \
478 Include/modsupport.h \
479 Include/moduleobject.h \
480 Include/object.h \
481 Include/objimpl.h \
482 Include/patchlevel.h \
483 Include/pydebug.h \
484 Include/pyerrors.h \
485 Include/pyfpe.h \
486 Include/pymem.h \
487 Include/pyport.h \
488 Include/pystate.h \
489 Include/pythonrun.h \
490 Include/rangeobject.h \
491 Include/sliceobject.h \
492 Include/stringobject.h \
Guido van Rossum98bf58f2001-10-18 20:34:25 +0000493 Include/structseq.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000494 Include/structmember.h \
495 Include/symtable.h \
496 Include/sysmodule.h \
497 Include/traceback.h \
498 Include/tupleobject.h \
499 Include/unicodeobject.h \
Fred Drake502ed822001-10-05 21:56:02 +0000500 Include/weakrefobject.h \
Guido van Rossum427ce802001-09-18 02:40:21 +0000501 pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000502
Fred Drakea1a84e72001-03-06 05:52:16 +0000503$(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000504
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000505
506######################################################################
507
508# Test the interpreter (twice, once without .pyc files, once with)
509TESTOPTS= -l
510TESTPROG= $(srcdir)/Lib/test/regrtest.py
Martin v. Löwis1142de32002-03-29 16:28:31 +0000511TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000512test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000513 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000514 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
515 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000516
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000517QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000518 test_unicodedata test_re test_sre test_select test_poll \
Guido van Rossumed2f7252002-08-09 19:18:25 +0000519 test_linuxaudiodev test_struct test_sunaudiodev test_zlib
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000520quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000521 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000522 -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
523 $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000524
Barry Warsaw42119252001-03-03 04:14:21 +0000525MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
526 test_longexp
527memtest: all platform
528 -rm -f $(srcdir)/Lib/test/*.py[co]
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +0000529 -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
530 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
Barry Warsaw42119252001-03-03 04:14:21 +0000531
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000532# Install everything
533install: altinstall bininstall maninstall
534
535# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000536altinstall: altbininstall libinstall inclinstall libainstall \
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000537 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000538
539# Install shared libraries enabled by Setup
540DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
541
542oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
543 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000544 if test $$i != X; then \
545 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
546 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
547 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000548 done
549
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000550$(DESTSHARED):
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000551 @for i in $(DESTDIRS); \
552 do \
553 if test ! -d $$i; then \
554 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000555 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000556 else true; \
557 fi; \
558 done
559
560
561# Install the interpreter (by creating a hard link to python$(VERSION))
562bininstall: altbininstall
Jack Jansen1403b9f2002-08-09 14:42:57 +0000563 -if test -f $(BINDIR)/$(PYTHON) -o -L $(BINDIR)/$(PYTHON); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000564 then rm -f $(BINDIR)/$(PYTHON); \
565 else true; \
566 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000567 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000568
569# Install the interpreter with $(VERSION) affixed
570# This goes into $(exec_prefix)
Jack Jansen1999ef42001-12-06 21:47:20 +0000571altbininstall: $(BUILDPYTHON)
Jack Jansen3a451b12002-08-06 13:40:31 +0000572 @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \
573 if test ! -f $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \
574 echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \
575 exit 1; \
576 fi; \
577 fi
Martin v. Löwisd8a20d22002-05-08 08:59:59 +0000578 @for i in $(BINDIR) $(LIBDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000579 do \
580 if test ! -d $$i; then \
581 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000582 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000583 else true; \
584 fi; \
585 done
Jack Jansen1999ef42001-12-06 21:47:20 +0000586 $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000587 if test -f libpython$(VERSION)$(SO); then \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000588 if test "$(SO)" = .dll; then \
589 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(BINDIR); \
590 else \
591 $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \
592 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000593 else true; \
594 fi
595
596# Install the manual page
597maninstall:
598 @for i in $(MANDIR) $(MANDIR)/man1; \
599 do \
600 if test ! -d $$i; then \
601 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000602 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000603 else true; \
604 fi; \
605 done
606 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
607 $(MANDIR)/man1/python.1
608
609# Install the library
610PLATDIR= plat-$(MACHDEP)
611MACHDEPS= $(PLATDIR)
612XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
Barry Warsawf4c20d32001-12-03 18:51:41 +0000613LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \
614 encodings email compiler hotshot \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000615 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Jack Jansen1999ef42001-12-06 21:47:20 +0000616libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000617 @for i in $(SCRIPTDIR) $(LIBDEST); \
618 do \
619 if test ! -d $$i; then \
620 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000621 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000622 else true; \
623 fi; \
624 done
625 @for d in $(LIBSUBDIRS); \
626 do \
627 a=$(srcdir)/Lib/$$d; \
628 if test ! -d $$a; then continue; else true; fi; \
629 b=$(LIBDEST)/$$d; \
630 if test ! -d $$b; then \
631 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000632 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000633 else true; \
634 fi; \
635 done
636 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
637 do \
638 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000639 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
640 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000641 else \
642 $(INSTALL_DATA) $$i $(LIBDEST); \
643 echo $(INSTALL_DATA) $$i $(LIBDEST); \
644 fi; \
645 done
646 @for d in $(LIBSUBDIRS); \
647 do \
648 a=$(srcdir)/Lib/$$d; \
649 if test ! -d $$a; then continue; else true; fi; \
650 b=$(LIBDEST)/$$d; \
651 for i in $$a/*; \
652 do \
653 case $$i in \
654 *CVS) ;; \
655 *.py[co]) ;; \
656 *.orig) ;; \
657 *~) ;; \
658 *) \
659 if test -d $$i; then continue; fi; \
660 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000661 echo $(INSTALL_SCRIPT) $$i $$b; \
662 $(INSTALL_SCRIPT) $$i $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000663 else \
664 echo $(INSTALL_DATA) $$i $$b; \
665 $(INSTALL_DATA) $$i $$b; \
666 fi;; \
667 esac; \
668 done; \
669 done
670 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
Martin v. Löwis1142de32002-03-29 16:28:31 +0000671 PYTHONPATH=$(LIBDEST) $(RUNSHARED) \
Jack Jansen1999ef42001-12-06 21:47:20 +0000672 ./$(BUILDPYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000673 $(LIBDEST)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000674 PYTHONPATH=$(LIBDEST) $(RUNSHARED) \
Jack Jansen1999ef42001-12-06 21:47:20 +0000675 ./$(BUILDPYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000676
677# Create the PLATDIR source directory, if one wasn't distributed..
678$(srcdir)/Lib/$(PLATDIR):
679 mkdir $(srcdir)/Lib/$(PLATDIR)
680 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
681 export PATH; PATH="`pwd`:$$PATH"; \
682 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000683 export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
Jack Jansen0d153662001-12-19 09:24:40 +0000684 export EXE; EXE="$(BUILDEXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000685 cd $(srcdir)/Lib/$(PLATDIR); ./regen
686
687# Install the include files
688INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
689inclinstall:
690 @for i in $(INCLDIRSTOMAKE); \
691 do \
692 if test ! -d $$i; then \
693 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000694 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000695 else true; \
696 fi; \
697 done
698 @for i in $(srcdir)/Include/*.h; \
699 do \
700 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
701 $(INSTALL_DATA) $$i $(INCLUDEPY); \
702 done
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000703 $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000704
705# Install the library and miscellaneous stuff needed for extending/embedding
706# This goes into $(exec_prefix)
707LIBPL= $(LIBP)/config
708libainstall: all
709 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
710 do \
711 if test ! -d $$i; then \
712 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000713 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000714 else true; \
715 fi; \
716 done
Martin v. Löwis1142de32002-03-29 16:28:31 +0000717 @if test -d $(LIBRARY); then :; else \
Jack Jansen127e56e2001-09-11 14:41:54 +0000718 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jason Tishlerc0f1e772002-07-29 16:18:23 +0000719 if test "$(SO)" = .dll; then \
720 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL) ; \
721 else \
722 $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
723 $(RANLIB) $(LIBPL)/$(LIBRARY) ; \
724 fi; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000725 else \
Martin v. Löwis1142de32002-03-29 16:28:31 +0000726 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000727 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000728 fi
729 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Fred Drakea1a84e72001-03-06 05:52:16 +0000730 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000731 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
732 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
733 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
734 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
735 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000736 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
737 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000738 @if [ -s Modules/python.exp -a \
739 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
740 echo; echo "Installing support files for building shared extension modules on AIX:"; \
741 $(INSTALL_DATA) Modules/python.exp \
742 $(LIBPL)/python.exp; \
743 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000744 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000745 $(LIBPL)/makexp_aix; \
746 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000747 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000748 $(LIBPL)/ld_so_aix; \
749 echo "$(LIBPL)/ld_so_aix"; \
750 echo; echo "See Misc/AIX-NOTES for details."; \
751 else true; \
752 fi
753 @case "$(MACHDEP)" in beos*) \
754 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000755 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000756 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000757 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000758 echo "$(LIBPL)/ar_beos"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000759 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000760 echo "$(LIBPL)/ld_so_beos"; \
761 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000762 ;; \
763 esac
764
765# Install the dynamically loadable modules
766# This goes into $(exec_prefix)
767sharedinstall:
Martin v. Löwis1142de32002-03-29 16:28:31 +0000768 $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
769 --prefix=$(prefix) \
Guido van Rossumb33e7892001-10-17 06:26:53 +0000770 --install-scripts=$(BINDIR) \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000771 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000772
Jack Jansencb4321e2002-08-09 00:18:21 +0000773# Here are a couple of targets for MacOSX again, to install a full
774# framework-based Python. frameworkinstall installs everything, the
775# subtargets install specific parts. Much of the actual work is offloaded to
776# the Makefile in Mac/OSX
777#
778frameworkinstall: frameworkinstallframework \
779 frameworkinstallapps frameworkinstallunixtools
Guido van Rossumed2f7252002-08-09 19:18:25 +0000780
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000781# On install, we re-make the framework
782# structure in the install location, /Library/Frameworks/ or the argument to
783# --enable-framework. If --enable-framework has been specified then we have
784# automatically set prefix to the location deep down in the framework, so we
785# only have to cater for the structural bits of the framework.
786
Jack Jansencb4321e2002-08-09 00:18:21 +0000787frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
788
789frameworkinstallstructure: $(LDLIBRARY)
Jack Jansen127e56e2001-09-11 14:41:54 +0000790 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000791 echo Not configured with --enable-framework; \
Jack Jansen127e56e2001-09-11 14:41:54 +0000792 exit 1; \
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000793 else true; \
794 fi
Jack Jansencb4321e2002-08-09 00:18:21 +0000795 @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000796 if test ! -d $$i; then \
797 echo "Creating directory $$i"; \
798 $(INSTALL) -d -m $(DIRMODE) $$i; \
799 else true; \
800 fi; \
801 done
Jack Jansencb4321e2002-08-09 00:18:21 +0000802 $(LN) -fsn include/python$(VERSION) $(prefix)/Headers
803 $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(prefix)/Resources/Info.plist
804 $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(prefix)/Resources/version.plist
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000805 $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
Jack Jansencb4321e2002-08-09 00:18:21 +0000806 $(prefix)/Resources/English.lproj/InfoPlist.strings
Jack Jansenc736b8d2002-08-04 21:17:20 +0000807 $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
808 $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python
809 $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers
810 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000811 $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000812
Jack Jansencb4321e2002-08-09 00:18:21 +0000813# This installs Mac/Lib into the framework
814frameworkinstallmaclib:
815 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \
816 srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST)
817
818# This installs the IDE, the Launcher and other apps into /Applications
819frameworkinstallapps:
820 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \
821 srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
822
823# This install the unix python and pythonw tools in /usr/local/bin
824frameworkinstallunixtools:
825 $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
826 srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
Jack Jansen0b06be72002-06-21 14:48:38 +0000827
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000828# Build the toplevel Makefile
829Makefile.pre: Makefile.pre.in config.status
830 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
831 $(MAKE) -f Makefile.pre Makefile
832
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000833# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000834config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000835 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000836
Jack Jansen1999ef42001-12-06 21:47:20 +0000837.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000838
839# Some make's put the object file in the current directory
840.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000841 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000842
843# Rerun configure with the same options as it was run last time,
844# provided the config.status script exists
845recheck:
846 $(SHELL) config.status --recheck
847 $(SHELL) config.status
848
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +0000849# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000850autoconf:
851 (cd $(srcdir); autoconf)
852 (cd $(srcdir); autoheader)
853
854# Create a tags file for vi
855tags::
856 cd $(srcdir); \
857 ctags -w -t Include/*.h; \
858 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
859 done; \
Guido van Rossumc9489662002-02-28 19:26:08 +0000860 sort -o tags tags
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000861
862# Create a tags file for GNU Emacs
863TAGS::
864 cd $(srcdir); \
865 etags Include/*.h; \
866 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
867
868# Sanitation targets -- clean leaves libraries, executables and tags
869# files, which clobber removes those as well
870
871clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000872 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000873 find . -name '*.s[ol]' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000874 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000875
876clobber: clean
Jack Jansen1999ef42001-12-06 21:47:20 +0000877 -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000878 tags TAGS \
Guido van Rossum7cb32ae2001-08-17 15:32:31 +0000879 config.cache config.log pyconfig.h Modules/config.c
Guido van Rossum1d88c592001-06-06 17:51:57 +0000880 -rm -rf build platform
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000881
882# Make things extra clean, before making a distribution:
883# remove all generated files, even Makefile[.pre]
884distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000885 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000886 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000887 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
888 -o -name '[@,#]*' -o -name '*.old' \
889 -o -name '*.orig' -o -name '*.rej' \
890 -o -name '*.bak' ')' \
891 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000892
893# Check for smelly exported symbols (not starting with Py/_Py)
894smelly: all
895 nm -p $(LIBRARY) | \
896 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
897
898# Find files with funny names
899funny:
900 find $(DISTDIRS) -type d \
901 -o -name '*.[chs]' \
902 -o -name '*.py' \
903 -o -name '*.doc' \
904 -o -name '*.sty' \
905 -o -name '*.bib' \
906 -o -name '*.dat' \
907 -o -name '*.el' \
908 -o -name '*.fd' \
909 -o -name '*.in' \
910 -o -name '*.tex' \
911 -o -name '*,[vpt]' \
912 -o -name 'Setup' \
913 -o -name 'Setup.*' \
914 -o -name README \
915 -o -name Makefile \
916 -o -name ChangeLog \
917 -o -name Repository \
918 -o -name Root \
919 -o -name Entries \
920 -o -name Tag \
921 -o -name tags \
922 -o -name TAGS \
923 -o -name .cvsignore \
924 -o -name MANIFEST \
925 -o -print
926
Guido van Rossum9454ad72001-08-18 21:08:22 +0000927# Dependencies
928
Martin v. Löwis06f15bb2001-12-02 13:02:32 +0000929Python/thread.o: @THREADHEADERS@
Guido van Rossum9454ad72001-08-18 21:08:22 +0000930
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000931# IF YOU PUT ANYTHING HERE IT WILL GO AWAY