blob: 61c31da7d22333d8429225a7c62facf6d74ae504 [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@
46INSTALL_DATA= @INSTALL_DATA@
47# Shared libraries must be installed with executable mode on some systems;
48# rather than figuring out exactly which, we always give them executable mode.
49# Also, making them read-only seems to be a good idea...
50INSTALL_SHARED= ${INSTALL} -m 555
51
52MAKESETUP= $(srcdir)/Modules/makesetup
53
54# Compiler options
55OPT= @OPT@
56DEFS= @DEFS@
57CFLAGS= $(OPT) -I. -I$(srcdir)/Include $(DEFS)
58LDFLAGS= @LDFLAGS@
59LDLAST= @LDLAST@
60SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000061CCSHARED= @CCSHARED@
62LINKFORSHARED= @LINKFORSHARED@
63# Extra C flags added for building the interpreter object files.
64CFLAGSFORSHARED=@CFLAGSFORSHARED@
65# C flags used for building the interpreter object files
66PY_CFLAGS= $(CFLAGS) $(CFLAGSFORSHARED)
67
Neil Schemenauer85515ad2001-01-24 17:11:43 +000068
69# Machine-dependent subdirectories
70MACHDEP= @MACHDEP@
71
72# Install prefix for architecture-independent files
73prefix= @prefix@
74
75# Install prefix for architecture-dependent files
76exec_prefix= @exec_prefix@
77
78# Expanded directories
79BINDIR= $(exec_prefix)/bin
80LIBDIR= $(exec_prefix)/lib
81MANDIR= $(prefix)/man
82INCLUDEDIR= $(prefix)/include
83CONFINCLUDEDIR= $(exec_prefix)/include
84SCRIPTDIR= $(prefix)/lib
85
86# Detailed destination directories
87BINLIBDEST= $(LIBDIR)/python$(VERSION)
88LIBDEST= $(SCRIPTDIR)/python$(VERSION)
89INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
90CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
91LIBP= $(LIBDIR)/python$(VERSION)
92
93# Symbols used for using shared libraries
94SO= @SO@
95LDSHARED= @LDSHARED@
Neil Schemenauer75e33892001-02-16 03:36:53 +000096BLDSHARED= @BLDSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +000097DESTSHARED= $(BINLIBDEST)/lib-dynload
98
99# Executable suffix (.exe on Windows and Mac OS X)
100EXEEXT= @EXEEXT@
101
102# Modes for directories, executables and data files created by the
103# install process. Default to user-only-writable for all file types.
104DIRMODE= 755
105EXEMODE= 755
106FILEMODE= 644
107
108# --with-PACKAGE options for configure script
109# e.g. --with-readline --with-svr5 --with-solaris --with-thread
110# (see README for an explanation)
111WITH=
112
113
114# Subdirectories with code
115SRCDIRS= @SRCDIRS@
116
117# Other subdirectories
118SUBDIRSTOO= Include Lib Misc Demo
119
120# Files and directories to be distributed
121CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.pre.in
122DISTFILES= README ChangeLog $(CONFIGFILES)
123DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
124DIST= $(DISTFILES) $(DISTDIRS)
125
126
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000127LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000128LDLIBRARY= @LDLIBRARY@
129DLLLIBRARY= @DLLLIBRARY@
130
131
132LIBS= @LIBS@
133LIBM= @LIBM@
134LIBC= @LIBC@
135SYSLIBS= $(LIBM) $(LIBC)
136
137MAINOBJ= @MAINOBJ@
138LIBOBJS= @LIBOBJS@
139DLINCLDIR= @DLINCLDIR@
140DYNLOADFILE= @DYNLOADFILE@
141
142PYTHON= python$(EXEEXT)
143
144# === Definitions added by makesetup ===
145
146
147##########################################################################
148# Modules
149MODULE_OBJS= \
150 Modules/config.o \
151 Modules/getpath.o \
Neil Schemenauer18821822001-01-27 21:42:38 +0000152 Modules/main.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000153
154# Used of signalmodule.o is not available
155SIGNAL_OBJS= @SIGNAL_OBJS@
156
157
158##########################################################################
159# Grammar
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000160GRAMMAR_H= $(srcdir)/Include/graminit.h
161GRAMMAR_C= $(srcdir)/Python/graminit.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000162GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
163
164
165##########################################################################
166# Parser
167PGEN= Parser/pgen$(EXEEXT)
168
169POBJS= \
170 Parser/acceler.o \
171 Parser/grammar1.o \
172 Parser/listnode.o \
173 Parser/node.o \
174 Parser/parser.o \
175 Parser/parsetok.o \
176 Parser/tokenizer.o \
177 Parser/bitset.o \
178 Parser/metagrammar.o
179
180PARSER_OBJS= $(POBJS) Parser/myreadline.o
181
182PGOBJS= \
183 Parser/firstsets.o \
184 Parser/grammar.o \
185 Parser/pgen.o \
186 Parser/printgrammar.o \
187 Parser/pgenmain.o
188
189PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
190
191
192##########################################################################
193# Python
194PYTHON_OBJS= \
195 Python/bltinmodule.o \
196 Python/exceptions.o \
197 Python/ceval.o \
198 Python/compile.o \
199 Python/codecs.o \
200 Python/errors.o \
201 Python/frozen.o \
202 Python/frozenmain.o \
203 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
274$(PYTHON): $(MAINOBJ) $(LDLIBRARY)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000275 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ $(MAINOBJ) \
276 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
277
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000278platform: $(PYTHON)
279 ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
280
281
282# Build the shared modules
283sharedmods: $(PYTHON)
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000284 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000285
Neil Schemenauer18821822001-01-27 21:42:38 +0000286# buildno should really depend on something like LIBRARY_SRC
287buildno: $(PARSER_OBJS) \
288 $(OBJECT_OBJS) \
289 $(PYTHON_OBJS) \
290 $(MODULE_OBJS) \
291 $(SIGNAL_OBJS) \
292 $(MODOBJS) \
293 $(srcdir)/Modules/getbuildinfo.c
294 if test -f buildno; then \
295 expr `cat buildno` + 1 >buildno1; \
296 mv -f buildno1 buildno; \
297 else echo 1 >buildno; fi
298
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000299# Build static library
300$(LIBRARY): $(LIBRARY_OBJS)
301 -rm -f $@
302 # avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer18821822001-01-27 21:42:38 +0000303 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000304 $(AR) cr $@ $(PARSER_OBJS)
305 $(AR) cr $@ $(OBJECT_OBJS)
306 $(AR) cr $@ $(PYTHON_OBJS)
307 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
308 $(AR) cr $@ $(MODOBJS)
309 $(RANLIB) $@
310
311# This rule is only here for DG/UX and BeOS!!!
312libpython$(VERSION).so: $(LIBRARY)
313 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
314 *dgux*) \
315 test -d dgux || mkdir dgux; \
316 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
317 /bin/rm -rf ./dgux \
318 ;; \
319 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000320 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000321 ;; \
322 esac
323
324# This rule is here for OPENSTEP/Rhapsody/MacOSX
325libpython$(VERSION).dylib: $(LIBRARY)
326 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
327 -framework System @LIBTOOL_CRUFT@
328
329# This rule builds the Cygwin Python DLL
330libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
331 dlltool --export-all --output-def $@ $^
332 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
333 $(LIBS) $(MODLIBS) $(SYSLIBS)
334
335
336oldsharedmods: $(SHAREDMODS)
337
338
339Makefile Modules/config.c: Makefile.pre \
340 $(srcdir)/Modules/config.c.in \
341 $(MAKESETUP) \
342 Modules/Setup.config \
343 Modules/Setup \
344 Modules/Setup.local
345 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
346 -s Modules \
347 Modules/Setup.config \
348 Modules/Setup.local \
349 Modules/Setup
350 @mv config.c Modules
351 @echo "The Makefile was updated, you may need to re-run make."
352
353
354Modules/Setup: $(srcdir)/Modules/Setup.dist
355 @if test -f Modules/Setup; then \
356 echo "-----------------------------------------------"; \
357 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
358 echo "check to make sure you have all the updates you"; \
359 echo "need in your Modules/Setup file."; \
360 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000361 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000362
363############################################################################
364# Special rules for object files
365
366Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000367 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000368
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000369Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000370 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
371 -DPREFIX='"$(prefix)"' \
372 -DEXEC_PREFIX='"$(exec_prefix)"' \
373 -DVERSION='"$(VERSION)"' \
374 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000375 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000376
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000377Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
378 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000379
380
381$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000382 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000383
384$(PGEN): $(PGENOBJS)
385 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
386
387Parser/grammar.o: $(srcdir)/Parser/grammar.c \
388 $(srcdir)/Parser/assert.h \
389 $(srcdir)/Include/token.h \
390 $(srcdir)/Include/grammar.h
391Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
392
393
Neil Schemenauer40417742001-02-27 02:45:36 +0000394Python/compile.o Python/symtable.o: $(GRAMMAR_H)
395
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000396Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000397 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000398
399Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000400 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000401
402
403Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
404 $(srcdir)/Objects/unicodetype_db.h
405
406
407############################################################################
408# Header files
409
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000410PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000411 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000412 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000413 Include/patchlevel.h \
414 Include/pyport.h \
415 Include/pymem.h \
416 Include/object.h \
417 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000418 Include/compile.h \
419 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000420 Include/pydebug.h \
421 Include/unicodeobject.h \
422 Include/intobject.h \
423 Include/longobject.h \
424 Include/floatobject.h \
425 Include/complexobject.h \
426 Include/rangeobject.h \
427 Include/stringobject.h \
428 Include/bufferobject.h \
429 Include/tupleobject.h \
430 Include/listobject.h \
431 Include/dictobject.h \
432 Include/methodobject.h \
433 Include/moduleobject.h \
434 Include/funcobject.h \
435 Include/classobject.h \
436 Include/fileobject.h \
437 Include/cobject.h \
438 Include/traceback.h \
439 Include/sliceobject.h \
440 Include/codecs.h \
441 Include/pyerrors.h \
442 Include/pystate.h \
443 Include/modsupport.h \
444 Include/ceval.h \
445 Include/pythonrun.h \
446 Include/sysmodule.h \
447 Include/intrcheck.h \
448 Include/import.h \
449 Include/abstract.h \
450 Include/pyfpe.h
451
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000452$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
453
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000454
455######################################################################
456
457# Test the interpreter (twice, once without .pyc files, once with)
458TESTOPTS= -l
459TESTPROG= $(srcdir)/Lib/test/regrtest.py
460TESTPYTHON= ./$(PYTHON) -tt
461test: all platform
462 -rm -f $(srcdir)/Lib/test/*.py[co]
463 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
464 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
465
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000466QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000467 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000468 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000469quicktest: all platform
470 -rm -f $(srcdir)/Lib/test/*.py[co]
471 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
472 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
473
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000474# Install everything
475install: altinstall bininstall maninstall
476
477# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000478altinstall: altbininstall libinstall inclinstall libainstall \
479 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000480
481# Install shared libraries enabled by Setup
482DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
483
484oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
485 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000486 if test $$i != X; then \
487 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
488 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
489 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000490 done
491
492$(DESTSHARED):
493 @for i in $(DESTDIRS); \
494 do \
495 if test ! -d $$i; then \
496 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000497 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000498 else true; \
499 fi; \
500 done
501
502
503# Install the interpreter (by creating a hard link to python$(VERSION))
504bininstall: altbininstall
505 -if test -f $(BINDIR)/$(PYTHON); \
506 then rm -f $(BINDIR)/$(PYTHON); \
507 else true; \
508 fi
509 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
510
511# Install the interpreter with $(VERSION) affixed
512# This goes into $(exec_prefix)
513altbininstall: $(PYTHON)
514 @for i in $(BINDIR); \
515 do \
516 if test ! -d $$i; then \
517 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000518 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000519 else true; \
520 fi; \
521 done
522 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
523 if test -f libpython$(VERSION).so; then \
524 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
525 else true; \
526 fi
527 if test -f "$(DLLLIBRARY)"; then \
528 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
529 else true; \
530 fi
531
532# Install the manual page
533maninstall:
534 @for i in $(MANDIR) $(MANDIR)/man1; \
535 do \
536 if test ! -d $$i; then \
537 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000538 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000539 else true; \
540 fi; \
541 done
542 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
543 $(MANDIR)/man1/python.1
544
545# Install the library
546PLATDIR= plat-$(MACHDEP)
547MACHDEPS= $(PLATDIR)
548XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
549LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
550 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
551libinstall: python $(srcdir)/Lib/$(PLATDIR)
552 @for i in $(SCRIPTDIR) $(LIBDEST); \
553 do \
554 if test ! -d $$i; then \
555 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000556 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000557 else true; \
558 fi; \
559 done
560 @for d in $(LIBSUBDIRS); \
561 do \
562 a=$(srcdir)/Lib/$$d; \
563 if test ! -d $$a; then continue; else true; fi; \
564 b=$(LIBDEST)/$$d; \
565 if test ! -d $$b; then \
566 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000567 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000568 else true; \
569 fi; \
570 done
571 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
572 do \
573 if test -x $$i; then \
574 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
575 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
576 else \
577 $(INSTALL_DATA) $$i $(LIBDEST); \
578 echo $(INSTALL_DATA) $$i $(LIBDEST); \
579 fi; \
580 done
581 @for d in $(LIBSUBDIRS); \
582 do \
583 a=$(srcdir)/Lib/$$d; \
584 if test ! -d $$a; then continue; else true; fi; \
585 b=$(LIBDEST)/$$d; \
586 for i in $$a/*; \
587 do \
588 case $$i in \
589 *CVS) ;; \
590 *.py[co]) ;; \
591 *.orig) ;; \
592 *~) ;; \
593 *) \
594 if test -d $$i; then continue; fi; \
595 if test -x $$i; then \
596 echo $(INSTALL_PROGRAM) $$i $$b; \
597 $(INSTALL_PROGRAM) $$i $$b; \
598 else \
599 echo $(INSTALL_DATA) $$i $$b; \
600 $(INSTALL_DATA) $$i $$b; \
601 fi;; \
602 esac; \
603 done; \
604 done
605 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
606 PYTHONPATH=$(LIBDEST) \
607 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
608 PYTHONPATH=$(LIBDEST) \
609 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
610
611# Create the PLATDIR source directory, if one wasn't distributed..
612$(srcdir)/Lib/$(PLATDIR):
613 mkdir $(srcdir)/Lib/$(PLATDIR)
614 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
615 export PATH; PATH="`pwd`:$$PATH"; \
616 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
617 export EXEEXT; EXEEXT="$(EXEEXT)"; \
618 cd $(srcdir)/Lib/$(PLATDIR); ./regen
619
620# Install the include files
621INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
622inclinstall:
623 @for i in $(INCLDIRSTOMAKE); \
624 do \
625 if test ! -d $$i; then \
626 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000627 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000628 else true; \
629 fi; \
630 done
631 @for i in $(srcdir)/Include/*.h; \
632 do \
633 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
634 $(INSTALL_DATA) $$i $(INCLUDEPY); \
635 done
636 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
637
638# Install the library and miscellaneous stuff needed for extending/embedding
639# This goes into $(exec_prefix)
640LIBPL= $(LIBP)/config
641libainstall: all
642 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
643 do \
644 if test ! -d $$i; then \
645 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000646 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000647 else true; \
648 fi; \
649 done
650 @if test -d $(LDLIBRARY); then :; else \
651 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
652 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
653 fi
654 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
655 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
656 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
657 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
658 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
659 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
660 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
661 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
662 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
663 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
664 @if [ -s Modules/python.exp -a \
665 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
666 echo; echo "Installing support files for building shared extension modules on AIX:"; \
667 $(INSTALL_DATA) Modules/python.exp \
668 $(LIBPL)/python.exp; \
669 echo; echo "$(LIBPL)/python.exp"; \
670 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
671 $(LIBPL)/makexp_aix; \
672 echo "$(LIBPL)/makexp_aix"; \
673 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
674 $(LIBPL)/ld_so_aix; \
675 echo "$(LIBPL)/ld_so_aix"; \
676 echo; echo "See Misc/AIX-NOTES for details."; \
677 else true; \
678 fi
679 @case "$(MACHDEP)" in beos*) \
680 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000681 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000682 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000683 $(INSTALL_PROGRAM) Modules/ar_beos $(LIBPL)/ar_beos; \
684 echo "$(LIBPL)/ar_beos"; \
685 $(INSTALL_PROGRAM) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
686 echo "$(LIBPL)/ld_so_beos"; \
687 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000688 ;; \
689 esac
690
691# Install the dynamically loadable modules
692# This goes into $(exec_prefix)
693sharedinstall:
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000694 PYTHONPATH= ./python$(EXEEXT) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000695 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000696
697# Build the toplevel Makefile
698Makefile.pre: Makefile.pre.in config.status
699 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
700 $(MAKE) -f Makefile.pre Makefile
701
702# Run the configure script. If config.status already exists,
703# call it with the --recheck argument, which reruns configure with the
704# same options as it was run last time; otherwise run the configure
705# script with options taken from the $(WITH) variable
706config.status: $(srcdir)/configure
707 if test -f config.status; \
708 then $(SHELL) config.status --recheck; \
709 $(SHELL) config.status; \
710 else $(SHELL) $(srcdir)/configure $(WITH); \
711 fi
712
713.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
714
715# Some make's put the object file in the current directory
716.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000717 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000718
719# Rerun configure with the same options as it was run last time,
720# provided the config.status script exists
721recheck:
722 $(SHELL) config.status --recheck
723 $(SHELL) config.status
724
725# Rebuild the configure script from configure.in; also rebuild config.h.in
726autoconf:
727 (cd $(srcdir); autoconf)
728 (cd $(srcdir); autoheader)
729
730# Create a tags file for vi
731tags::
732 cd $(srcdir); \
733 ctags -w -t Include/*.h; \
734 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
735 done; \
736 sort tags -o tags
737
738# Create a tags file for GNU Emacs
739TAGS::
740 cd $(srcdir); \
741 etags Include/*.h; \
742 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
743
744# Sanitation targets -- clean leaves libraries, executables and tags
745# files, which clobber removes those as well
746
747clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000748 find . -name '*.o' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000749 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000750
751clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000752 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
753 Modules/*.so Modules/*.sl tags TAGS \
754 config.cache config.log config.h Modules/config.c
Neil Schemenauere0d43572001-02-03 17:16:29 +0000755 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000756
757# Make things extra clean, before making a distribution:
758# remove all generated files, even Makefile[.pre]
759distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000760 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000761 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000762 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
763 -o -name '[@,#]*' -o -name '*.old' \
764 -o -name '*.orig' -o -name '*.rej' \
765 -o -name '*.bak' ')' \
766 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000767
768# Check for smelly exported symbols (not starting with Py/_Py)
769smelly: all
770 nm -p $(LIBRARY) | \
771 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
772
773# Find files with funny names
774funny:
775 find $(DISTDIRS) -type d \
776 -o -name '*.[chs]' \
777 -o -name '*.py' \
778 -o -name '*.doc' \
779 -o -name '*.sty' \
780 -o -name '*.bib' \
781 -o -name '*.dat' \
782 -o -name '*.el' \
783 -o -name '*.fd' \
784 -o -name '*.in' \
785 -o -name '*.tex' \
786 -o -name '*,[vpt]' \
787 -o -name 'Setup' \
788 -o -name 'Setup.*' \
789 -o -name README \
790 -o -name Makefile \
791 -o -name ChangeLog \
792 -o -name Repository \
793 -o -name Root \
794 -o -name Entries \
795 -o -name Tag \
796 -o -name tags \
797 -o -name TAGS \
798 -o -name .cvsignore \
799 -o -name MANIFEST \
800 -o -print
801
802# IF YOU PUT ANYTHING HERE IT WILL GO AWAY