blob: cd5436ff7bf52af271cac41176913232c4a9de1d [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@
74
75# Machine-dependent subdirectories
76MACHDEP= @MACHDEP@
77
78# Install prefix for architecture-independent files
79prefix= @prefix@
80
81# Install prefix for architecture-dependent files
82exec_prefix= @exec_prefix@
83
84# Expanded directories
85BINDIR= $(exec_prefix)/bin
86LIBDIR= $(exec_prefix)/lib
87MANDIR= $(prefix)/man
88INCLUDEDIR= $(prefix)/include
89CONFINCLUDEDIR= $(exec_prefix)/include
90SCRIPTDIR= $(prefix)/lib
91
92# Detailed destination directories
93BINLIBDEST= $(LIBDIR)/python$(VERSION)
94LIBDEST= $(SCRIPTDIR)/python$(VERSION)
95INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
96CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
97LIBP= $(LIBDIR)/python$(VERSION)
98
99# Symbols used for using shared libraries
100SO= @SO@
101LDSHARED= @LDSHARED@
102CCSHARED= @CCSHARED@
103LINKFORSHARED= @LINKFORSHARED@
104DESTSHARED= $(BINLIBDEST)/lib-dynload
105
106# Executable suffix (.exe on Windows and Mac OS X)
107EXEEXT= @EXEEXT@
108
109# Modes for directories, executables and data files created by the
110# install process. Default to user-only-writable for all file types.
111DIRMODE= 755
112EXEMODE= 755
113FILEMODE= 644
114
115# --with-PACKAGE options for configure script
116# e.g. --with-readline --with-svr5 --with-solaris --with-thread
117# (see README for an explanation)
118WITH=
119
120
121# Subdirectories with code
122SRCDIRS= @SRCDIRS@
123
124# Other subdirectories
125SUBDIRSTOO= Include Lib Misc Demo
126
127# Files and directories to be distributed
128CONFIGFILES= configure configure.in acconfig.h config.h.in Makefile.pre.in
129DISTFILES= README ChangeLog $(CONFIGFILES)
130DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
131DIST= $(DISTFILES) $(DISTDIRS)
132
133
134LIBRARY= libpython$(VERSION).a
135LDLIBRARY= @LDLIBRARY@
136DLLLIBRARY= @DLLLIBRARY@
137
138
139LIBS= @LIBS@
140LIBM= @LIBM@
141LIBC= @LIBC@
142SYSLIBS= $(LIBM) $(LIBC)
143
144MAINOBJ= @MAINOBJ@
145LIBOBJS= @LIBOBJS@
146DLINCLDIR= @DLINCLDIR@
147DYNLOADFILE= @DYNLOADFILE@
148
149PYTHON= python$(EXEEXT)
150
151# === Definitions added by makesetup ===
152
153
154##########################################################################
155# Modules
156MODULE_OBJS= \
157 Modules/config.o \
158 Modules/getpath.o \
159 Modules/main.o \
160 Modules/getbuildinfo.o
161
162# Used of signalmodule.o is not available
163SIGNAL_OBJS= @SIGNAL_OBJS@
164
165
166##########################################################################
167# Grammar
168GRAMMAR_H= $(srcdir)/Include/graminit.h
169GRAMMAR_C= $(srcdir)/Python/graminit.c
170GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
171
172
173##########################################################################
174# Parser
175PGEN= Parser/pgen$(EXEEXT)
176
177POBJS= \
178 Parser/acceler.o \
179 Parser/grammar1.o \
180 Parser/listnode.o \
181 Parser/node.o \
182 Parser/parser.o \
183 Parser/parsetok.o \
184 Parser/tokenizer.o \
185 Parser/bitset.o \
186 Parser/metagrammar.o
187
188PARSER_OBJS= $(POBJS) Parser/myreadline.o
189
190PGOBJS= \
191 Parser/firstsets.o \
192 Parser/grammar.o \
193 Parser/pgen.o \
194 Parser/printgrammar.o \
195 Parser/pgenmain.o
196
197PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
198
199
200##########################################################################
201# Python
202PYTHON_OBJS= \
203 Python/bltinmodule.o \
204 Python/exceptions.o \
205 Python/ceval.o \
206 Python/compile.o \
207 Python/codecs.o \
208 Python/errors.o \
209 Python/frozen.o \
210 Python/frozenmain.o \
211 Python/getargs.o \
212 Python/getcompiler.o \
213 Python/getcopyright.o \
214 Python/getmtime.o \
215 Python/getplatform.o \
216 Python/getversion.o \
217 Python/graminit.o \
218 Python/import.o \
219 Python/importdl.o \
220 Python/marshal.o \
221 Python/modsupport.o \
222 Python/mystrtoul.o \
223 Python/pyfpe.o \
224 Python/pystate.o \
225 Python/pythonrun.o \
226 Python/structmember.o \
227 Python/sysmodule.o \
228 Python/traceback.o \
229 Python/getopt.o \
230 Python/$(DYNLOADFILE) \
231 $(LIBOBJS)
232
233
234##########################################################################
235# Objects
236OBJECT_OBJS= \
237 Objects/abstract.o \
238 Objects/bufferobject.o \
239 Objects/classobject.o \
240 Objects/cobject.o \
241 Objects/complexobject.o \
242 Objects/fileobject.o \
243 Objects/floatobject.o \
244 Objects/frameobject.o \
245 Objects/funcobject.o \
246 Objects/intobject.o \
247 Objects/listobject.o \
248 Objects/longobject.o \
249 Objects/dictobject.o \
250 Objects/methodobject.o \
251 Objects/moduleobject.o \
252 Objects/object.o \
253 Objects/rangeobject.o \
254 Objects/sliceobject.o \
255 Objects/stringobject.o \
256 Objects/tupleobject.o \
257 Objects/typeobject.o \
258 Objects/unicodeobject.o \
259 Objects/unicodectype.o
260
261
262##########################################################################
263# objects that get linked into the Python library
264LIBRARY_OBJS= \
265 $(PARSER_OBJS) \
266 $(OBJECT_OBJS) \
267 $(PYTHON_OBJS) \
268 $(MODULE_OBJS) \
269 $(SIGNAL_OBJS) \
270 $(MODOBJS)
271
272
273#########################################################################
274# Rules
275
276# Default target
277all: $(PYTHON) sharedmods
278
279# Build the interpreter
280$(PYTHON): $(MAINOBJ) $(LDLIBRARY)
281 expr `cat buildno` + 1 >buildno1
282 mv -f buildno1 buildno
283 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ $(MAINOBJ) \
284 $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
285
286buildno:
287 echo 1 >buildno
288
289platform: $(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
297# Build static library
298$(LIBRARY): $(LIBRARY_OBJS)
299 -rm -f $@
300 # avoid long command lines, same as LIBRARY_OBJS
301 $(AR) cr $@ $(PARSER_OBJS)
302 $(AR) cr $@ $(OBJECT_OBJS)
303 $(AR) cr $@ $(PYTHON_OBJS)
304 $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
305 $(AR) cr $@ $(MODOBJS)
306 $(RANLIB) $@
307
308# This rule is only here for DG/UX and BeOS!!!
309libpython$(VERSION).so: $(LIBRARY)
310 case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
311 *dgux*) \
312 test -d dgux || mkdir dgux; \
313 (cd dgux;ar x ../$^;ld -G -o ../$@ * ); \
314 /bin/rm -rf ./dgux \
315 ;; \
316 beos) \
317 $(srcdir)/BeOS/ar-fake so $(LIBRARY) $@ \
318 ;; \
319 esac
320
321# This rule is here for OPENSTEP/Rhapsody/MacOSX
322libpython$(VERSION).dylib: $(LIBRARY)
323 libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
324 -framework System @LIBTOOL_CRUFT@
325
326# This rule builds the Cygwin Python DLL
327libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
328 dlltool --export-all --output-def $@ $^
329 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
330 $(LIBS) $(MODLIBS) $(SYSLIBS)
331
332
333oldsharedmods: $(SHAREDMODS)
334
335
336Makefile Modules/config.c: Makefile.pre \
337 $(srcdir)/Modules/config.c.in \
338 $(MAKESETUP) \
339 Modules/Setup.config \
340 Modules/Setup \
341 Modules/Setup.local
342 $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
343 -s Modules \
344 Modules/Setup.config \
345 Modules/Setup.local \
346 Modules/Setup
347 @mv config.c Modules
348 @echo "The Makefile was updated, you may need to re-run make."
349
350
351Modules/Setup: $(srcdir)/Modules/Setup.dist
352 @if test -f Modules/Setup; then \
353 echo "-----------------------------------------------"; \
354 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
355 echo "check to make sure you have all the updates you"; \
356 echo "need in your Modules/Setup file."; \
357 echo "-----------------------------------------------"; \
358 else cp $(srcdir)/Modules/Setup.dist Modules/Setup; fi
359
360
361Modules/Setup.local:
362 @echo "# Edit this file for local setup changes" >Modules/Setup.local
363
364
365############################################################################
366# Special rules for object files
367
368Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
369 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
370 $(srcdir)/Modules/getbuildinfo.c \
371 -o Modules/getbuildinfo.o
372
373Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
374 $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
375 -DPREFIX='"$(prefix)"' \
376 -DEXEC_PREFIX='"$(exec_prefix)"' \
377 -DVERSION='"$(VERSION)"' \
378 -DVPATH='"$(VPATH)"' \
379 $(srcdir)/Modules/getpath.c -o $@
380
381Modules/ccpython.o: Modules/ccpython.cc
382 $(CXX) $(CFLAGS) -c $< -o $@
383
384
385$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
386 $(PGEN) $(GRAMMAR_INPUT)
387 mv graminit.h $(GRAMMAR_H)
388 mv graminit.c $(GRAMMAR_C)
389
390$(PGEN): $(PGENOBJS)
391 $(CC) $(OPT) $(PGENOBJS) $(LIBS) -o $(PGEN)
392
393Parser/grammar.o: $(srcdir)/Parser/grammar.c \
394 $(srcdir)/Parser/assert.h \
395 $(srcdir)/Include/token.h \
396 $(srcdir)/Include/grammar.h
397Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
398
399
400Python/getplatform.o: $(srcdir)/Python/getplatform.c
401 $(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' \
402 -o Python/getplatform.o $(srcdir)/Python/getplatform.c
403
404Python/importdl.o: $(srcdir)/Python/importdl.c
405 $(CC) -c $(CFLAGS) -I$(DLINCLDIR) \
406 -o Python/importdl.o $(srcdir)/Python/importdl.c
407
408
409Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
410 $(srcdir)/Objects/unicodetype_db.h
411
412
413############################################################################
414# Header files
415
416$(LIBRARY_OBJS) $(MAINOBJ): \
417 config.h \
418 Include/Python.h \
419 Include/patchlevel.h \
420 Include/pyport.h \
421 Include/pymem.h \
422 Include/object.h \
423 Include/objimpl.h \
424 Include/pydebug.h \
425 Include/unicodeobject.h \
426 Include/intobject.h \
427 Include/longobject.h \
428 Include/floatobject.h \
429 Include/complexobject.h \
430 Include/rangeobject.h \
431 Include/stringobject.h \
432 Include/bufferobject.h \
433 Include/tupleobject.h \
434 Include/listobject.h \
435 Include/dictobject.h \
436 Include/methodobject.h \
437 Include/moduleobject.h \
438 Include/funcobject.h \
439 Include/classobject.h \
440 Include/fileobject.h \
441 Include/cobject.h \
442 Include/traceback.h \
443 Include/sliceobject.h \
444 Include/codecs.h \
445 Include/pyerrors.h \
446 Include/pystate.h \
447 Include/modsupport.h \
448 Include/ceval.h \
449 Include/pythonrun.h \
450 Include/sysmodule.h \
451 Include/intrcheck.h \
452 Include/import.h \
453 Include/abstract.h \
454 Include/pyfpe.h
455
456
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
468# Install everything
469install: altinstall bininstall maninstall
470
471# Install almost everything without disturbing previous versions
472altinstall: altbininstall libinstall inclinstall libainstall sharedinstall
473
474# Install shared libraries enabled by Setup
475DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
476
477oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
478 @for i in X $(SHAREDMODS); do \
479 if test $$i != X; \
480 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
481 fi; \
482 done
483
484$(DESTSHARED):
485 @for i in $(DESTDIRS); \
486 do \
487 if test ! -d $$i; then \
488 echo "Creating directory $$i"; \
489 mkdir $$i; \
490 chmod 755 $$i; \
491 else true; \
492 fi; \
493 done
494
495
496# Install the interpreter (by creating a hard link to python$(VERSION))
497bininstall: altbininstall
498 -if test -f $(BINDIR)/$(PYTHON); \
499 then rm -f $(BINDIR)/$(PYTHON); \
500 else true; \
501 fi
502 (cd $(BINDIR); $(LN) python$(VERSION)$(EXEEXT) python$(EXEEXT))
503
504# Install the interpreter with $(VERSION) affixed
505# This goes into $(exec_prefix)
506altbininstall: $(PYTHON)
507 @for i in $(BINDIR); \
508 do \
509 if test ! -d $$i; then \
510 echo "Creating directory $$i"; \
511 mkdir $$i; \
512 chmod $(DIRMODE) $$i; \
513 else true; \
514 fi; \
515 done
516 $(INSTALL_PROGRAM) $(PYTHON) $(BINDIR)/python$(VERSION)$(EXEEXT)
517 if test -f libpython$(VERSION).so; then \
518 $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
519 else true; \
520 fi
521 if test -f "$(DLLLIBRARY)"; then \
522 $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
523 else true; \
524 fi
525
526# Install the manual page
527maninstall:
528 @for i in $(MANDIR) $(MANDIR)/man1; \
529 do \
530 if test ! -d $$i; then \
531 echo "Creating directory $$i"; \
532 mkdir $$i; \
533 chmod $(DIRMODE) $$i; \
534 else true; \
535 fi; \
536 done
537 $(INSTALL_DATA) $(srcdir)/Misc/python.man \
538 $(MANDIR)/man1/python.1
539
540# Install the library
541PLATDIR= plat-$(MACHDEP)
542MACHDEPS= $(PLATDIR)
543XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax
544LIBSUBDIRS= lib-old lib-tk site-packages test test/output encodings \
545 distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS)
546libinstall: python $(srcdir)/Lib/$(PLATDIR)
547 @for i in $(SCRIPTDIR) $(LIBDEST); \
548 do \
549 if test ! -d $$i; then \
550 echo "Creating directory $$i"; \
551 mkdir $$i; \
552 chmod $(DIRMODE) $$i; \
553 else true; \
554 fi; \
555 done
556 @for d in $(LIBSUBDIRS); \
557 do \
558 a=$(srcdir)/Lib/$$d; \
559 if test ! -d $$a; then continue; else true; fi; \
560 b=$(LIBDEST)/$$d; \
561 if test ! -d $$b; then \
562 echo "Creating directory $$b"; \
563 mkdir $$b; \
564 chmod $(DIRMODE) $$b; \
565 else true; \
566 fi; \
567 done
568 @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc; \
569 do \
570 if test -x $$i; then \
571 $(INSTALL_PROGRAM) $$i $(LIBDEST); \
572 echo $(INSTALL_PROGRAM) $$i $(LIBDEST); \
573 else \
574 $(INSTALL_DATA) $$i $(LIBDEST); \
575 echo $(INSTALL_DATA) $$i $(LIBDEST); \
576 fi; \
577 done
578 @for d in $(LIBSUBDIRS); \
579 do \
580 a=$(srcdir)/Lib/$$d; \
581 if test ! -d $$a; then continue; else true; fi; \
582 b=$(LIBDEST)/$$d; \
583 for i in $$a/*; \
584 do \
585 case $$i in \
586 *CVS) ;; \
587 *.py[co]) ;; \
588 *.orig) ;; \
589 *~) ;; \
590 *) \
591 if test -d $$i; then continue; fi; \
592 if test -x $$i; then \
593 echo $(INSTALL_PROGRAM) $$i $$b; \
594 $(INSTALL_PROGRAM) $$i $$b; \
595 else \
596 echo $(INSTALL_DATA) $$i $$b; \
597 $(INSTALL_DATA) $$i $$b; \
598 fi;; \
599 esac; \
600 done; \
601 done
602 $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
603 PYTHONPATH=$(LIBDEST) \
604 ./$(PYTHON) -tt $(LIBDEST)/compileall.py $(LIBDEST)
605 PYTHONPATH=$(LIBDEST) \
606 ./$(PYTHON) -O $(LIBDEST)/compileall.py $(LIBDEST)
607
608# Create the PLATDIR source directory, if one wasn't distributed..
609$(srcdir)/Lib/$(PLATDIR):
610 mkdir $(srcdir)/Lib/$(PLATDIR)
611 cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
612 export PATH; PATH="`pwd`:$$PATH"; \
613 export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
614 export EXEEXT; EXEEXT="$(EXEEXT)"; \
615 cd $(srcdir)/Lib/$(PLATDIR); ./regen
616
617# Install the include files
618INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
619inclinstall:
620 @for i in $(INCLDIRSTOMAKE); \
621 do \
622 if test ! -d $$i; then \
623 echo "Creating directory $$i"; \
624 mkdir $$i; \
625 chmod $(DIRMODE) $$i; \
626 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"; \
644 mkdir $$i; \
645 chmod $(DIRMODE) $$i; \
646 else true; \
647 fi; \
648 done
649 @if test -d $(LDLIBRARY); then :; else \
650 $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
651 $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
652 fi
653 $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
654 $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
655 $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
656 $(INSTALL_DATA) Makefile $(LIBPL)/Makefile
657 $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup
658 $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local
659 $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config
660 $(INSTALL_PROGRAM) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
661 $(INSTALL_PROGRAM) $(srcdir)/install-sh $(LIBPL)/install-sh
662 $(INSTALL_DATA) $(srcdir)/Misc/Makefile.pre.in $(LIBPL)/Makefile.pre.in
663 @if [ -s Modules/python.exp -a \
664 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
665 echo; echo "Installing support files for building shared extension modules on AIX:"; \
666 $(INSTALL_DATA) Modules/python.exp \
667 $(LIBPL)/python.exp; \
668 echo; echo "$(LIBPL)/python.exp"; \
669 $(INSTALL_PROGRAM) $(srcdir)/Modules/makexp_aix \
670 $(LIBPL)/makexp_aix; \
671 echo "$(LIBPL)/makexp_aix"; \
672 $(INSTALL_PROGRAM) $(srcdir)/Modules/ld_so_aix \
673 $(LIBPL)/ld_so_aix; \
674 echo "$(LIBPL)/ld_so_aix"; \
675 echo; echo "See Misc/AIX-NOTES for details."; \
676 else true; \
677 fi
678 @case "$(MACHDEP)" in beos*) \
679 echo; echo "Installing support files for building shared extension modules on BeOS:"; \
680 $(INSTALL_DATA) BeOS/README $(LIBPL)/README; \
681 echo; echo "$(LIBPL)/README"; \
682 $(INSTALL_DATA) BeOS/README.readline-2.2 $(LIBPL)/README.readline-2.2; \
683 echo "$(LIBPL)/README.readline-2.2"; \
684 $(INSTALL_PROGRAM) BeOS/ar-fake $(LIBPL)/ar-fake; \
685 echo "$(LIBPL)/ar-fake"; \
686 $(INSTALL_PROGRAM) BeOS/linkmodule $(LIBPL)/linkmodule; \
687 echo "$(LIBPL)/linkmodule"; \
688 echo; echo "See BeOS/README for details."; \
689 ;; \
690 esac
691
692# Install the dynamically loadable modules
693# This goes into $(exec_prefix)
694sharedinstall:
695 ./$(PYTHON) $(srcdir)/setup.py install
696
697# Build the toplevel Makefile
698Makefile.pre: Makefile.pre.in config.status
699 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
700 $(MAKE) -f Makefile.pre Makefile
701
702# Run the configure script. If config.status already exists,
703# call it with the --recheck argument, which reruns configure with the
704# same options as it was run last time; otherwise run the configure
705# script with options taken from the $(WITH) variable
706config.status: $(srcdir)/configure
707 if test -f config.status; \
708 then $(SHELL) config.status --recheck; \
709 $(SHELL) config.status; \
710 else $(SHELL) $(srcdir)/configure $(WITH); \
711 fi
712
713.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre
714
715# Some make's put the object file in the current directory
716.c.o:
717 $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
718
719# Rerun configure with the same options as it was run last time,
720# provided the config.status script exists
721recheck:
722 $(SHELL) config.status --recheck
723 $(SHELL) config.status
724
725# Rebuild the configure script from configure.in; also rebuild config.h.in
726autoconf:
727 (cd $(srcdir); autoconf)
728 (cd $(srcdir); autoheader)
729
730# Create a tags file for vi
731tags::
732 cd $(srcdir); \
733 ctags -w -t Include/*.h; \
734 for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
735 done; \
736 sort tags -o tags
737
738# Create a tags file for GNU Emacs
739TAGS::
740 cd $(srcdir); \
741 etags Include/*.h; \
742 for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
743
744# Sanitation targets -- clean leaves libraries, executables and tags
745# files, which clobber removes those as well
746
747clean:
748 -rm -f core *~ [@,#]* *.old *.orig *.rej
749 -rm -rf build
750 # avoid long command lines, same as LIBRARY_OBJS MAINOBJ PGOBJS
751 -rm -f $(PARSER_OBJS)
752 -rm -f $(OBJECT_OBJS)
753 -rm -f $(PYTHON_OBJS)
754 -rm -f $(MODULE_OBJS) $(SIGNAL_OBJS)
755 -rm -f $(MODOBJS) $(MAINOBJ) $(PGOBJS)
756
757clobber: clean
758 -rm -f tags TAGS $(PYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY)
759 -rm -f Makefile.pre config.log config.cache config.h setup.cfg
760 -rm -f Modules/*.so Modules/*.sl
761
762# Make things extra clean, before making a distribution:
763# remove all generated files, even Makefile[.pre]
764distclean: clobber
765 -$(MAKE) -f $(srcdir)/Makefile.pre.in \
766 SUBDIRS="$(SUBDIRSTOO)" clobber
767 -rm -f config.status config.log config.cache config.h Makefile
768 -rm -f buildno Modules/Setup Modules/Setup.local Modules/Setup.config
769 -rm -f Modules/config.c
770 -for i in $(SUBDIRSTOO); do \
771 for f in $$i/*.in; do \
772 f=`basename "$$f" .in`; \
773 if test "$$f" != "*"; then \
774 echo rm -f "$$i/$$f"; \
775 rm -f "$$i/$$f"; \
776 fi; \
777 done; \
778 done
779
780# Check for smelly exported symbols (not starting with Py/_Py)
781smelly: all
782 nm -p $(LIBRARY) | \
783 sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
784
785# Find files with funny names
786funny:
787 find $(DISTDIRS) -type d \
788 -o -name '*.[chs]' \
789 -o -name '*.py' \
790 -o -name '*.doc' \
791 -o -name '*.sty' \
792 -o -name '*.bib' \
793 -o -name '*.dat' \
794 -o -name '*.el' \
795 -o -name '*.fd' \
796 -o -name '*.in' \
797 -o -name '*.tex' \
798 -o -name '*,[vpt]' \
799 -o -name 'Setup' \
800 -o -name 'Setup.*' \
801 -o -name README \
802 -o -name Makefile \
803 -o -name ChangeLog \
804 -o -name Repository \
805 -o -name Root \
806 -o -name Entries \
807 -o -name Tag \
808 -o -name tags \
809 -o -name TAGS \
810 -o -name .cvsignore \
811 -o -name MANIFEST \
812 -o -print
813
814# IF YOU PUT ANYTHING HERE IT WILL GO AWAY