blob: 103a36b345894be7f49c3b994725b1cd791f7be5 [file] [log] [blame]
Neil Schemenauer85515ad2001-01-24 17:11:43 +00001# Top-level Makefile for Python
2#
3# 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:
8#
9# ./configure
10# make
11# make test
12# make install
13#
14# 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.
Neil Schemenauer85515ad2001-01-24 17:11:43 +000018#
19# 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@
57DEFS= @DEFS@
58CFLAGS= $(OPT) -I. -I$(srcdir)/Include $(DEFS)
59LDFLAGS= @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
67PY_CFLAGS= $(CFLAGS) $(CFLAGSFORSHARED)
68
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
82MANDIR= $(prefix)/man
83INCLUDEDIR= $(prefix)/include
84CONFINCLUDEDIR= $(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@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000102
103# Modes for directories, executables and data files created by the
104# install process. Default to user-only-writable for all file types.
105DIRMODE= 755
106EXEMODE= 755
107FILEMODE= 644
108
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000109# configure script arguments
110CONFIG_ARGS= @CONFIG_ARGS@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000111
112
113# Subdirectories with code
114SRCDIRS= @SRCDIRS@
115
116# Other subdirectories
117SUBDIRSTOO= Include Lib Misc Demo
118
119# Files and directories to be distributed
120CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.pre.in
121DISTFILES= README ChangeLog $(CONFIGFILES)
122DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
123DIST= $(DISTFILES) $(DISTDIRS)
124
125
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000126LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000127LDLIBRARY= @LDLIBRARY@
128DLLLIBRARY= @DLLLIBRARY@
129
130
131LIBS= @LIBS@
132LIBM= @LIBM@
133LIBC= @LIBC@
134SYSLIBS= $(LIBM) $(LIBC)
135
136MAINOBJ= @MAINOBJ@
137LIBOBJS= @LIBOBJS@
138DLINCLDIR= @DLINCLDIR@
139DYNLOADFILE= @DYNLOADFILE@
140
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000141PYTHON= python$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000142
143# === Definitions added by makesetup ===
144
145
146##########################################################################
147# Modules
148MODULE_OBJS= \
149 Modules/config.o \
150 Modules/getpath.o \
Neil Schemenauer18821822001-01-27 21:42:38 +0000151 Modules/main.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000152
153# Used of signalmodule.o is not available
154SIGNAL_OBJS= @SIGNAL_OBJS@
155
156
157##########################################################################
158# Grammar
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000159GRAMMAR_H= $(srcdir)/Include/graminit.h
160GRAMMAR_C= $(srcdir)/Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000161GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
162
163
164##########################################################################
165# Parser
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000166PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000167
168POBJS= \
169 Parser/acceler.o \
170 Parser/grammar1.o \
171 Parser/listnode.o \
172 Parser/node.o \
173 Parser/parser.o \
174 Parser/parsetok.o \
175 Parser/tokenizer.o \
176 Parser/bitset.o \
177 Parser/metagrammar.o
178
179PARSER_OBJS= $(POBJS) Parser/myreadline.o
180
181PGOBJS= \
182 Parser/firstsets.o \
183 Parser/grammar.o \
184 Parser/pgen.o \
185 Parser/printgrammar.o \
186 Parser/pgenmain.o
187
188PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
189
190
191##########################################################################
192# Python
193PYTHON_OBJS= \
194 Python/bltinmodule.o \
195 Python/exceptions.o \
196 Python/ceval.o \
197 Python/compile.o \
198 Python/codecs.o \
199 Python/errors.o \
200 Python/frozen.o \
201 Python/frozenmain.o \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000202 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000203 Python/getargs.o \
204 Python/getcompiler.o \
205 Python/getcopyright.o \
206 Python/getmtime.o \
207 Python/getplatform.o \
208 Python/getversion.o \
209 Python/graminit.o \
210 Python/import.o \
211 Python/importdl.o \
212 Python/marshal.o \
213 Python/modsupport.o \
214 Python/mystrtoul.o \
215 Python/pyfpe.o \
216 Python/pystate.o \
217 Python/pythonrun.o \
218 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000219 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000220 Python/sysmodule.o \
221 Python/traceback.o \
222 Python/getopt.o \
223 Python/$(DYNLOADFILE) \
224 $(LIBOBJS)
225
226
227##########################################################################
228# Objects
229OBJECT_OBJS= \
230 Objects/abstract.o \
231 Objects/bufferobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000232 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000233 Objects/classobject.o \
234 Objects/cobject.o \
235 Objects/complexobject.o \
236 Objects/fileobject.o \
237 Objects/floatobject.o \
238 Objects/frameobject.o \
239 Objects/funcobject.o \
240 Objects/intobject.o \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000241 Objects/iterobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000242 Objects/listobject.o \
243 Objects/longobject.o \
244 Objects/dictobject.o \
245 Objects/methodobject.o \
246 Objects/moduleobject.o \
247 Objects/object.o \
248 Objects/rangeobject.o \
249 Objects/sliceobject.o \
250 Objects/stringobject.o \
251 Objects/tupleobject.o \
252 Objects/typeobject.o \
253 Objects/unicodeobject.o \
254 Objects/unicodectype.o
255
256
257##########################################################################
258# objects that get linked into the Python library
259LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000260 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000261 $(PARSER_OBJS) \
262 $(OBJECT_OBJS) \
263 $(PYTHON_OBJS) \
264 $(MODULE_OBJS) \
265 $(SIGNAL_OBJS) \
266 $(MODOBJS)
267
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000268#########################################################################
269# Rules
270
271# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000272all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000273
274# Build the interpreter
Fred Drakea1a84e72001-03-06 05:52:16 +0000275$(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY)
276 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
277 Modules/$(MAINOBJ) \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000278 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
279
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000280platform: $(PYTHON)
281 ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
282
283
284# Build the shared modules
285sharedmods: $(PYTHON)
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000286 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000287
Neil Schemenauer18821822001-01-27 21:42:38 +0000288# buildno should really depend on something like LIBRARY_SRC
289buildno: $(PARSER_OBJS) \
290 $(OBJECT_OBJS) \
291 $(PYTHON_OBJS) \
292 $(MODULE_OBJS) \
293 $(SIGNAL_OBJS) \
294 $(MODOBJS) \
295 $(srcdir)/Modules/getbuildinfo.c
296 if test -f buildno; then \
297 expr `cat buildno` + 1 >buildno1; \
298 mv -f buildno1 buildno; \
299 else echo 1 >buildno; fi
300
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000301# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000302# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000303$(LIBRARY): $(LIBRARY_OBJS)
304 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000305 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000306 $(AR) cr $@ $(PARSER_OBJS)
307 $(AR) cr $@ $(OBJECT_OBJS)
308 $(AR) cr $@ $(PYTHON_OBJS)
309 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
310 $(AR) cr $@ $(MODOBJS)
311 $(RANLIB) $@
312
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000313# This rule is only here for DG/UX, UnixWare, and BeOS!!!
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000314libpython$(VERSION).so: $(LIBRARY)
315 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
316 *dgux*) \
317 test -d dgux || mkdir dgux; \
318 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
319 /bin/rm -rf ./dgux \
320 ;; \
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000321 unixware*) \
322 $(LDSHARED) -o $@ $(LIBRARY_OBJS) \
323 ;; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000324 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000325 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000326 ;; \
327 esac
328
329# This rule is here for OPENSTEP/Rhapsody/MacOSX
330libpython$(VERSION).dylib: $(LIBRARY)
331 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
332 -framework System @LIBTOOL_CRUFT@
333
334# This rule builds the Cygwin Python DLL
335libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
336 dlltool --export-all --output-def $@ $^
337 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
338 $(LIBS) $(MODLIBS) $(SYSLIBS)
339
340
341oldsharedmods: $(SHAREDMODS)
342
343
344Makefile Modules/config.c: Makefile.pre \
345 $(srcdir)/Modules/config.c.in \
346 $(MAKESETUP) \
347 Modules/Setup.config \
348 Modules/Setup \
349 Modules/Setup.local
350 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
351 -s Modules \
352 Modules/Setup.config \
353 Modules/Setup.local \
354 Modules/Setup
355 @mv config.c Modules
356 @echo "The Makefile was updated, you may need to re-run make."
357
358
359Modules/Setup: $(srcdir)/Modules/Setup.dist
360 @if test -f Modules/Setup; then \
361 echo "-----------------------------------------------"; \
362 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
363 echo "check to make sure you have all the updates you"; \
364 echo "need in your Modules/Setup file."; \
365 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000366 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000367
368############################################################################
369# Special rules for object files
370
371Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000372 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000373
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000374Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000375 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
376 -DPREFIX='"$(prefix)"' \
377 -DEXEC_PREFIX='"$(exec_prefix)"' \
378 -DVERSION='"$(VERSION)"' \
379 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000380 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000381
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000382Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
383 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000384
385
386$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000387 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000388
389$(PGEN): $(PGENOBJS)
390 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
391
392Parser/grammar.o: $(srcdir)/Parser/grammar.c \
393 $(srcdir)/Parser/assert.h \
394 $(srcdir)/Include/token.h \
395 $(srcdir)/Include/grammar.h
396Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
397
398
Neil Schemenauer40417742001-02-27 02:45:36 +0000399Python/compile.o Python/symtable.o: $(GRAMMAR_H)
400
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000401Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000402 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000403
404Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000405 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000406
Neil Schemenauera35c6882001-02-27 04:45:05 +0000407Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000408
409Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
410 $(srcdir)/Objects/unicodetype_db.h
411
412
413############################################################################
414# Header files
415
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000416PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000417 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000418 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000419 Include/patchlevel.h \
420 Include/pyport.h \
421 Include/pymem.h \
422 Include/object.h \
423 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000424 Include/compile.h \
425 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000426 Include/pydebug.h \
427 Include/unicodeobject.h \
428 Include/intobject.h \
429 Include/longobject.h \
430 Include/floatobject.h \
431 Include/complexobject.h \
432 Include/rangeobject.h \
433 Include/stringobject.h \
434 Include/bufferobject.h \
435 Include/tupleobject.h \
436 Include/listobject.h \
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000437 Include/iterobject.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000438 Include/dictobject.h \
439 Include/methodobject.h \
440 Include/moduleobject.h \
441 Include/funcobject.h \
442 Include/classobject.h \
443 Include/fileobject.h \
444 Include/cobject.h \
445 Include/traceback.h \
446 Include/sliceobject.h \
447 Include/codecs.h \
448 Include/pyerrors.h \
449 Include/pystate.h \
450 Include/modsupport.h \
451 Include/ceval.h \
452 Include/pythonrun.h \
453 Include/sysmodule.h \
454 Include/intrcheck.h \
455 Include/import.h \
456 Include/abstract.h \
457 Include/pyfpe.h
458
Fred Drakea1a84e72001-03-06 05:52:16 +0000459$(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000460
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000461
462######################################################################
463
464# Test the interpreter (twice, once without .pyc files, once with)
465TESTOPTS= -l
466TESTPROG= $(srcdir)/Lib/test/regrtest.py
467TESTPYTHON= ./$(PYTHON) -tt
468test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000469 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000470 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
471 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
472
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000473QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000474 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000475 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000476quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000477 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000478 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
479 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
480
Barry Warsaw42119252001-03-03 04:14:21 +0000481MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
482 test_longexp
483memtest: all platform
484 -rm -f $(srcdir)/Lib/test/*.py[co]
485 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
486 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
487
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000488# Install everything
489install: altinstall bininstall maninstall
490
491# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000492altinstall: altbininstall libinstall inclinstall libainstall \
493 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000494
495# Install shared libraries enabled by Setup
496DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
497
498oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
499 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000500 if test $$i != X; then \
501 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
502 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
503 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000504 done
505
506$(DESTSHARED):
507 @for i in $(DESTDIRS); \
508 do \
509 if test ! -d $$i; then \
510 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000511 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000512 else true; \
513 fi; \
514 done
515
516
517# Install the interpreter (by creating a hard link to python$(VERSION))
518bininstall: altbininstall
519 -if test -f $(BINDIR)/$(PYTHON); \
520 then rm -f $(BINDIR)/$(PYTHON); \
521 else true; \
522 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000523 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000524
525# Install the interpreter with $(VERSION) affixed
526# This goes into $(exec_prefix)
527altbininstall: $(PYTHON)
528 @for i in $(BINDIR); \
529 do \
530 if test ! -d $$i; then \
531 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000532 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000533 else true; \
534 fi; \
535 done
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000536 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000537 if test -f libpython$(VERSION).so; then \
538 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
539 else true; \
540 fi
541 if test -f "$(DLLLIBRARY)"; then \
Neil Schemenauercf20d4f2001-03-16 11:50:43 +0000542 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000543 else true; \
544 fi
545
546# Install the manual page
547maninstall:
548 @for i in $(MANDIR) $(MANDIR)/man1; \
549 do \
550 if test ! -d $$i; then \
551 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000552 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000553 else true; \
554 fi; \
555 done
556 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
557 $(MANDIR)/man1/python.1
558
559# Install the library
560PLATDIR= plat-$(MACHDEP)
561MACHDEPS= $(PLATDIR)
562XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
563LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
564 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000565libinstall: $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000566 @for i in $(SCRIPTDIR) $(LIBDEST); \
567 do \
568 if test ! -d $$i; then \
569 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000570 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000571 else true; \
572 fi; \
573 done
574 @for d in $(LIBSUBDIRS); \
575 do \
576 a=$(srcdir)/Lib/$$d; \
577 if test ! -d $$a; then continue; else true; fi; \
578 b=$(LIBDEST)/$$d; \
579 if test ! -d $$b; then \
580 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000581 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000582 else true; \
583 fi; \
584 done
585 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
586 do \
587 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000588 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
589 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000590 else \
591 $(INSTALL_DATA) $$i $(LIBDEST); \
592 echo $(INSTALL_DATA) $$i $(LIBDEST); \
593 fi; \
594 done
595 @for d in $(LIBSUBDIRS); \
596 do \
597 a=$(srcdir)/Lib/$$d; \
598 if test ! -d $$a; then continue; else true; fi; \
599 b=$(LIBDEST)/$$d; \
600 for i in $$a/*; \
601 do \
602 case $$i in \
603 *CVS) ;; \
604 *.py[co]) ;; \
605 *.orig) ;; \
606 *~) ;; \
607 *) \
608 if test -d $$i; then continue; fi; \
609 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000610 echo $(INSTALL_SCRIPT) $$i $$b; \
611 $(INSTALL_SCRIPT) $$i $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000612 else \
613 echo $(INSTALL_DATA) $$i $$b; \
614 $(INSTALL_DATA) $$i $$b; \
615 fi;; \
616 esac; \
617 done; \
618 done
619 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
620 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000621 ./$(PYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
622 $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000623 PYTHONPATH=$(LIBDEST) \
Jeremy Hylton12b64572001-04-18 01:20:21 +0000624 ./$(PYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000625
626# Create the PLATDIR source directory, if one wasn't distributed..
627$(srcdir)/Lib/$(PLATDIR):
628 mkdir $(srcdir)/Lib/$(PLATDIR)
629 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
630 export PATH; PATH="`pwd`:$$PATH"; \
631 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000632 export EXE; EXE="$(EXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000633 cd $(srcdir)/Lib/$(PLATDIR); ./regen
634
635# Install the include files
636INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
637inclinstall:
638 @for i in $(INCLDIRSTOMAKE); \
639 do \
640 if test ! -d $$i; then \
641 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000642 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000643 else true; \
644 fi; \
645 done
646 @for i in $(srcdir)/Include/*.h; \
647 do \
648 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
649 $(INSTALL_DATA) $$i $(INCLUDEPY); \
650 done
651 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
652
653# Install the library and miscellaneous stuff needed for extending/embedding
654# This goes into $(exec_prefix)
655LIBPL= $(LIBP)/config
656libainstall: all
657 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
658 do \
659 if test ! -d $$i; then \
660 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000661 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000662 else true; \
663 fi; \
664 done
665 @if test -d $(LDLIBRARY); then :; else \
666 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
667 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
668 fi
669 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Fred Drakea1a84e72001-03-06 05:52:16 +0000670 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000671 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
672 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
673 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
674 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
675 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000676 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
677 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000678 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
679 @if [ -s Modules/python.exp -a \
680 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
681 echo; echo "Installing support files for building shared extension modules on AIX:"; \
682 $(INSTALL_DATA) Modules/python.exp \
683 $(LIBPL)/python.exp; \
684 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000685 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000686 $(LIBPL)/makexp_aix; \
687 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000688 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000689 $(LIBPL)/ld_so_aix; \
690 echo "$(LIBPL)/ld_so_aix"; \
691 echo; echo "See Misc/AIX-NOTES for details."; \
692 else true; \
693 fi
694 @case "$(MACHDEP)" in beos*) \
695 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000696 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000697 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000698 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000699 echo "$(LIBPL)/ar_beos"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000700 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000701 echo "$(LIBPL)/ld_so_beos"; \
702 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000703 ;; \
704 esac
705
706# Install the dynamically loadable modules
707# This goes into $(exec_prefix)
708sharedinstall:
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000709 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000710 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000711
712# Build the toplevel Makefile
713Makefile.pre: Makefile.pre.in config.status
714 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
715 $(MAKE) -f Makefile.pre Makefile
716
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000717# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000718config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000719 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000720
721.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
722
723# Some make's put the object file in the current directory
724.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000725 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000726
727# Rerun configure with the same options as it was run last time,
728# provided the config.status script exists
729recheck:
730 $(SHELL) config.status --recheck
731 $(SHELL) config.status
732
733# Rebuild the configure script from configure.in; also rebuild config.h.in
734autoconf:
735 (cd $(srcdir); autoconf)
736 (cd $(srcdir); autoheader)
737
738# Create a tags file for vi
739tags::
740 cd $(srcdir); \
741 ctags -w -t Include/*.h; \
742 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
743 done; \
744 sort tags -o tags
745
746# Create a tags file for GNU Emacs
747TAGS::
748 cd $(srcdir); \
749 etags Include/*.h; \
750 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
751
752# Sanitation targets -- clean leaves libraries, executables and tags
753# files, which clobber removes those as well
754
755clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000756 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000757 find . -name '*.s[ol]' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000758 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000759
760clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000761 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000762 tags TAGS \
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000763 config.cache config.log config.h Modules/config.c
Neil Schemenauere0d43572001-02-03 17:16:29 +0000764 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000765
766# Make things extra clean, before making a distribution:
767# remove all generated files, even Makefile[.pre]
768distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000769 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000770 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000771 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
772 -o -name '[@,#]*' -o -name '*.old' \
773 -o -name '*.orig' -o -name '*.rej' \
774 -o -name '*.bak' ')' \
775 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000776
777# Check for smelly exported symbols (not starting with Py/_Py)
778smelly: all
779 nm -p $(LIBRARY) | \
780 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
781
782# Find files with funny names
783funny:
784 find $(DISTDIRS) -type d \
785 -o -name '*.[chs]' \
786 -o -name '*.py' \
787 -o -name '*.doc' \
788 -o -name '*.sty' \
789 -o -name '*.bib' \
790 -o -name '*.dat' \
791 -o -name '*.el' \
792 -o -name '*.fd' \
793 -o -name '*.in' \
794 -o -name '*.tex' \
795 -o -name '*,[vpt]' \
796 -o -name 'Setup' \
797 -o -name 'Setup.*' \
798 -o -name README \
799 -o -name Makefile \
800 -o -name ChangeLog \
801 -o -name Repository \
802 -o -name Root \
803 -o -name Entries \
804 -o -name Tag \
805 -o -name tags \
806 -o -name TAGS \
807 -o -name .cvsignore \
808 -o -name MANIFEST \
809 -o -print
810
811# IF YOU PUT ANYTHING HERE IT WILL GO AWAY