blob: 846f01999b7f154f23b4fe2abc0f67328738c028 [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
16# install". This changes the install procedure so it installs the
17# Python binary as "python<version>". The libraries and include files
18# are always installed in a subdirectory called "python<version>".
19# "make altinstall" does not install the manual page. If you want to
20# make this installation the "official" installation but want to keep
21# the old binary around "just in case", rename the installed python
22# binary to "python<oldversion>" before running "make install".
23# (This only works between different versions, e.g. 1.3 and 1.4 --
24# different betas of the same version will overwrite each other in
25# installation unless you override the VERSION Make variable.)
26#
27# In fact, "make install" or "make bininstall" installs the binary
28# as python<version> and makes a hard link to python, so when
29# installing a new version in the future, nothing of the current
30# version will be lost (except for the man page).
31#
32# See also the section "Build instructions" in the README file.
33
34# === Variables set by makesetup ===
35
36MODOBJS= _MODOBJS_
37MODLIBS= _MODLIBS_
38
39# === Variables set by configure
40VERSION= @VERSION@
41srcdir= @srcdir@
42VPATH= @srcdir@
43
44CC= @CC@
45CXX= @CXX@
46LINKCC= @LINKCC@
47AR= @AR@
48RANLIB= @RANLIB@
49
50# Shell used by make (some versions default to the login shell, which is bad)
51SHELL= /bin/sh
52
53# Use this to make a link between python$(VERSION) and python in $(BINDIR)
54LN= @LN@
55
56# Portable install script (configure doesn't always guess right)
57INSTALL= @INSTALL@
58INSTALL_PROGRAM=@INSTALL_PROGRAM@
59INSTALL_DATA= @INSTALL_DATA@
60# Shared libraries must be installed with executable mode on some systems;
61# rather than figuring out exactly which, we always give them executable mode.
62# Also, making them read-only seems to be a good idea...
63INSTALL_SHARED= ${INSTALL} -m 555
64
65MAKESETUP= $(srcdir)/Modules/makesetup
66
67# Compiler options
68OPT= @OPT@
69DEFS= @DEFS@
70CFLAGS= $(OPT) -I. -I$(srcdir)/Include $(DEFS)
71LDFLAGS= @LDFLAGS@
72LDLAST= @LDLAST@
73SGI_ABI= @SGI_ABI@
Neil Schemenauer7ac954b2001-01-26 16:14:41 +000074CCSHARED= @CCSHARED@
75LINKFORSHARED= @LINKFORSHARED@
76# Extra C flags added for building the interpreter object files.
77CFLAGSFORSHARED=@CFLAGSFORSHARED@
78# C flags used for building the interpreter object files
79PY_CFLAGS= $(CFLAGS) $(CFLAGSFORSHARED)
80
Neil Schemenauer85515ad2001-01-24 17:11:43 +000081
82# Machine-dependent subdirectories
83MACHDEP= @MACHDEP@
84
85# Install prefix for architecture-independent files
86prefix= @prefix@
87
88# Install prefix for architecture-dependent files
89exec_prefix= @exec_prefix@
90
91# Expanded directories
92BINDIR= $(exec_prefix)/bin
93LIBDIR= $(exec_prefix)/lib
94MANDIR= $(prefix)/man
95INCLUDEDIR= $(prefix)/include
96CONFINCLUDEDIR= $(exec_prefix)/include
97SCRIPTDIR= $(prefix)/lib
98
99# Detailed destination directories
100BINLIBDEST= $(LIBDIR)/python$(VERSION)
101LIBDEST= $(SCRIPTDIR)/python$(VERSION)
102INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
103CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
104LIBP= $(LIBDIR)/python$(VERSION)
105
106# Symbols used for using shared libraries
107SO= @SO@
108LDSHARED= @LDSHARED@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000109DESTSHARED= $(BINLIBDEST)/lib-dynload
110
111# Executable suffix (.exe on Windows and Mac OS X)
112EXEEXT= @EXEEXT@
113
114# Modes for directories, executables and data files created by the
115# install process. Default to user-only-writable for all file types.
116DIRMODE= 755
117EXEMODE= 755
118FILEMODE= 644
119
120# --with-PACKAGE options for configure script
121# e.g. --with-readline --with-svr5 --with-solaris --with-thread
122# (see README for an explanation)
123WITH=
124
125
126# Subdirectories with code
127SRCDIRS= @SRCDIRS@
128
129# Other subdirectories
130SUBDIRSTOO= Include Lib Misc Demo
131
132# Files and directories to be distributed
133CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.pre.in
134DISTFILES= README ChangeLog $(CONFIGFILES)
135DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
136DIST= $(DISTFILES) $(DISTDIRS)
137
138
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000139LIBRARY= @LIBRARY@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000140LDLIBRARY= @LDLIBRARY@
141DLLLIBRARY= @DLLLIBRARY@
142
143
144LIBS= @LIBS@
145LIBM= @LIBM@
146LIBC= @LIBC@
147SYSLIBS= $(LIBM) $(LIBC)
148
149MAINOBJ= @MAINOBJ@
150LIBOBJS= @LIBOBJS@
151DLINCLDIR= @DLINCLDIR@
152DYNLOADFILE= @DYNLOADFILE@
153
154PYTHON= python$(EXEEXT)
155
156# === Definitions added by makesetup ===
157
158
159##########################################################################
160# Modules
161MODULE_OBJS= \
162 Modules/config.o \
163 Modules/getpath.o \
Neil Schemenauer18821822001-01-27 21:42:38 +0000164 Modules/main.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000165
166# Used of signalmodule.o is not available
167SIGNAL_OBJS= @SIGNAL_OBJS@
168
169
170##########################################################################
171# Grammar
172GRAMMAR_H= $(srcdir)/Include/graminit.h
173GRAMMAR_C= $(srcdir)/Python/graminit.c
174GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
175
176
177##########################################################################
178# Parser
179PGEN= Parser/pgen$(EXEEXT)
180
181POBJS= \
182 Parser/acceler.o \
183 Parser/grammar1.o \
184 Parser/listnode.o \
185 Parser/node.o \
186 Parser/parser.o \
187 Parser/parsetok.o \
188 Parser/tokenizer.o \
189 Parser/bitset.o \
190 Parser/metagrammar.o
191
192PARSER_OBJS= $(POBJS) Parser/myreadline.o
193
194PGOBJS= \
195 Parser/firstsets.o \
196 Parser/grammar.o \
197 Parser/pgen.o \
198 Parser/printgrammar.o \
199 Parser/pgenmain.o
200
201PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
202
203
204##########################################################################
205# Python
206PYTHON_OBJS= \
207 Python/bltinmodule.o \
208 Python/exceptions.o \
209 Python/ceval.o \
210 Python/compile.o \
211 Python/codecs.o \
212 Python/errors.o \
213 Python/frozen.o \
214 Python/frozenmain.o \
215 Python/getargs.o \
216 Python/getcompiler.o \
217 Python/getcopyright.o \
218 Python/getmtime.o \
219 Python/getplatform.o \
220 Python/getversion.o \
221 Python/graminit.o \
222 Python/import.o \
223 Python/importdl.o \
224 Python/marshal.o \
225 Python/modsupport.o \
226 Python/mystrtoul.o \
227 Python/pyfpe.o \
228 Python/pystate.o \
229 Python/pythonrun.o \
230 Python/structmember.o \
231 Python/sysmodule.o \
232 Python/traceback.o \
233 Python/getopt.o \
234 Python/$(DYNLOADFILE) \
235 $(LIBOBJS)
236
237
238##########################################################################
239# Objects
240OBJECT_OBJS= \
241 Objects/abstract.o \
242 Objects/bufferobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000243 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000244 Objects/classobject.o \
245 Objects/cobject.o \
246 Objects/complexobject.o \
247 Objects/fileobject.o \
248 Objects/floatobject.o \
249 Objects/frameobject.o \
250 Objects/funcobject.o \
251 Objects/intobject.o \
252 Objects/listobject.o \
253 Objects/longobject.o \
254 Objects/dictobject.o \
255 Objects/methodobject.o \
256 Objects/moduleobject.o \
257 Objects/object.o \
258 Objects/rangeobject.o \
259 Objects/sliceobject.o \
260 Objects/stringobject.o \
261 Objects/tupleobject.o \
262 Objects/typeobject.o \
263 Objects/unicodeobject.o \
264 Objects/unicodectype.o
265
266
267##########################################################################
268# objects that get linked into the Python library
269LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000270 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000271 $(PARSER_OBJS) \
272 $(OBJECT_OBJS) \
273 $(PYTHON_OBJS) \
274 $(MODULE_OBJS) \
275 $(SIGNAL_OBJS) \
276 $(MODOBJS)
277
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000278#########################################################################
279# Rules
280
281# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000282all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000283
284# Build the interpreter
285$(PYTHON): $(MAINOBJ) $(LDLIBRARY)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000286 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ $(MAINOBJ) \
287 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
288
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000289platform: $(PYTHON)
290 ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
291
292
293# Build the shared modules
294sharedmods: $(PYTHON)
295 ./$(PYTHON) $(srcdir)/setup.py build
296
Neil Schemenauer18821822001-01-27 21:42:38 +0000297# buildno should really depend on something like LIBRARY_SRC
298buildno: $(PARSER_OBJS) \
299 $(OBJECT_OBJS) \
300 $(PYTHON_OBJS) \
301 $(MODULE_OBJS) \
302 $(SIGNAL_OBJS) \
303 $(MODOBJS) \
304 $(srcdir)/Modules/getbuildinfo.c
305 if test -f buildno; then \
306 expr `cat buildno` + 1 >buildno1; \
307 mv -f buildno1 buildno; \
308 else echo 1 >buildno; fi
309
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000310# Build static library
311$(LIBRARY): $(LIBRARY_OBJS)
312 -rm -f $@
313 # avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer18821822001-01-27 21:42:38 +0000314 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000315 $(AR) cr $@ $(PARSER_OBJS)
316 $(AR) cr $@ $(OBJECT_OBJS)
317 $(AR) cr $@ $(PYTHON_OBJS)
318 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
319 $(AR) cr $@ $(MODOBJS)
320 $(RANLIB) $@
321
322# This rule is only here for DG/UX and BeOS!!!
323libpython$(VERSION).so: $(LIBRARY)
324 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
325 *dgux*) \
326 test -d dgux || mkdir dgux; \
327 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
328 /bin/rm -rf ./dgux \
329 ;; \
330 beos) \
331 $(srcdir)/BeOS/ar-fake so $(LIBRARY) $@ \
332 ;; \
333 esac
334
335# This rule is here for OPENSTEP/Rhapsody/MacOSX
336libpython$(VERSION).dylib: $(LIBRARY)
337 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
338 -framework System @LIBTOOL_CRUFT@
339
340# This rule builds the Cygwin Python DLL
341libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
342 dlltool --export-all --output-def $@ $^
343 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
344 $(LIBS) $(MODLIBS) $(SYSLIBS)
345
346
347oldsharedmods: $(SHAREDMODS)
348
349
350Makefile Modules/config.c: Makefile.pre \
351 $(srcdir)/Modules/config.c.in \
352 $(MAKESETUP) \
353 Modules/Setup.config \
354 Modules/Setup \
355 Modules/Setup.local
356 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
357 -s Modules \
358 Modules/Setup.config \
359 Modules/Setup.local \
360 Modules/Setup
361 @mv config.c Modules
362 @echo "The Makefile was updated, you may need to re-run make."
363
364
365Modules/Setup: $(srcdir)/Modules/Setup.dist
366 @if test -f Modules/Setup; then \
367 echo "-----------------------------------------------"; \
368 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
369 echo "check to make sure you have all the updates you"; \
370 echo "need in your Modules/Setup file."; \
371 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000372 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000373
374############################################################################
375# Special rules for object files
376
377Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000378 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000379
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000380Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000381 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
382 -DPREFIX='"$(prefix)"' \
383 -DEXEC_PREFIX='"$(exec_prefix)"' \
384 -DVERSION='"$(VERSION)"' \
385 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000386 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000387
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000388Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
389 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000390
391
392$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
393 $(PGEN) $(GRAMMAR_INPUT)
394 mv graminit.h $(GRAMMAR_H)
395 mv graminit.c $(GRAMMAR_C)
396
397$(PGEN): $(PGENOBJS)
398 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
399
400Parser/grammar.o: $(srcdir)/Parser/grammar.c \
401 $(srcdir)/Parser/assert.h \
402 $(srcdir)/Include/token.h \
403 $(srcdir)/Include/grammar.h
404Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
405
406
407Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000408 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000409
410Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000411 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000412
413
414Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
415 $(srcdir)/Objects/unicodetype_db.h
416
417
418############################################################################
419# Header files
420
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000421PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000422 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000423 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000424 Include/patchlevel.h \
425 Include/pyport.h \
426 Include/pymem.h \
427 Include/object.h \
428 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000429 Include/compile.h \
430 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000431 Include/pydebug.h \
432 Include/unicodeobject.h \
433 Include/intobject.h \
434 Include/longobject.h \
435 Include/floatobject.h \
436 Include/complexobject.h \
437 Include/rangeobject.h \
438 Include/stringobject.h \
439 Include/bufferobject.h \
440 Include/tupleobject.h \
441 Include/listobject.h \
442 Include/dictobject.h \
443 Include/methodobject.h \
444 Include/moduleobject.h \
445 Include/funcobject.h \
446 Include/classobject.h \
447 Include/fileobject.h \
448 Include/cobject.h \
449 Include/traceback.h \
450 Include/sliceobject.h \
451 Include/codecs.h \
452 Include/pyerrors.h \
453 Include/pystate.h \
454 Include/modsupport.h \
455 Include/ceval.h \
456 Include/pythonrun.h \
457 Include/sysmodule.h \
458 Include/intrcheck.h \
459 Include/import.h \
460 Include/abstract.h \
461 Include/pyfpe.h
462
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000463$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
464
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000465
466######################################################################
467
468# Test the interpreter (twice, once without .pyc files, once with)
469TESTOPTS= -l
470TESTPROG= $(srcdir)/Lib/test/regrtest.py
471TESTPYTHON= ./$(PYTHON) -tt
472test: all platform
473 -rm -f $(srcdir)/Lib/test/*.py[co]
474 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
475 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
476
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000477QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000478 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000479 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000480quicktest: all platform
481 -rm -f $(srcdir)/Lib/test/*.py[co]
482 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
483 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
484
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000485# Install everything
486install: altinstall bininstall maninstall
487
488# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000489altinstall: altbininstall libinstall inclinstall libainstall \
490 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000491
492# Install shared libraries enabled by Setup
493DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
494
495oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
496 @for i in X $(SHAREDMODS); do \
497 if test $$i != X; \
498 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
499 fi; \
500 done
501
502$(DESTSHARED):
503 @for i in $(DESTDIRS); \
504 do \
505 if test ! -d $$i; then \
506 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000507 $(INSTALL) -d 755 $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000508 else true; \
509 fi; \
510 done
511
512
513# Install the interpreter (by creating a hard link to python$(VERSION))
514bininstall: altbininstall
515 -if test -f $(BINDIR)/$(PYTHON); \
516 then rm -f $(BINDIR)/$(PYTHON); \
517 else true; \
518 fi
519 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
520
521# Install the interpreter with $(VERSION) affixed
522# This goes into $(exec_prefix)
523altbininstall: $(PYTHON)
524 @for i in $(BINDIR); \
525 do \
526 if test ! -d $$i; then \
527 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000528 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000529 else true; \
530 fi; \
531 done
532 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
533 if test -f libpython$(VERSION).so; then \
534 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
535 else true; \
536 fi
537 if test -f "$(DLLLIBRARY)"; then \
538 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
539 else true; \
540 fi
541
542# Install the manual page
543maninstall:
544 @for i in $(MANDIR) $(MANDIR)/man1; \
545 do \
546 if test ! -d $$i; then \
547 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000548 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000549 else true; \
550 fi; \
551 done
552 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
553 $(MANDIR)/man1/python.1
554
555# Install the library
556PLATDIR= plat-$(MACHDEP)
557MACHDEPS= $(PLATDIR)
558XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
559LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
560 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
561libinstall: python $(srcdir)/Lib/$(PLATDIR)
562 @for i in $(SCRIPTDIR) $(LIBDEST); \
563 do \
564 if test ! -d $$i; then \
565 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000566 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000567 else true; \
568 fi; \
569 done
570 @for d in $(LIBSUBDIRS); \
571 do \
572 a=$(srcdir)/Lib/$$d; \
573 if test ! -d $$a; then continue; else true; fi; \
574 b=$(LIBDEST)/$$d; \
575 if test ! -d $$b; then \
576 echo "Creating directory $$b"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000577 $(INSTALL) -d $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000578 else true; \
579 fi; \
580 done
581 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
582 do \
583 if test -x $$i; then \
584 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
585 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
586 else \
587 $(INSTALL_DATA) $$i $(LIBDEST); \
588 echo $(INSTALL_DATA) $$i $(LIBDEST); \
589 fi; \
590 done
591 @for d in $(LIBSUBDIRS); \
592 do \
593 a=$(srcdir)/Lib/$$d; \
594 if test ! -d $$a; then continue; else true; fi; \
595 b=$(LIBDEST)/$$d; \
596 for i in $$a/*; \
597 do \
598 case $$i in \
599 *CVS) ;; \
600 *.py[co]) ;; \
601 *.orig) ;; \
602 *~) ;; \
603 *) \
604 if test -d $$i; then continue; fi; \
605 if test -x $$i; then \
606 echo $(INSTALL_PROGRAM) $$i $$b; \
607 $(INSTALL_PROGRAM) $$i $$b; \
608 else \
609 echo $(INSTALL_DATA) $$i $$b; \
610 $(INSTALL_DATA) $$i $$b; \
611 fi;; \
612 esac; \
613 done; \
614 done
615 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
616 PYTHONPATH=$(LIBDEST) \
617 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
618 PYTHONPATH=$(LIBDEST) \
619 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
620
621# Create the PLATDIR source directory, if one wasn't distributed..
622$(srcdir)/Lib/$(PLATDIR):
623 mkdir $(srcdir)/Lib/$(PLATDIR)
624 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
625 export PATH; PATH="`pwd`:$$PATH"; \
626 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
627 export EXEEXT; EXEEXT="$(EXEEXT)"; \
628 cd $(srcdir)/Lib/$(PLATDIR); ./regen
629
630# Install the include files
631INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
632inclinstall:
633 @for i in $(INCLDIRSTOMAKE); \
634 do \
635 if test ! -d $$i; then \
636 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000637 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000638 else true; \
639 fi; \
640 done
641 @for i in $(srcdir)/Include/*.h; \
642 do \
643 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
644 $(INSTALL_DATA) $$i $(INCLUDEPY); \
645 done
646 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
647
648# Install the library and miscellaneous stuff needed for extending/embedding
649# This goes into $(exec_prefix)
650LIBPL= $(LIBP)/config
651libainstall: all
652 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
653 do \
654 if test ! -d $$i; then \
655 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000656 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000657 else true; \
658 fi; \
659 done
660 @if test -d $(LDLIBRARY); then :; else \
661 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
662 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
663 fi
664 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
665 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
666 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
667 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
668 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
669 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
670 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
671 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
672 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
673 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
674 @if [ -s Modules/python.exp -a \
675 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
676 echo; echo "Installing support files for building shared extension modules on AIX:"; \
677 $(INSTALL_DATA) Modules/python.exp \
678 $(LIBPL)/python.exp; \
679 echo; echo "$(LIBPL)/python.exp"; \
680 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
681 $(LIBPL)/makexp_aix; \
682 echo "$(LIBPL)/makexp_aix"; \
683 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
684 $(LIBPL)/ld_so_aix; \
685 echo "$(LIBPL)/ld_so_aix"; \
686 echo; echo "See Misc/AIX-NOTES for details."; \
687 else true; \
688 fi
689 @case "$(MACHDEP)" in beos*) \
690 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
691 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
692 echo; echo "$(LIBPL)/README"; \
693 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
694 echo "$(LIBPL)/README.readline-2.2"; \
695 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
696 echo "$(LIBPL)/ar-fake"; \
697 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
698 echo "$(LIBPL)/linkmodule"; \
699 echo; echo "See BeOS/README for details."; \
700 ;; \
701 esac
702
703# Install the dynamically loadable modules
704# This goes into $(exec_prefix)
705sharedinstall:
Neil Schemenauer18821822001-01-27 21:42:38 +0000706 ./python$(EXEEXT) $(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
714# Run the configure script. If config.status already exists,
715# call it with the --recheck argument, which reruns configure with the
716# same options as it was run last time; otherwise run the configure
717# script with options taken from the $(WITH) variable
718config.status: $(srcdir)/configure
719 if test -f config.status; \
720 then $(SHELL) config.status --recheck; \
721 $(SHELL) config.status; \
722 else $(SHELL) $(srcdir)/configure $(WITH); \
723 fi
724
725.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
726
727# Some make's put the object file in the current directory
728.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000729 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000730
731# Rerun configure with the same options as it was run last time,
732# provided the config.status script exists
733recheck:
734 $(SHELL) config.status --recheck
735 $(SHELL) config.status
736
737# Rebuild the configure script from configure.in; also rebuild config.h.in
738autoconf:
739 (cd $(srcdir); autoconf)
740 (cd $(srcdir); autoheader)
741
742# Create a tags file for vi
743tags::
744 cd $(srcdir); \
745 ctags -w -t Include/*.h; \
746 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
747 done; \
748 sort tags -o tags
749
750# Create a tags file for GNU Emacs
751TAGS::
752 cd $(srcdir); \
753 etags Include/*.h; \
754 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
755
756# Sanitation targets -- clean leaves libraries, executables and tags
757# files, which clobber removes those as well
758
759clean:
760 -rm -f core *~ [@,#]* *.old *.orig *.rej
761 -rm -rf build
762 # avoid long command lines, same as LIBRARY_OBJS MAINOBJ PGOBJS
763 -rm -f $(PARSER_OBJS)
764 -rm -f $(OBJECT_OBJS)
765 -rm -f $(PYTHON_OBJS)
766 -rm -f $(MODULE_OBJS) $(SIGNAL_OBJS)
767 -rm -f $(MODOBJS) $(MAINOBJ) $(PGOBJS)
768
769clobber: clean
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000770 -rm -f tags TAGS $(PYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
771 Modules/*.so Modules/*.sl
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000772
773# Make things extra clean, before making a distribution:
774# remove all generated files, even Makefile[.pre]
775distclean: clobber
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000776 -rm -f Makefile Makefile.pre buildno config.status config.log \
777 config.cache config.h setup.cfg Modules/config.c \
778 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000779 -for i in $(SUBDIRSTOO); do \
780 for f in $$i/*.in; do \
781 f=`basename "$$f" .in`; \
782 if test "$$f" != "*"; then \
783 echo rm -f "$$i/$$f"; \
784 rm -f "$$i/$$f"; \
785 fi; \
786 done; \
787 done
788
789# Check for smelly exported symbols (not starting with Py/_Py)
790smelly: all
791 nm -p $(LIBRARY) | \
792 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
793
794# Find files with funny names
795funny:
796 find $(DISTDIRS) -type d \
797 -o -name '*.[chs]' \
798 -o -name '*.py' \
799 -o -name '*.doc' \
800 -o -name '*.sty' \
801 -o -name '*.bib' \
802 -o -name '*.dat' \
803 -o -name '*.el' \
804 -o -name '*.fd' \
805 -o -name '*.in' \
806 -o -name '*.tex' \
807 -o -name '*,[vpt]' \
808 -o -name 'Setup' \
809 -o -name 'Setup.*' \
810 -o -name README \
811 -o -name Makefile \
812 -o -name ChangeLog \
813 -o -name Repository \
814 -o -name Root \
815 -o -name Entries \
816 -o -name Tag \
817 -o -name tags \
818 -o -name TAGS \
819 -o -name .cvsignore \
820 -o -name MANIFEST \
821 -o -print
822
823# IF YOU PUT ANYTHING HERE IT WILL GO AWAY