blob: f81702b4509d9163181fff86f056a4c5be8b0149 [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 \
241 Objects/listobject.o \
242 Objects/longobject.o \
243 Objects/dictobject.o \
244 Objects/methodobject.o \
245 Objects/moduleobject.o \
246 Objects/object.o \
247 Objects/rangeobject.o \
248 Objects/sliceobject.o \
249 Objects/stringobject.o \
250 Objects/tupleobject.o \
251 Objects/typeobject.o \
252 Objects/unicodeobject.o \
253 Objects/unicodectype.o
254
255
256##########################################################################
257# objects that get linked into the Python library
258LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000259 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000260 $(PARSER_OBJS) \
261 $(OBJECT_OBJS) \
262 $(PYTHON_OBJS) \
263 $(MODULE_OBJS) \
264 $(SIGNAL_OBJS) \
265 $(MODOBJS)
266
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000267#########################################################################
268# Rules
269
270# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000271all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000272
273# Build the interpreter
Fred Drakea1a84e72001-03-06 05:52:16 +0000274$(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY)
275 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
276 Modules/$(MAINOBJ) \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000277 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
278
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000279platform: $(PYTHON)
280 ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
281
282
283# Build the shared modules
284sharedmods: $(PYTHON)
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000285 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000286
Neil Schemenauer18821822001-01-27 21:42:38 +0000287# buildno should really depend on something like LIBRARY_SRC
288buildno: $(PARSER_OBJS) \
289 $(OBJECT_OBJS) \
290 $(PYTHON_OBJS) \
291 $(MODULE_OBJS) \
292 $(SIGNAL_OBJS) \
293 $(MODOBJS) \
294 $(srcdir)/Modules/getbuildinfo.c
295 if test -f buildno; then \
296 expr `cat buildno` + 1 >buildno1; \
297 mv -f buildno1 buildno; \
298 else echo 1 >buildno; fi
299
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000300# Build static library
Guido van Rossum4e6a7a62001-04-09 22:23:22 +0000301# avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000302$(LIBRARY): $(LIBRARY_OBJS)
303 -rm -f $@
Neil Schemenauer18821822001-01-27 21:42:38 +0000304 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000305 $(AR) cr $@ $(PARSER_OBJS)
306 $(AR) cr $@ $(OBJECT_OBJS)
307 $(AR) cr $@ $(PYTHON_OBJS)
308 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
309 $(AR) cr $@ $(MODOBJS)
310 $(RANLIB) $@
311
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000312# This rule is only here for DG/UX, UnixWare, and BeOS!!!
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000313libpython$(VERSION).so: $(LIBRARY)
314 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
315 *dgux*) \
316 test -d dgux || mkdir dgux; \
317 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
318 /bin/rm -rf ./dgux \
319 ;; \
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000320 unixware*) \
321 $(LDSHARED) -o $@ $(LIBRARY_OBJS) \
322 ;; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000323 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000324 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000325 ;; \
326 esac
327
328# This rule is here for OPENSTEP/Rhapsody/MacOSX
329libpython$(VERSION).dylib: $(LIBRARY)
330 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
331 -framework System @LIBTOOL_CRUFT@
332
333# This rule builds the Cygwin Python DLL
334libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
335 dlltool --export-all --output-def $@ $^
336 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
337 $(LIBS) $(MODLIBS) $(SYSLIBS)
338
339
340oldsharedmods: $(SHAREDMODS)
341
342
343Makefile Modules/config.c: Makefile.pre \
344 $(srcdir)/Modules/config.c.in \
345 $(MAKESETUP) \
346 Modules/Setup.config \
347 Modules/Setup \
348 Modules/Setup.local
349 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
350 -s Modules \
351 Modules/Setup.config \
352 Modules/Setup.local \
353 Modules/Setup
354 @mv config.c Modules
355 @echo "The Makefile was updated, you may need to re-run make."
356
357
358Modules/Setup: $(srcdir)/Modules/Setup.dist
359 @if test -f Modules/Setup; then \
360 echo "-----------------------------------------------"; \
361 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
362 echo "check to make sure you have all the updates you"; \
363 echo "need in your Modules/Setup file."; \
364 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000365 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000366
367############################################################################
368# Special rules for object files
369
370Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000371 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000372
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000373Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000374 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
375 -DPREFIX='"$(prefix)"' \
376 -DEXEC_PREFIX='"$(exec_prefix)"' \
377 -DVERSION='"$(VERSION)"' \
378 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000379 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000380
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000381Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
382 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000383
384
385$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000386 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000387
388$(PGEN): $(PGENOBJS)
389 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
390
391Parser/grammar.o: $(srcdir)/Parser/grammar.c \
392 $(srcdir)/Parser/assert.h \
393 $(srcdir)/Include/token.h \
394 $(srcdir)/Include/grammar.h
395Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
396
397
Neil Schemenauer40417742001-02-27 02:45:36 +0000398Python/compile.o Python/symtable.o: $(GRAMMAR_H)
399
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000400Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000401 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000402
403Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000404 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000405
Neil Schemenauera35c6882001-02-27 04:45:05 +0000406Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000407
408Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
409 $(srcdir)/Objects/unicodetype_db.h
410
411
412############################################################################
413# Header files
414
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000415PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000416 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000417 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000418 Include/patchlevel.h \
419 Include/pyport.h \
420 Include/pymem.h \
421 Include/object.h \
422 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000423 Include/compile.h \
424 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000425 Include/pydebug.h \
426 Include/unicodeobject.h \
427 Include/intobject.h \
428 Include/longobject.h \
429 Include/floatobject.h \
430 Include/complexobject.h \
431 Include/rangeobject.h \
432 Include/stringobject.h \
433 Include/bufferobject.h \
434 Include/tupleobject.h \
435 Include/listobject.h \
436 Include/dictobject.h \
437 Include/methodobject.h \
438 Include/moduleobject.h \
439 Include/funcobject.h \
440 Include/classobject.h \
441 Include/fileobject.h \
442 Include/cobject.h \
443 Include/traceback.h \
444 Include/sliceobject.h \
445 Include/codecs.h \
446 Include/pyerrors.h \
447 Include/pystate.h \
448 Include/modsupport.h \
449 Include/ceval.h \
450 Include/pythonrun.h \
451 Include/sysmodule.h \
452 Include/intrcheck.h \
453 Include/import.h \
454 Include/abstract.h \
455 Include/pyfpe.h
456
Fred Drakea1a84e72001-03-06 05:52:16 +0000457$(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000458
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000459
460######################################################################
461
462# Test the interpreter (twice, once without .pyc files, once with)
463TESTOPTS= -l
464TESTPROG= $(srcdir)/Lib/test/regrtest.py
465TESTPYTHON= ./$(PYTHON) -tt
466test: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000467 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000468 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
469 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
470
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000471QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000472 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000473 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000474quicktest: all platform
Guido van Rossumcd81ea12001-03-01 00:36:53 +0000475 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000476 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
477 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
478
Barry Warsaw42119252001-03-03 04:14:21 +0000479MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
480 test_longexp
481memtest: all platform
482 -rm -f $(srcdir)/Lib/test/*.py[co]
483 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
484 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
485
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000486# Install everything
487install: altinstall bininstall maninstall
488
489# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000490altinstall: altbininstall libinstall inclinstall libainstall \
491 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000492
493# Install shared libraries enabled by Setup
494DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
495
496oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
497 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000498 if test $$i != X; then \
499 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
500 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
501 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000502 done
503
504$(DESTSHARED):
505 @for i in $(DESTDIRS); \
506 do \
507 if test ! -d $$i; then \
508 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000509 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000510 else true; \
511 fi; \
512 done
513
514
515# Install the interpreter (by creating a hard link to python$(VERSION))
516bininstall: altbininstall
517 -if test -f $(BINDIR)/$(PYTHON); \
518 then rm -f $(BINDIR)/$(PYTHON); \
519 else true; \
520 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000521 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000522
523# Install the interpreter with $(VERSION) affixed
524# This goes into $(exec_prefix)
525altbininstall: $(PYTHON)
526 @for i in $(BINDIR); \
527 do \
528 if test ! -d $$i; then \
529 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000530 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000531 else true; \
532 fi; \
533 done
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000534 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000535 if test -f libpython$(VERSION).so; then \
536 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
537 else true; \
538 fi
539 if test -f "$(DLLLIBRARY)"; then \
Neil Schemenauercf20d4f2001-03-16 11:50:43 +0000540 $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000541 else true; \
542 fi
543
544# Install the manual page
545maninstall:
546 @for i in $(MANDIR) $(MANDIR)/man1; \
547 do \
548 if test ! -d $$i; then \
549 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000550 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000551 else true; \
552 fi; \
553 done
554 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
555 $(MANDIR)/man1/python.1
556
557# Install the library
558PLATDIR= plat-$(MACHDEP)
559MACHDEPS= $(PLATDIR)
560XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
561LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
562 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000563libinstall: $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000564 @for i in $(SCRIPTDIR) $(LIBDEST); \
565 do \
566 if test ! -d $$i; then \
567 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000568 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000569 else true; \
570 fi; \
571 done
572 @for d in $(LIBSUBDIRS); \
573 do \
574 a=$(srcdir)/Lib/$$d; \
575 if test ! -d $$a; then continue; else true; fi; \
576 b=$(LIBDEST)/$$d; \
577 if test ! -d $$b; then \
578 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000579 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000580 else true; \
581 fi; \
582 done
583 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
584 do \
585 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000586 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
587 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000588 else \
589 $(INSTALL_DATA) $$i $(LIBDEST); \
590 echo $(INSTALL_DATA) $$i $(LIBDEST); \
591 fi; \
592 done
593 @for d in $(LIBSUBDIRS); \
594 do \
595 a=$(srcdir)/Lib/$$d; \
596 if test ! -d $$a; then continue; else true; fi; \
597 b=$(LIBDEST)/$$d; \
598 for i in $$a/*; \
599 do \
600 case $$i in \
601 *CVS) ;; \
602 *.py[co]) ;; \
603 *.orig) ;; \
604 *~) ;; \
605 *) \
606 if test -d $$i; then continue; fi; \
607 if test -x $$i; then \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000608 echo $(INSTALL_SCRIPT) $$i $$b; \
609 $(INSTALL_SCRIPT) $$i $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000610 else \
611 echo $(INSTALL_DATA) $$i $$b; \
612 $(INSTALL_DATA) $$i $$b; \
613 fi;; \
614 esac; \
615 done; \
616 done
617 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
618 PYTHONPATH=$(LIBDEST) \
619 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
620 PYTHONPATH=$(LIBDEST) \
621 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
622
623# Create the PLATDIR source directory, if one wasn't distributed..
624$(srcdir)/Lib/$(PLATDIR):
625 mkdir $(srcdir)/Lib/$(PLATDIR)
626 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
627 export PATH; PATH="`pwd`:$$PATH"; \
628 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000629 export EXE; EXE="$(EXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000630 cd $(srcdir)/Lib/$(PLATDIR); ./regen
631
632# Install the include files
633INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
634inclinstall:
635 @for i in $(INCLDIRSTOMAKE); \
636 do \
637 if test ! -d $$i; then \
638 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000639 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000640 else true; \
641 fi; \
642 done
643 @for i in $(srcdir)/Include/*.h; \
644 do \
645 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
646 $(INSTALL_DATA) $$i $(INCLUDEPY); \
647 done
648 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
649
650# Install the library and miscellaneous stuff needed for extending/embedding
651# This goes into $(exec_prefix)
652LIBPL= $(LIBP)/config
653libainstall: all
654 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
655 do \
656 if test ! -d $$i; then \
657 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000658 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000659 else true; \
660 fi; \
661 done
662 @if test -d $(LDLIBRARY); then :; else \
663 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
664 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
665 fi
666 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
Fred Drakea1a84e72001-03-06 05:52:16 +0000667 $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000668 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
669 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
670 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
671 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
672 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000673 $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
674 $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000675 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
676 @if [ -s Modules/python.exp -a \
677 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
678 echo; echo "Installing support files for building shared extension modules on AIX:"; \
679 $(INSTALL_DATA) Modules/python.exp \
680 $(LIBPL)/python.exp; \
681 echo; echo "$(LIBPL)/python.exp"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000682 $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000683 $(LIBPL)/makexp_aix; \
684 echo "$(LIBPL)/makexp_aix"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000685 $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000686 $(LIBPL)/ld_so_aix; \
687 echo "$(LIBPL)/ld_so_aix"; \
688 echo; echo "See Misc/AIX-NOTES for details."; \
689 else true; \
690 fi
691 @case "$(MACHDEP)" in beos*) \
692 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000693 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000694 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000695 $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000696 echo "$(LIBPL)/ar_beos"; \
Neil Schemenauer3f5cc202001-04-10 23:03:35 +0000697 $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000698 echo "$(LIBPL)/ld_so_beos"; \
699 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000700 ;; \
701 esac
702
703# Install the dynamically loadable modules
704# This goes into $(exec_prefix)
705sharedinstall:
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000706 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000707 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000708
709# Build the toplevel Makefile
710Makefile.pre: Makefile.pre.in config.status
711 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
712 $(MAKE) -f Makefile.pre Makefile
713
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000714# Run the configure script.
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000715config.status: $(srcdir)/configure
Neil Schemenauer64b1b682001-03-22 00:32:32 +0000716 $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000717
718.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
719
720# Some make's put the object file in the current directory
721.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000722 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000723
724# Rerun configure with the same options as it was run last time,
725# provided the config.status script exists
726recheck:
727 $(SHELL) config.status --recheck
728 $(SHELL) config.status
729
730# Rebuild the configure script from configure.in; also rebuild config.h.in
731autoconf:
732 (cd $(srcdir); autoconf)
733 (cd $(srcdir); autoheader)
734
735# Create a tags file for vi
736tags::
737 cd $(srcdir); \
738 ctags -w -t Include/*.h; \
739 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
740 done; \
741 sort tags -o tags
742
743# Create a tags file for GNU Emacs
744TAGS::
745 cd $(srcdir); \
746 etags Include/*.h; \
747 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
748
749# Sanitation targets -- clean leaves libraries, executables and tags
750# files, which clobber removes those as well
751
752clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000753 find . -name '*.o' -exec rm -f {} ';'
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000754 find . -name '*.s[ol]' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000755 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000756
757clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000758 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Guido van Rossumcd0ed972001-04-14 17:57:07 +0000759 tags TAGS \
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000760 config.cache config.log config.h Modules/config.c
Neil Schemenauere0d43572001-02-03 17:16:29 +0000761 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000762
763# Make things extra clean, before making a distribution:
764# remove all generated files, even Makefile[.pre]
765distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000766 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000767 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000768 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
769 -o -name '[@,#]*' -o -name '*.old' \
770 -o -name '*.orig' -o -name '*.rej' \
771 -o -name '*.bak' ')' \
772 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000773
774# Check for smelly exported symbols (not starting with Py/_Py)
775smelly: all
776 nm -p $(LIBRARY) | \
777 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
778
779# Find files with funny names
780funny:
781 find $(DISTDIRS) -type d \
782 -o -name '*.[chs]' \
783 -o -name '*.py' \
784 -o -name '*.doc' \
785 -o -name '*.sty' \
786 -o -name '*.bib' \
787 -o -name '*.dat' \
788 -o -name '*.el' \
789 -o -name '*.fd' \
790 -o -name '*.in' \
791 -o -name '*.tex' \
792 -o -name '*,[vpt]' \
793 -o -name 'Setup' \
794 -o -name 'Setup.*' \
795 -o -name README \
796 -o -name Makefile \
797 -o -name ChangeLog \
798 -o -name Repository \
799 -o -name Root \
800 -o -name Entries \
801 -o -name Tag \
802 -o -name tags \
803 -o -name TAGS \
804 -o -name .cvsignore \
805 -o -name MANIFEST \
806 -o -print
807
808# IF YOU PUT ANYTHING HERE IT WILL GO AWAY