blob: c1279f47fe4142363a5458d1181da5e10f8cd2e0 [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 Schemenauer92538fb2001-02-16 03:59:53 +0000160GRAMMAR_H= Include/graminit.h
161GRAMMAR_C= 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)
284 ./$(PYTHON) $(srcdir)/setup.py build
285
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 Schemenauer92538fb2001-02-16 03:59:53 +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
394Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000395 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000396
397Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000398 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000399
400
401Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
402 $(srcdir)/Objects/unicodetype_db.h
403
404
405############################################################################
406# Header files
407
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000408PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000409 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000410 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000411 Include/patchlevel.h \
412 Include/pyport.h \
413 Include/pymem.h \
414 Include/object.h \
415 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000416 Include/compile.h \
417 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000418 Include/pydebug.h \
419 Include/unicodeobject.h \
420 Include/intobject.h \
421 Include/longobject.h \
422 Include/floatobject.h \
423 Include/complexobject.h \
424 Include/rangeobject.h \
425 Include/stringobject.h \
426 Include/bufferobject.h \
427 Include/tupleobject.h \
428 Include/listobject.h \
429 Include/dictobject.h \
430 Include/methodobject.h \
431 Include/moduleobject.h \
432 Include/funcobject.h \
433 Include/classobject.h \
434 Include/fileobject.h \
435 Include/cobject.h \
436 Include/traceback.h \
437 Include/sliceobject.h \
438 Include/codecs.h \
439 Include/pyerrors.h \
440 Include/pystate.h \
441 Include/modsupport.h \
442 Include/ceval.h \
443 Include/pythonrun.h \
444 Include/sysmodule.h \
445 Include/intrcheck.h \
446 Include/import.h \
447 Include/abstract.h \
448 Include/pyfpe.h
449
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000450$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
451
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000452
453######################################################################
454
455# Test the interpreter (twice, once without .pyc files, once with)
456TESTOPTS= -l
457TESTPROG= $(srcdir)/Lib/test/regrtest.py
458TESTPYTHON= ./$(PYTHON) -tt
459test: all platform
460 -rm -f $(srcdir)/Lib/test/*.py[co]
461 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
462 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
463
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000464QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000465 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000466 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000467quicktest: all platform
468 -rm -f $(srcdir)/Lib/test/*.py[co]
469 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
470 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
471
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000472# Install everything
473install: altinstall bininstall maninstall
474
475# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000476altinstall: altbininstall libinstall inclinstall libainstall \
477 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000478
479# Install shared libraries enabled by Setup
480DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
481
482oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
483 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000484 if test $$i != X; then \
485 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
486 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
487 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000488 done
489
490$(DESTSHARED):
491 @for i in $(DESTDIRS); \
492 do \
493 if test ! -d $$i; then \
494 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000495 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000496 else true; \
497 fi; \
498 done
499
500
501# Install the interpreter (by creating a hard link to python$(VERSION))
502bininstall: altbininstall
503 -if test -f $(BINDIR)/$(PYTHON); \
504 then rm -f $(BINDIR)/$(PYTHON); \
505 else true; \
506 fi
507 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
508
509# Install the interpreter with $(VERSION) affixed
510# This goes into $(exec_prefix)
511altbininstall: $(PYTHON)
512 @for i in $(BINDIR); \
513 do \
514 if test ! -d $$i; then \
515 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000516 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000517 else true; \
518 fi; \
519 done
520 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
521 if test -f libpython$(VERSION).so; then \
522 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
523 else true; \
524 fi
525 if test -f "$(DLLLIBRARY)"; then \
526 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
527 else true; \
528 fi
529
530# Install the manual page
531maninstall:
532 @for i in $(MANDIR) $(MANDIR)/man1; \
533 do \
534 if test ! -d $$i; then \
535 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000536 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000537 else true; \
538 fi; \
539 done
540 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
541 $(MANDIR)/man1/python.1
542
543# Install the library
544PLATDIR= plat-$(MACHDEP)
545MACHDEPS= $(PLATDIR)
546XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
547LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
548 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
549libinstall: python $(srcdir)/Lib/$(PLATDIR)
550 @for i in $(SCRIPTDIR) $(LIBDEST); \
551 do \
552 if test ! -d $$i; then \
553 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000554 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000555 else true; \
556 fi; \
557 done
558 @for d in $(LIBSUBDIRS); \
559 do \
560 a=$(srcdir)/Lib/$$d; \
561 if test ! -d $$a; then continue; else true; fi; \
562 b=$(LIBDEST)/$$d; \
563 if test ! -d $$b; then \
564 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000565 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000566 else true; \
567 fi; \
568 done
569 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
570 do \
571 if test -x $$i; then \
572 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
573 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
574 else \
575 $(INSTALL_DATA) $$i $(LIBDEST); \
576 echo $(INSTALL_DATA) $$i $(LIBDEST); \
577 fi; \
578 done
579 @for d in $(LIBSUBDIRS); \
580 do \
581 a=$(srcdir)/Lib/$$d; \
582 if test ! -d $$a; then continue; else true; fi; \
583 b=$(LIBDEST)/$$d; \
584 for i in $$a/*; \
585 do \
586 case $$i in \
587 *CVS) ;; \
588 *.py[co]) ;; \
589 *.orig) ;; \
590 *~) ;; \
591 *) \
592 if test -d $$i; then continue; fi; \
593 if test -x $$i; then \
594 echo $(INSTALL_PROGRAM) $$i $$b; \
595 $(INSTALL_PROGRAM) $$i $$b; \
596 else \
597 echo $(INSTALL_DATA) $$i $$b; \
598 $(INSTALL_DATA) $$i $$b; \
599 fi;; \
600 esac; \
601 done; \
602 done
603 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
604 PYTHONPATH=$(LIBDEST) \
605 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
606 PYTHONPATH=$(LIBDEST) \
607 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
608
609# Create the PLATDIR source directory, if one wasn't distributed..
610$(srcdir)/Lib/$(PLATDIR):
611 mkdir $(srcdir)/Lib/$(PLATDIR)
612 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
613 export PATH; PATH="`pwd`:$$PATH"; \
614 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
615 export EXEEXT; EXEEXT="$(EXEEXT)"; \
616 cd $(srcdir)/Lib/$(PLATDIR); ./regen
617
618# Install the include files
619INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
620inclinstall:
621 @for i in $(INCLDIRSTOMAKE); \
622 do \
623 if test ! -d $$i; then \
624 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000625 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000626 else true; \
627 fi; \
628 done
629 @for i in $(srcdir)/Include/*.h; \
630 do \
631 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
632 $(INSTALL_DATA) $$i $(INCLUDEPY); \
633 done
634 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
635
636# Install the library and miscellaneous stuff needed for extending/embedding
637# This goes into $(exec_prefix)
638LIBPL= $(LIBP)/config
639libainstall: all
640 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
641 do \
642 if test ! -d $$i; then \
643 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000644 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000645 else true; \
646 fi; \
647 done
648 @if test -d $(LDLIBRARY); then :; else \
649 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
650 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
651 fi
652 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
653 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
654 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
655 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
656 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
657 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
658 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
659 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
660 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
661 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
662 @if [ -s Modules/python.exp -a \
663 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
664 echo; echo "Installing support files for building shared extension modules on AIX:"; \
665 $(INSTALL_DATA) Modules/python.exp \
666 $(LIBPL)/python.exp; \
667 echo; echo "$(LIBPL)/python.exp"; \
668 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
669 $(LIBPL)/makexp_aix; \
670 echo "$(LIBPL)/makexp_aix"; \
671 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
672 $(LIBPL)/ld_so_aix; \
673 echo "$(LIBPL)/ld_so_aix"; \
674 echo; echo "See Misc/AIX-NOTES for details."; \
675 else true; \
676 fi
677 @case "$(MACHDEP)" in beos*) \
678 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000679 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000680 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000681 $(INSTALL_PROGRAM) Modules/ar_beos $(LIBPL)/ar_beos; \
682 echo "$(LIBPL)/ar_beos"; \
683 $(INSTALL_PROGRAM) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
684 echo "$(LIBPL)/ld_so_beos"; \
685 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000686 ;; \
687 esac
688
689# Install the dynamically loadable modules
690# This goes into $(exec_prefix)
691sharedinstall:
Neil Schemenauer18821822001-01-27 21:42:38 +0000692 ./python$(EXEEXT) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000693 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000694
695# Build the toplevel Makefile
696Makefile.pre: Makefile.pre.in config.status
697 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
698 $(MAKE) -f Makefile.pre Makefile
699
700# Run the configure script. If config.status already exists,
701# call it with the --recheck argument, which reruns configure with the
702# same options as it was run last time; otherwise run the configure
703# script with options taken from the $(WITH) variable
704config.status: $(srcdir)/configure
705 if test -f config.status; \
706 then $(SHELL) config.status --recheck; \
707 $(SHELL) config.status; \
708 else $(SHELL) $(srcdir)/configure $(WITH); \
709 fi
710
711.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
712
713# Some make's put the object file in the current directory
714.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000715 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000716
717# Rerun configure with the same options as it was run last time,
718# provided the config.status script exists
719recheck:
720 $(SHELL) config.status --recheck
721 $(SHELL) config.status
722
723# Rebuild the configure script from configure.in; also rebuild config.h.in
724autoconf:
725 (cd $(srcdir); autoconf)
726 (cd $(srcdir); autoheader)
727
728# Create a tags file for vi
729tags::
730 cd $(srcdir); \
731 ctags -w -t Include/*.h; \
732 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
733 done; \
734 sort tags -o tags
735
736# Create a tags file for GNU Emacs
737TAGS::
738 cd $(srcdir); \
739 etags Include/*.h; \
740 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
741
742# Sanitation targets -- clean leaves libraries, executables and tags
743# files, which clobber removes those as well
744
745clean:
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000746 # avoid long command lines, same as LIBRARY_OBJS MAINOBJ PGOBJS
747 -rm -f $(PARSER_OBJS)
748 -rm -f $(OBJECT_OBJS)
749 -rm -f $(PYTHON_OBJS)
Neil Schemenauere0d43572001-02-03 17:16:29 +0000750 -rm -f $(MODULE_OBJS) $(SIGNAL_OBJS) Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000751 -rm -f $(MODOBJS) $(MAINOBJ) $(PGOBJS)
Neil Schemenauere0d43572001-02-03 17:16:29 +0000752 if test -f build; then find build -name '*.o' -exec rm -f {} ';' ; fi
753 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000754
755clobber: clean
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000756 -rm -f tags TAGS $(PYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
Neil Schemenauere0d43572001-02-03 17:16:29 +0000757 Modules/*.so Modules/*.sl Parser/pgen
758 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000759
760# Make things extra clean, before making a distribution:
761# remove all generated files, even Makefile[.pre]
762distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000763 -rm -f core Makefile Makefile.pre buildno config.status \
764 config.log config.cache config.h Modules/config.c \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000765 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000766 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
767 -o -name '[@,#]*' -o -name '*.old' \
768 -o -name '*.orig' -o -name '*.rej' \
769 -o -name '*.bak' ')' \
770 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000771
772# Check for smelly exported symbols (not starting with Py/_Py)
773smelly: all
774 nm -p $(LIBRARY) | \
775 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
776
777# Find files with funny names
778funny:
779 find $(DISTDIRS) -type d \
780 -o -name '*.[chs]' \
781 -o -name '*.py' \
782 -o -name '*.doc' \
783 -o -name '*.sty' \
784 -o -name '*.bib' \
785 -o -name '*.dat' \
786 -o -name '*.el' \
787 -o -name '*.fd' \
788 -o -name '*.in' \
789 -o -name '*.tex' \
790 -o -name '*,[vpt]' \
791 -o -name 'Setup' \
792 -o -name 'Setup.*' \
793 -o -name README \
794 -o -name Makefile \
795 -o -name ChangeLog \
796 -o -name Repository \
797 -o -name Root \
798 -o -name Entries \
799 -o -name Tag \
800 -o -name tags \
801 -o -name TAGS \
802 -o -name .cvsignore \
803 -o -name MANIFEST \
804 -o -print
805
806# IF YOU PUT ANYTHING HERE IT WILL GO AWAY