blob: 94aa576857b81a088a6bd3b7e81b701cf78ac373 [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)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000100EXE= @EXEEXT@
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000101
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
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000142PYTHON= python$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000143
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
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000167PGEN= Parser/pgen$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000168
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 \
Jeremy Hylton4db62b12001-02-27 19:07:02 +0000203 Python/future.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000204 Python/getargs.o \
205 Python/getcompiler.o \
206 Python/getcopyright.o \
207 Python/getmtime.o \
208 Python/getplatform.o \
209 Python/getversion.o \
210 Python/graminit.o \
211 Python/import.o \
212 Python/importdl.o \
213 Python/marshal.o \
214 Python/modsupport.o \
215 Python/mystrtoul.o \
216 Python/pyfpe.o \
217 Python/pystate.o \
218 Python/pythonrun.o \
219 Python/structmember.o \
Jeremy Hyltoncb17ae82001-02-09 22:22:18 +0000220 Python/symtable.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000221 Python/sysmodule.o \
222 Python/traceback.o \
223 Python/getopt.o \
224 Python/$(DYNLOADFILE) \
225 $(LIBOBJS)
226
227
228##########################################################################
229# Objects
230OBJECT_OBJS= \
231 Objects/abstract.o \
232 Objects/bufferobject.o \
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000233 Objects/cellobject.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000234 Objects/classobject.o \
235 Objects/cobject.o \
236 Objects/complexobject.o \
237 Objects/fileobject.o \
238 Objects/floatobject.o \
239 Objects/frameobject.o \
240 Objects/funcobject.o \
241 Objects/intobject.o \
242 Objects/listobject.o \
243 Objects/longobject.o \
244 Objects/dictobject.o \
245 Objects/methodobject.o \
246 Objects/moduleobject.o \
247 Objects/object.o \
248 Objects/rangeobject.o \
249 Objects/sliceobject.o \
250 Objects/stringobject.o \
251 Objects/tupleobject.o \
252 Objects/typeobject.o \
253 Objects/unicodeobject.o \
254 Objects/unicodectype.o
255
256
257##########################################################################
258# objects that get linked into the Python library
259LIBRARY_OBJS= \
Neil Schemenauer18821822001-01-27 21:42:38 +0000260 Modules/getbuildinfo.o \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000261 $(PARSER_OBJS) \
262 $(OBJECT_OBJS) \
263 $(PYTHON_OBJS) \
264 $(MODULE_OBJS) \
265 $(SIGNAL_OBJS) \
266 $(MODOBJS)
267
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000268#########################################################################
269# Rules
270
271# Default target
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000272all: $(PYTHON) oldsharedmods sharedmods
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000273
274# Build the interpreter
275$(PYTHON): $(MAINOBJ) $(LDLIBRARY)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000276 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ $(MAINOBJ) \
277 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
278
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000279platform: $(PYTHON)
280 ./$(PYTHON) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
281
282
283# Build the shared modules
284sharedmods: $(PYTHON)
Andrew M. Kuchling0eb24d92001-02-17 05:33:50 +0000285 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000286
Neil Schemenauer18821822001-01-27 21:42:38 +0000287# buildno should really depend on something like LIBRARY_SRC
288buildno: $(PARSER_OBJS) \
289 $(OBJECT_OBJS) \
290 $(PYTHON_OBJS) \
291 $(MODULE_OBJS) \
292 $(SIGNAL_OBJS) \
293 $(MODOBJS) \
294 $(srcdir)/Modules/getbuildinfo.c
295 if test -f buildno; then \
296 expr `cat buildno` + 1 >buildno1; \
297 mv -f buildno1 buildno; \
298 else echo 1 >buildno; fi
299
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000300# Build static library
301$(LIBRARY): $(LIBRARY_OBJS)
302 -rm -f $@
303 # avoid long command lines, same as LIBRARY_OBJS
Neil Schemenauer18821822001-01-27 21:42:38 +0000304 $(AR) cr $@ Modules/getbuildinfo.o
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000305 $(AR) cr $@ $(PARSER_OBJS)
306 $(AR) cr $@ $(OBJECT_OBJS)
307 $(AR) cr $@ $(PYTHON_OBJS)
308 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
309 $(AR) cr $@ $(MODOBJS)
310 $(RANLIB) $@
311
312# This rule is only here for DG/UX and BeOS!!!
313libpython$(VERSION).so: $(LIBRARY)
314 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
315 *dgux*) \
316 test -d dgux || mkdir dgux; \
317 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
318 /bin/rm -rf ./dgux \
319 ;; \
320 beos) \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000321 $(AR) so $(LIBRARY) $@ \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000322 ;; \
323 esac
324
325# This rule is here for OPENSTEP/Rhapsody/MacOSX
326libpython$(VERSION).dylib: $(LIBRARY)
327 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
328 -framework System @LIBTOOL_CRUFT@
329
330# This rule builds the Cygwin Python DLL
331libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
332 dlltool --export-all --output-def $@ $^
333 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
334 $(LIBS) $(MODLIBS) $(SYSLIBS)
335
336
337oldsharedmods: $(SHAREDMODS)
338
339
340Makefile Modules/config.c: Makefile.pre \
341 $(srcdir)/Modules/config.c.in \
342 $(MAKESETUP) \
343 Modules/Setup.config \
344 Modules/Setup \
345 Modules/Setup.local
346 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
347 -s Modules \
348 Modules/Setup.config \
349 Modules/Setup.local \
350 Modules/Setup
351 @mv config.c Modules
352 @echo "The Makefile was updated, you may need to re-run make."
353
354
355Modules/Setup: $(srcdir)/Modules/Setup.dist
356 @if test -f Modules/Setup; then \
357 echo "-----------------------------------------------"; \
358 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
359 echo "check to make sure you have all the updates you"; \
360 echo "need in your Modules/Setup file."; \
361 echo "-----------------------------------------------"; \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000362 fi
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000363
364############################################################################
365# Special rules for object files
366
367Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000368 $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000369
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000370Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000371 $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
372 -DPREFIX='"$(prefix)"' \
373 -DEXEC_PREFIX='"$(exec_prefix)"' \
374 -DVERSION='"$(VERSION)"' \
375 -DVPATH='"$(VPATH)"' \
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000376 -o $@ $(srcdir)/Modules/getpath.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000377
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000378Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
379 $(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000380
381
382$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
Neil Schemenauer7cd124c2001-02-27 02:19:16 +0000383 -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000384
385$(PGEN): $(PGENOBJS)
386 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
387
388Parser/grammar.o: $(srcdir)/Parser/grammar.c \
389 $(srcdir)/Parser/assert.h \
390 $(srcdir)/Include/token.h \
391 $(srcdir)/Include/grammar.h
392Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
393
394
Neil Schemenauer40417742001-02-27 02:45:36 +0000395Python/compile.o Python/symtable.o: $(GRAMMAR_H)
396
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000397Python/getplatform.o: $(srcdir)/Python/getplatform.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000398 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000399
400Python/importdl.o: $(srcdir)/Python/importdl.c
Sjoerd Mullender30be8702001-01-29 09:39:14 +0000401 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000402
Neil Schemenauera35c6882001-02-27 04:45:05 +0000403Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000404
405Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
406 $(srcdir)/Objects/unicodetype_db.h
407
408
409############################################################################
410# Header files
411
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000412PYTHON_HEADERS= \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000413 Include/Python.h \
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000414 config.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000415 Include/patchlevel.h \
416 Include/pyport.h \
417 Include/pymem.h \
418 Include/object.h \
419 Include/objimpl.h \
Jeremy Hylton96da8b62001-02-02 19:54:23 +0000420 Include/compile.h \
421 Include/symtable.h \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000422 Include/pydebug.h \
423 Include/unicodeobject.h \
424 Include/intobject.h \
425 Include/longobject.h \
426 Include/floatobject.h \
427 Include/complexobject.h \
428 Include/rangeobject.h \
429 Include/stringobject.h \
430 Include/bufferobject.h \
431 Include/tupleobject.h \
432 Include/listobject.h \
433 Include/dictobject.h \
434 Include/methodobject.h \
435 Include/moduleobject.h \
436 Include/funcobject.h \
437 Include/classobject.h \
438 Include/fileobject.h \
439 Include/cobject.h \
440 Include/traceback.h \
441 Include/sliceobject.h \
442 Include/codecs.h \
443 Include/pyerrors.h \
444 Include/pystate.h \
445 Include/modsupport.h \
446 Include/ceval.h \
447 Include/pythonrun.h \
448 Include/sysmodule.h \
449 Include/intrcheck.h \
450 Include/import.h \
451 Include/abstract.h \
452 Include/pyfpe.h
453
Neil Schemenauerf65e5002001-01-25 20:07:50 +0000454$(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS)
455
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000456
457######################################################################
458
459# Test the interpreter (twice, once without .pyc files, once with)
460TESTOPTS= -l
461TESTPROG= $(srcdir)/Lib/test/regrtest.py
462TESTPYTHON= ./$(PYTHON) -tt
463test: all platform
464 -rm -f $(srcdir)/Lib/test/*.py[co]
465 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
466 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
467
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000468QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
Fred Drake042f3132001-02-02 03:03:33 +0000469 test_unicodedata test_re test_sre test_select test_poll \
Jeremy Hylton26d1f142001-02-02 18:12:16 +0000470 test_linuxaudiodev test_sunaudiodev
Jeremy Hylton2a850d92001-02-01 19:51:28 +0000471quicktest: all platform
472 -rm -f $(srcdir)/Lib/test/*.py[co]
473 -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
474 PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
475
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000476# Install everything
477install: altinstall bininstall maninstall
478
479# Install almost everything without disturbing previous versions
Andrew M. Kuchlingbddd8782001-01-29 20:18:59 +0000480altinstall: altbininstall libinstall inclinstall libainstall \
481 sharedinstall oldsharedinstall
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000482
483# Install shared libraries enabled by Setup
484DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
485
486oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
487 @for i in X $(SHAREDMODS); do \
Neil Schemenauerac959772001-02-06 14:50:27 +0000488 if test $$i != X; then \
489 echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
490 $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
491 fi; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000492 done
493
494$(DESTSHARED):
495 @for i in $(DESTDIRS); \
496 do \
497 if test ! -d $$i; then \
498 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000499 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000500 else true; \
501 fi; \
502 done
503
504
505# Install the interpreter (by creating a hard link to python$(VERSION))
506bininstall: altbininstall
507 -if test -f $(BINDIR)/$(PYTHON); \
508 then rm -f $(BINDIR)/$(PYTHON); \
509 else true; \
510 fi
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000511 (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000512
513# Install the interpreter with $(VERSION) affixed
514# This goes into $(exec_prefix)
515altbininstall: $(PYTHON)
516 @for i in $(BINDIR); \
517 do \
518 if test ! -d $$i; then \
519 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000520 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000521 else true; \
522 fi; \
523 done
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000524 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXE)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000525 if test -f libpython$(VERSION).so; then \
526 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
527 else true; \
528 fi
529 if test -f "$(DLLLIBRARY)"; then \
530 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
531 else true; \
532 fi
533
534# Install the manual page
535maninstall:
536 @for i in $(MANDIR) $(MANDIR)/man1; \
537 do \
538 if test ! -d $$i; then \
539 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000540 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000541 else true; \
542 fi; \
543 done
544 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
545 $(MANDIR)/man1/python.1
546
547# Install the library
548PLATDIR= plat-$(MACHDEP)
549MACHDEPS= $(PLATDIR)
550XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
551LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
552 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000553libinstall: $(PYTHON) $(srcdir)/Lib/$(PLATDIR)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000554 @for i in $(SCRIPTDIR) $(LIBDEST); \
555 do \
556 if test ! -d $$i; then \
557 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000558 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000559 else true; \
560 fi; \
561 done
562 @for d in $(LIBSUBDIRS); \
563 do \
564 a=$(srcdir)/Lib/$$d; \
565 if test ! -d $$a; then continue; else true; fi; \
566 b=$(LIBDEST)/$$d; \
567 if test ! -d $$b; then \
568 echo "Creating directory $$b"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000569 $(INSTALL) -d -m $(DIRMODE) $$b; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000570 else true; \
571 fi; \
572 done
573 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
574 do \
575 if test -x $$i; then \
576 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
577 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
578 else \
579 $(INSTALL_DATA) $$i $(LIBDEST); \
580 echo $(INSTALL_DATA) $$i $(LIBDEST); \
581 fi; \
582 done
583 @for d in $(LIBSUBDIRS); \
584 do \
585 a=$(srcdir)/Lib/$$d; \
586 if test ! -d $$a; then continue; else true; fi; \
587 b=$(LIBDEST)/$$d; \
588 for i in $$a/*; \
589 do \
590 case $$i in \
591 *CVS) ;; \
592 *.py[co]) ;; \
593 *.orig) ;; \
594 *~) ;; \
595 *) \
596 if test -d $$i; then continue; fi; \
597 if test -x $$i; then \
598 echo $(INSTALL_PROGRAM) $$i $$b; \
599 $(INSTALL_PROGRAM) $$i $$b; \
600 else \
601 echo $(INSTALL_DATA) $$i $$b; \
602 $(INSTALL_DATA) $$i $$b; \
603 fi;; \
604 esac; \
605 done; \
606 done
607 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
608 PYTHONPATH=$(LIBDEST) \
609 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
610 PYTHONPATH=$(LIBDEST) \
611 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
612
613# Create the PLATDIR source directory, if one wasn't distributed..
614$(srcdir)/Lib/$(PLATDIR):
615 mkdir $(srcdir)/Lib/$(PLATDIR)
616 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
617 export PATH; PATH="`pwd`:$$PATH"; \
618 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000619 export EXE; EXE="$(EXE)"; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000620 cd $(srcdir)/Lib/$(PLATDIR); ./regen
621
622# Install the include files
623INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
624inclinstall:
625 @for i in $(INCLDIRSTOMAKE); \
626 do \
627 if test ! -d $$i; then \
628 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000629 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000630 else true; \
631 fi; \
632 done
633 @for i in $(srcdir)/Include/*.h; \
634 do \
635 echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
636 $(INSTALL_DATA) $$i $(INCLUDEPY); \
637 done
638 $(INSTALL_DATA) config.h $(CONFINCLUDEPY)/config.h
639
640# Install the library and miscellaneous stuff needed for extending/embedding
641# This goes into $(exec_prefix)
642LIBPL= $(LIBP)/config
643libainstall: all
644 @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
645 do \
646 if test ! -d $$i; then \
647 echo "Creating directory $$i"; \
Neil Schemenauer8d3274e2001-02-10 20:07:38 +0000648 $(INSTALL) -d -m $(DIRMODE) $$i; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000649 else true; \
650 fi; \
651 done
652 @if test -d $(LDLIBRARY); then :; else \
653 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
654 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
655 fi
656 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
657 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
658 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
659 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
660 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
661 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
662 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
663 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
664 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
665 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
666 @if [ -s Modules/python.exp -a \
667 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
668 echo; echo "Installing support files for building shared extension modules on AIX:"; \
669 $(INSTALL_DATA) Modules/python.exp \
670 $(LIBPL)/python.exp; \
671 echo; echo "$(LIBPL)/python.exp"; \
672 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
673 $(LIBPL)/makexp_aix; \
674 echo "$(LIBPL)/makexp_aix"; \
675 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
676 $(LIBPL)/ld_so_aix; \
677 echo "$(LIBPL)/ld_so_aix"; \
678 echo; echo "See Misc/AIX-NOTES for details."; \
679 else true; \
680 fi
681 @case "$(MACHDEP)" in beos*) \
682 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000683 $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000684 echo; echo "$(LIBPL)/README"; \
Neil Schemenauer75e33892001-02-16 03:36:53 +0000685 $(INSTALL_PROGRAM) Modules/ar_beos $(LIBPL)/ar_beos; \
686 echo "$(LIBPL)/ar_beos"; \
687 $(INSTALL_PROGRAM) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \
688 echo "$(LIBPL)/ld_so_beos"; \
689 echo; echo "See Misc/BeOS-NOTES for details."; \
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000690 ;; \
691 esac
692
693# Install the dynamically loadable modules
694# This goes into $(exec_prefix)
695sharedinstall:
Neil Schemenauercf9926c2001-02-27 18:50:56 +0000696 PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py install \
Andrew M. Kuchling03184e22001-01-26 22:52:45 +0000697 --install-platlib=$(DESTSHARED)
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000698
699# Build the toplevel Makefile
700Makefile.pre: Makefile.pre.in config.status
701 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
702 $(MAKE) -f Makefile.pre Makefile
703
704# Run the configure script. If config.status already exists,
705# call it with the --recheck argument, which reruns configure with the
706# same options as it was run last time; otherwise run the configure
707# script with options taken from the $(WITH) variable
708config.status: $(srcdir)/configure
709 if test -f config.status; \
710 then $(SHELL) config.status --recheck; \
711 $(SHELL) config.status; \
712 else $(SHELL) $(srcdir)/configure $(WITH); \
713 fi
714
715.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
716
717# Some make's put the object file in the current directory
718.c.o:
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000719 $(CC) -c $(PY_CFLAGS) -o $@ $<
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000720
721# Rerun configure with the same options as it was run last time,
722# provided the config.status script exists
723recheck:
724 $(SHELL) config.status --recheck
725 $(SHELL) config.status
726
727# Rebuild the configure script from configure.in; also rebuild config.h.in
728autoconf:
729 (cd $(srcdir); autoconf)
730 (cd $(srcdir); autoheader)
731
732# Create a tags file for vi
733tags::
734 cd $(srcdir); \
735 ctags -w -t Include/*.h; \
736 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
737 done; \
738 sort tags -o tags
739
740# Create a tags file for GNU Emacs
741TAGS::
742 cd $(srcdir); \
743 etags Include/*.h; \
744 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
745
746# Sanitation targets -- clean leaves libraries, executables and tags
747# files, which clobber removes those as well
748
749clean:
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000750 find . -name '*.o' -exec rm -f {} ';'
Neil Schemenauere0d43572001-02-03 17:16:29 +0000751 find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000752
753clobber: clean
Neil Schemenauerc5cfcb42001-02-19 04:35:11 +0000754 -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
755 Modules/*.so Modules/*.sl tags TAGS \
756 config.cache config.log config.h Modules/config.c
Neil Schemenauere0d43572001-02-03 17:16:29 +0000757 -rm -rf build
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000758
759# Make things extra clean, before making a distribution:
760# remove all generated files, even Makefile[.pre]
761distclean: clobber
Neil Schemenauere0d43572001-02-03 17:16:29 +0000762 -rm -f core Makefile Makefile.pre buildno config.status \
Neil Schemenauer7ac954b2001-01-26 16:14:41 +0000763 Modules/Setup Modules/Setup.local Modules/Setup.config
Neil Schemenauere0d43572001-02-03 17:16:29 +0000764 find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
765 -o -name '[@,#]*' -o -name '*.old' \
766 -o -name '*.orig' -o -name '*.rej' \
767 -o -name '*.bak' ')' \
768 -exec rm -f {} ';'
Neil Schemenauer85515ad2001-01-24 17:11:43 +0000769
770# Check for smelly exported symbols (not starting with Py/_Py)
771smelly: all
772 nm -p $(LIBRARY) | \
773 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
774
775# Find files with funny names
776funny:
777 find $(DISTDIRS) -type d \
778 -o -name '*.[chs]' \
779 -o -name '*.py' \
780 -o -name '*.doc' \
781 -o -name '*.sty' \
782 -o -name '*.bib' \
783 -o -name '*.dat' \
784 -o -name '*.el' \
785 -o -name '*.fd' \
786 -o -name '*.in' \
787 -o -name '*.tex' \
788 -o -name '*,[vpt]' \
789 -o -name 'Setup' \
790 -o -name 'Setup.*' \
791 -o -name README \
792 -o -name Makefile \
793 -o -name ChangeLog \
794 -o -name Repository \
795 -o -name Root \
796 -o -name Entries \
797 -o -name Tag \
798 -o -name tags \
799 -o -name TAGS \
800 -o -name .cvsignore \
801 -o -name MANIFEST \
802 -o -print
803
804# IF YOU PUT ANYTHING HERE IT WILL GO AWAY