blob: f8a0ae2d6c25cab538c7984b69cbc8de09790a7f [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
Neil Schemenauera35c6882001-02-27 04:45:05 +0000402Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000403
404Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
405 $(srcdir)/Objects/unicodetype_db.h
406
407
408############################################################################
409# Header files
410
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000411PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000412 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000413 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000414 Include/patchlevel.h \
415 Include/pyport.h \
416 Include/pymem.h \
417 Include/object.h \
418 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000419 Include/compile.h \
420 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000421 Include/pydebug.h \
422 Include/unicodeobject.h \
423 Include/intobject.h \
424 Include/longobject.h \
425 Include/floatobject.h \
426 Include/complexobject.h \
427 Include/rangeobject.h \
428 Include/stringobject.h \
429 Include/bufferobject.h \
430 Include/tupleobject.h \
431 Include/listobject.h \
432 Include/dictobject.h \
433 Include/methodobject.h \
434 Include/moduleobject.h \
435 Include/funcobject.h \
436 Include/classobject.h \
437 Include/fileobject.h \
438 Include/cobject.h \
439 Include/traceback.h \
440 Include/sliceobject.h \
441 Include/codecs.h \
442 Include/pyerrors.h \
443 Include/pystate.h \
444 Include/modsupport.h \
445 Include/ceval.h \
446 Include/pythonrun.h \
447 Include/sysmodule.h \
448 Include/intrcheck.h \
449 Include/import.h \
450 Include/abstract.h \
451 Include/pyfpe.h
452
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000453$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
454
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000455
456######################################################################
457
458# Test the interpreter (twice, once without .pyc files, once with)
459TESTOPTS= -l
460TESTPROG= $(srcdir)/Lib/test/regrtest.py
461TESTPYTHON= ./$(PYTHON) -tt
462test: all platform
463 -rm -f $(srcdir)/Lib/test/*.py[co]
464 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
465 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
466
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000467QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000468 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000469 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000470quicktest: all platform
471 -rm -f $(srcdir)/Lib/test/*.py[co]
472 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
473 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
474
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000475# Install everything
476install: altinstall bininstall maninstall
477
478# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000479altinstall: altbininstall libinstall inclinstall libainstall \
480 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000481
482# Install shared libraries enabled by Setup
483DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
484
485oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
486 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000487 if test $$i != X; then \
488 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
489 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
490 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000491 done
492
493$(DESTSHARED):
494 @for i in $(DESTDIRS); \
495 do \
496 if test ! -d $$i; then \
497 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000498 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000499 else true; \
500 fi; \
501 done
502
503
504# Install the interpreter (by creating a hard link to python$(VERSION))
505bininstall: altbininstall
506 -if test -f $(BINDIR)/$(PYTHON); \
507 then rm -f $(BINDIR)/$(PYTHON); \
508 else true; \
509 fi
510 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
511
512# Install the interpreter with $(VERSION) affixed
513# This goes into $(exec_prefix)
514altbininstall: $(PYTHON)
515 @for i in $(BINDIR); \
516 do \
517 if test ! -d $$i; then \
518 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000519 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000520 else true; \
521 fi; \
522 done
523 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
524 if test -f libpython$(VERSION).so; then \
525 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
526 else true; \
527 fi
528 if test -f "$(DLLLIBRARY)"; then \
529 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
530 else true; \
531 fi
532
533# Install the manual page
534maninstall:
535 @for i in $(MANDIR) $(MANDIR)/man1; \
536 do \
537 if test ! -d $$i; then \
538 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000539 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000540 else true; \
541 fi; \
542 done
543 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
544 $(MANDIR)/man1/python.1
545
546# Install the library
547PLATDIR= plat-$(MACHDEP)
548MACHDEPS= $(PLATDIR)
549XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
550LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
551 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
552libinstall: python $(srcdir)/Lib/$(PLATDIR)
553 @for i in $(SCRIPTDIR) $(LIBDEST); \
554 do \
555 if test ! -d $$i; then \
556 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000557 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000558 else true; \
559 fi; \
560 done
561 @for d in $(LIBSUBDIRS); \
562 do \
563 a=$(srcdir)/Lib/$$d; \
564 if test ! -d $$a; then continue; else true; fi; \
565 b=$(LIBDEST)/$$d; \
566 if test ! -d $$b; then \
567 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000568 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000569 else true; \
570 fi; \
571 done
572 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
573 do \
574 if test -x $$i; then \
575 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
576 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
577 else \
578 $(INSTALL_DATA) $$i $(LIBDEST); \
579 echo $(INSTALL_DATA) $$i $(LIBDEST); \
580 fi; \
581 done
582 @for d in $(LIBSUBDIRS); \
583 do \
584 a=$(srcdir)/Lib/$$d; \
585 if test ! -d $$a; then continue; else true; fi; \
586 b=$(LIBDEST)/$$d; \
587 for i in $$a/*; \
588 do \
589 case $$i in \
590 *CVS) ;; \
591 *.py[co]) ;; \
592 *.orig) ;; \
593 *~) ;; \
594 *) \
595 if test -d $$i; then continue; fi; \
596 if test -x $$i; then \
597 echo $(INSTALL_PROGRAM) $$i $$b; \
598 $(INSTALL_PROGRAM) $$i $$b; \
599 else \
600 echo $(INSTALL_DATA) $$i $$b; \
601 $(INSTALL_DATA) $$i $$b; \
602 fi;; \
603 esac; \
604 done; \
605 done
606 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
607 PYTHONPATH=$(LIBDEST) \
608 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
609 PYTHONPATH=$(LIBDEST) \
610 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
611
612# Create the PLATDIR source directory, if one wasn't distributed..
613$(srcdir)/Lib/$(PLATDIR):
614 mkdir $(srcdir)/Lib/$(PLATDIR)
615 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
616 export PATH; PATH="`pwd`:$$PATH"; \
617 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
618 export EXEEXT; EXEEXT="$(EXEEXT)"; \
619 cd $(srcdir)/Lib/$(PLATDIR); ./regen
620
621# Install the include files
622INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
623inclinstall:
624 @for i in $(INCLDIRSTOMAKE); \
625 do \
626 if test ! -d $$i; then \
627 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000628 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000629 else true; \
630 fi; \
631 done
632 @for i in $(srcdir)/Include/*.h; \
633 do \
634 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
635 $(INSTALL_DATA) $$i $(INCLUDEPY); \
636 done
637 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
638
639# Install the library and miscellaneous stuff needed for extending/embedding
640# This goes into $(exec_prefix)
641LIBPL= $(LIBP)/config
642libainstall: all
643 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
644 do \
645 if test ! -d $$i; then \
646 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000647 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000648 else true; \
649 fi; \
650 done
651 @if test -d $(LDLIBRARY); then :; else \
652 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
653 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
654 fi
655 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
656 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
657 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
658 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
659 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
660 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
661 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
662 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
663 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
664 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
665 @if [ -s Modules/python.exp -a \
666 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
667 echo; echo "Installing support files for building shared extension modules on AIX:"; \
668 $(INSTALL_DATA) Modules/python.exp \
669 $(LIBPL)/python.exp; \
670 echo; echo "$(LIBPL)/python.exp"; \
671 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
672 $(LIBPL)/makexp_aix; \
673 echo "$(LIBPL)/makexp_aix"; \
674 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
675 $(LIBPL)/ld_so_aix; \
676 echo "$(LIBPL)/ld_so_aix"; \
677 echo; echo "See Misc/AIX-NOTES for details."; \
678 else true; \
679 fi
680 @case "$(MACHDEP)" in beos*) \
681 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000682 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000683 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000684 $(INSTALL_PROGRAM) Modules/ar_beos $(LIBPL)/ar_beos; \
685 echo "$(LIBPL)/ar_beos"; \
686 $(INSTALL_PROGRAM) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
687 echo "$(LIBPL)/ld_so_beos"; \
688 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000689 ;; \
690 esac
691
692# Install the dynamically loadable modules
693# This goes into $(exec_prefix)
694sharedinstall:
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000695 PYTHONPATH= ./python$(EXEEXT) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000696 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000697
698# Build the toplevel Makefile
699Makefile.pre: Makefile.pre.in config.status
700 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
701 $(MAKE) -f Makefile.pre Makefile
702
703# Run the configure script. If config.status already exists,
704# call it with the --recheck argument, which reruns configure with the
705# same options as it was run last time; otherwise run the configure
706# script with options taken from the $(WITH) variable
707config.status: $(srcdir)/configure
708 if test -f config.status; \
709 then $(SHELL) config.status --recheck; \
710 $(SHELL) config.status; \
711 else $(SHELL) $(srcdir)/configure $(WITH); \
712 fi
713
714.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
715
716# Some make's put the object file in the current directory
717.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000718 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000719
720# Rerun configure with the same options as it was run last time,
721# provided the config.status script exists
722recheck:
723 $(SHELL) config.status --recheck
724 $(SHELL) config.status
725
726# Rebuild the configure script from configure.in; also rebuild config.h.in
727autoconf:
728 (cd $(srcdir); autoconf)
729 (cd $(srcdir); autoheader)
730
731# Create a tags file for vi
732tags::
733 cd $(srcdir); \
734 ctags -w -t Include/*.h; \
735 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
736 done; \
737 sort tags -o tags
738
739# Create a tags file for GNU Emacs
740TAGS::
741 cd $(srcdir); \
742 etags Include/*.h; \
743 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
744
745# Sanitation targets -- clean leaves libraries, executables and tags
746# files, which clobber removes those as well
747
748clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000749 find . -name '*.o' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000750 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000751
752clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000753 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
754 Modules/*.so Modules/*.sl tags TAGS \
755 config.cache config.log config.h Modules/config.c
Neil Schemenauere0d43572001-02-03 17:16:29 +0000756 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000757
758# Make things extra clean, before making a distribution:
759# remove all generated files, even Makefile[.pre]
760distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000761 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000762 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000763 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
764 -o -name '[@,#]*' -o -name '*.old' \
765 -o -name '*.orig' -o -name '*.rej' \
766 -o -name '*.bak' ')' \
767 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000768
769# Check for smelly exported symbols (not starting with Py/_Py)
770smelly: all
771 nm -p $(LIBRARY) | \
772 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
773
774# Find files with funny names
775funny:
776 find $(DISTDIRS) -type d \
777 -o -name '*.[chs]' \
778 -o -name '*.py' \
779 -o -name '*.doc' \
780 -o -name '*.sty' \
781 -o -name '*.bib' \
782 -o -name '*.dat' \
783 -o -name '*.el' \
784 -o -name '*.fd' \
785 -o -name '*.in' \
786 -o -name '*.tex' \
787 -o -name '*,[vpt]' \
788 -o -name 'Setup' \
789 -o -name 'Setup.*' \
790 -o -name README \
791 -o -name Makefile \
792 -o -name ChangeLog \
793 -o -name Repository \
794 -o -name Root \
795 -o -name Entries \
796 -o -name Tag \
797 -o -name tags \
798 -o -name TAGS \
799 -o -name .cvsignore \
800 -o -name MANIFEST \
801 -o -print
802
803# IF YOU PUT ANYTHING HERE IT WILL GO AWAY