blob: 299c15cf40864e0434999ce041ce84b6e346a16f [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 \
429 Include/pydebug.h \
430 Include/unicodeobject.h \
431 Include/intobject.h \
432 Include/longobject.h \
433 Include/floatobject.h \
434 Include/complexobject.h \
435 Include/rangeobject.h \
436 Include/stringobject.h \
437 Include/bufferobject.h \
438 Include/tupleobject.h \
439 Include/listobject.h \
440 Include/dictobject.h \
441 Include/methodobject.h \
442 Include/moduleobject.h \
443 Include/funcobject.h \
444 Include/classobject.h \
445 Include/fileobject.h \
446 Include/cobject.h \
447 Include/traceback.h \
448 Include/sliceobject.h \
449 Include/codecs.h \
450 Include/pyerrors.h \
451 Include/pystate.h \
452 Include/modsupport.h \
453 Include/ceval.h \
454 Include/pythonrun.h \
455 Include/sysmodule.h \
456 Include/intrcheck.h \
457 Include/import.h \
458 Include/abstract.h \
459 Include/pyfpe.h
460
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000461$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
462
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000463
464######################################################################
465
466# Test the interpreter (twice, once without .pyc files, once with)
467TESTOPTS= -l
468TESTPROG= $(srcdir)/Lib/test/regrtest.py
469TESTPYTHON= ./$(PYTHON) -tt
470test: all platform
471 -rm -f $(srcdir)/Lib/test/*.py[co]
472 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
473 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
474
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000475QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000476 test_unicodedata test_re test_sre test_select test_poll \
477 test_fork1 test_linuxaudiodev test_sunaudiodev test_zlib
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000478quicktest: all platform
479 -rm -f $(srcdir)/Lib/test/*.py[co]
480 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
481 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
482
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000483# Install everything
484install: altinstall bininstall maninstall
485
486# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000487altinstall: altbininstall libinstall inclinstall libainstall \
488 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000489
490# Install shared libraries enabled by Setup
491DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
492
493oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
494 @for i in X $(SHAREDMODS); do \
495 if test $$i != X; \
496 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
497 fi; \
498 done
499
500$(DESTSHARED):
501 @for i in $(DESTDIRS); \
502 do \
503 if test ! -d $$i; then \
504 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000505 $(INSTALL) -d 755 $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000506 else true; \
507 fi; \
508 done
509
510
511# Install the interpreter (by creating a hard link to python$(VERSION))
512bininstall: altbininstall
513 -if test -f $(BINDIR)/$(PYTHON); \
514 then rm -f $(BINDIR)/$(PYTHON); \
515 else true; \
516 fi
517 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
518
519# Install the interpreter with $(VERSION) affixed
520# This goes into $(exec_prefix)
521altbininstall: $(PYTHON)
522 @for i in $(BINDIR); \
523 do \
524 if test ! -d $$i; then \
525 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000526 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000527 else true; \
528 fi; \
529 done
530 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
531 if test -f libpython$(VERSION).so; then \
532 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
533 else true; \
534 fi
535 if test -f "$(DLLLIBRARY)"; then \
536 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
537 else true; \
538 fi
539
540# Install the manual page
541maninstall:
542 @for i in $(MANDIR) $(MANDIR)/man1; \
543 do \
544 if test ! -d $$i; then \
545 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000546 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000547 else true; \
548 fi; \
549 done
550 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
551 $(MANDIR)/man1/python.1
552
553# Install the library
554PLATDIR= plat-$(MACHDEP)
555MACHDEPS= $(PLATDIR)
556XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
557LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
558 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
559libinstall: python $(srcdir)/Lib/$(PLATDIR)
560 @for i in $(SCRIPTDIR) $(LIBDEST); \
561 do \
562 if test ! -d $$i; then \
563 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000564 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000565 else true; \
566 fi; \
567 done
568 @for d in $(LIBSUBDIRS); \
569 do \
570 a=$(srcdir)/Lib/$$d; \
571 if test ! -d $$a; then continue; else true; fi; \
572 b=$(LIBDEST)/$$d; \
573 if test ! -d $$b; then \
574 echo "Creating directory $$b"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000575 $(INSTALL) -d $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000576 else true; \
577 fi; \
578 done
579 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
580 do \
581 if test -x $$i; then \
582 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
583 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
584 else \
585 $(INSTALL_DATA) $$i $(LIBDEST); \
586 echo $(INSTALL_DATA) $$i $(LIBDEST); \
587 fi; \
588 done
589 @for d in $(LIBSUBDIRS); \
590 do \
591 a=$(srcdir)/Lib/$$d; \
592 if test ! -d $$a; then continue; else true; fi; \
593 b=$(LIBDEST)/$$d; \
594 for i in $$a/*; \
595 do \
596 case $$i in \
597 *CVS) ;; \
598 *.py[co]) ;; \
599 *.orig) ;; \
600 *~) ;; \
601 *) \
602 if test -d $$i; then continue; fi; \
603 if test -x $$i; then \
604 echo $(INSTALL_PROGRAM) $$i $$b; \
605 $(INSTALL_PROGRAM) $$i $$b; \
606 else \
607 echo $(INSTALL_DATA) $$i $$b; \
608 $(INSTALL_DATA) $$i $$b; \
609 fi;; \
610 esac; \
611 done; \
612 done
613 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
614 PYTHONPATH=$(LIBDEST) \
615 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
616 PYTHONPATH=$(LIBDEST) \
617 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
618
619# Create the PLATDIR source directory, if one wasn't distributed..
620$(srcdir)/Lib/$(PLATDIR):
621 mkdir $(srcdir)/Lib/$(PLATDIR)
622 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
623 export PATH; PATH="`pwd`:$$PATH"; \
624 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
625 export EXEEXT; EXEEXT="$(EXEEXT)"; \
626 cd $(srcdir)/Lib/$(PLATDIR); ./regen
627
628# Install the include files
629INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
630inclinstall:
631 @for i in $(INCLDIRSTOMAKE); \
632 do \
633 if test ! -d $$i; then \
634 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000635 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000636 else true; \
637 fi; \
638 done
639 @for i in $(srcdir)/Include/*.h; \
640 do \
641 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
642 $(INSTALL_DATA) $$i $(INCLUDEPY); \
643 done
644 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
645
646# Install the library and miscellaneous stuff needed for extending/embedding
647# This goes into $(exec_prefix)
648LIBPL= $(LIBP)/config
649libainstall: all
650 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
651 do \
652 if test ! -d $$i; then \
653 echo "Creating directory $$i"; \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000654 $(INSTALL) -d $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000655 else true; \
656 fi; \
657 done
658 @if test -d $(LDLIBRARY); then :; else \
659 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
660 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
661 fi
662 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
663 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
664 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
665 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
666 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
667 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
668 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
669 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
670 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
671 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
672 @if [ -s Modules/python.exp -a \
673 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
674 echo; echo "Installing support files for building shared extension modules on AIX:"; \
675 $(INSTALL_DATA) Modules/python.exp \
676 $(LIBPL)/python.exp; \
677 echo; echo "$(LIBPL)/python.exp"; \
678 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
679 $(LIBPL)/makexp_aix; \
680 echo "$(LIBPL)/makexp_aix"; \
681 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
682 $(LIBPL)/ld_so_aix; \
683 echo "$(LIBPL)/ld_so_aix"; \
684 echo; echo "See Misc/AIX-NOTES for details."; \
685 else true; \
686 fi
687 @case "$(MACHDEP)" in beos*) \
688 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
689 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
690 echo; echo "$(LIBPL)/README"; \
691 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
692 echo "$(LIBPL)/README.readline-2.2"; \
693 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
694 echo "$(LIBPL)/ar-fake"; \
695 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
696 echo "$(LIBPL)/linkmodule"; \
697 echo; echo "See BeOS/README for details."; \
698 ;; \
699 esac
700
701# Install the dynamically loadable modules
702# This goes into $(exec_prefix)
703sharedinstall:
Neil Schemenauer18821822001-01-27 21:42:38 +0000704 ./python$(EXEEXT) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000705 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000706
707# Build the toplevel Makefile
708Makefile.pre: Makefile.pre.in config.status
709 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
710 $(MAKE) -f Makefile.pre Makefile
711
712# Run the configure script. If config.status already exists,
713# call it with the --recheck argument, which reruns configure with the
714# same options as it was run last time; otherwise run the configure
715# script with options taken from the $(WITH) variable
716config.status: $(srcdir)/configure
717 if test -f config.status; \
718 then $(SHELL) config.status --recheck; \
719 $(SHELL) config.status; \
720 else $(SHELL) $(srcdir)/configure $(WITH); \
721 fi
722
723.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
724
725# Some make's put the object file in the current directory
726.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000727 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000728
729# Rerun configure with the same options as it was run last time,
730# provided the config.status script exists
731recheck:
732 $(SHELL) config.status --recheck
733 $(SHELL) config.status
734
735# Rebuild the configure script from configure.in; also rebuild config.h.in
736autoconf:
737 (cd $(srcdir); autoconf)
738 (cd $(srcdir); autoheader)
739
740# Create a tags file for vi
741tags::
742 cd $(srcdir); \
743 ctags -w -t Include/*.h; \
744 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
745 done; \
746 sort tags -o tags
747
748# Create a tags file for GNU Emacs
749TAGS::
750 cd $(srcdir); \
751 etags Include/*.h; \
752 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
753
754# Sanitation targets -- clean leaves libraries, executables and tags
755# files, which clobber removes those as well
756
757clean:
758 -rm -f core *~ [@,#]* *.old *.orig *.rej
759 -rm -rf build
760 # avoid long command lines, same as LIBRARY_OBJS MAINOBJ PGOBJS
761 -rm -f $(PARSER_OBJS)
762 -rm -f $(OBJECT_OBJS)
763 -rm -f $(PYTHON_OBJS)
764 -rm -f $(MODULE_OBJS) $(SIGNAL_OBJS)
765 -rm -f $(MODOBJS) $(MAINOBJ) $(PGOBJS)
766
767clobber: clean
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000768 -rm -f tags TAGS $(PYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
769 Modules/*.so Modules/*.sl
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000770
771# Make things extra clean, before making a distribution:
772# remove all generated files, even Makefile[.pre]
773distclean: clobber
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000774 -rm -f Makefile Makefile.pre buildno config.status config.log \
775 config.cache config.h setup.cfg Modules/config.c \
776 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000777 -for i in $(SUBDIRSTOO); do \
778 for f in $$i/*.in; do \
779 f=`basename "$$f" .in`; \
780 if test "$$f" != "*"; then \
781 echo rm -f "$$i/$$f"; \
782 rm -f "$$i/$$f"; \
783 fi; \
784 done; \
785 done
786
787# Check for smelly exported symbols (not starting with Py/_Py)
788smelly: all
789 nm -p $(LIBRARY) | \
790 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
791
792# Find files with funny names
793funny:
794 find $(DISTDIRS) -type d \
795 -o -name '*.[chs]' \
796 -o -name '*.py' \
797 -o -name '*.doc' \
798 -o -name '*.sty' \
799 -o -name '*.bib' \
800 -o -name '*.dat' \
801 -o -name '*.el' \
802 -o -name '*.fd' \
803 -o -name '*.in' \
804 -o -name '*.tex' \
805 -o -name '*,[vpt]' \
806 -o -name 'Setup' \
807 -o -name 'Setup.*' \
808 -o -name README \
809 -o -name Makefile \
810 -o -name ChangeLog \
811 -o -name Repository \
812 -o -name Root \
813 -o -name Entries \
814 -o -name Tag \
815 -o -name tags \
816 -o -name TAGS \
817 -o -name .cvsignore \
818 -o -name MANIFEST \
819 -o -print
820
821# IF YOU PUT ANYTHING HERE IT WILL GO AWAY