1 ########################################################################
2 # Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
3 # Amsterdam, The Netherlands.
7 # Permission to use, copy, modify, and distribute this software and its
8 # documentation for any purpose and without fee is hereby granted,
9 # provided that the above copyright notice appear in all copies and that
10 # both that copyright notice and this permission notice appear in
11 # supporting documentation, and that the names of Stichting Mathematisch
12 # Centrum or CWI not be used in advertising or publicity pertaining to
13 # distribution of the software without specific, written prior permission.
15 # STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 # FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 # FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 ########################################################################
24 # Toplevel Makefile for Python
25 # Note -- if recursive makes fail, try adding MAKE=make
27 # Substitutions by configure
32 # Install prefixes are treated specially by the configure script:
33 # it only changes these lines if it has received a --prefix=... or
34 # --exec-prefix-... command line option, or if it has figured out
35 # a value by searching for python in $PATH. Note that $(prefix) is
36 # also used when compiling config.c in Modules to set the default
37 # module search path, so if you change it later be sure to change it
38 # there too and rebuild.
40 # Install prefix for architecture-independent files
43 # Install prefix for architecture-dependent files
44 exec_prefix= $(prefix)
49 # --with-PACKAGE options for configure script
50 # e.g. --with-readline --with-svr5 --with-solaris --with-thread
51 # (see README for an explanation)
54 # Compiler options passed to subordinate makes
57 # Subdirectories where to run make recursively
58 SUBDIRS
= Parser Objects Python Modules
60 # Other subdirectories
61 SUBDIRSTOO
= Include Lib Doc Misc Demo readline Grammar
63 # Files and directories to be distributed
64 CONFIGFILES
= configure configure.in acconfig.h config.h.in Makefile.in
65 DISTFILES
= README ChangeLog
$(CONFIGFILES
)
66 DISTDIRS
= $(SUBDIRS
) $(SUBDIRSTOO
) Ext-dummy
67 DIST
= $(DISTFILES
) $(DISTDIRS
)
72 # Build the interpreter
74 for i in
$(SUBDIRS
); do \
75 (echo
$$i; cd
$$i; $(MAKE
) OPT
="$(OPT)" all); \
78 # Test the interpreter (twice, once without .pyc files, once with)
79 TESTPATH
= $(srcdir)/Lib
:$(srcdir)/Lib
/test
81 -rm -f
$(srcdir)/Lib
/test/*.pyc
82 PYTHONPATH
=$(TESTPATH
) .
/python
-c
'import autotest'
83 PYTHONPATH
=$(TESTPATH
) .
/python
-c
'import autotest'
85 # Install the interpreter
87 $(INSTALL
) python
$(exec_prefix)/bin
/python
88 @echo If this is your first time
, consider make libinstall...
90 # Install the library.
91 # If your system does not support "cp -r", try "copy -r" or perhaps
92 # something like find Lib -print | cpio -pacvdmu $(DESTDIR)/lib/python
94 -if
test ! -d
$(prefix)/lib
/python
; \
95 then mkdir
$(prefix)/lib
/python
; \
97 cp
-r
$(srcdir)/Lib
/* $(prefix)/lib
/python
98 @echo Ideally
, run something to compile
all modules now...
100 # install the manual page
102 $(INSTALL
) $(srcdir)/Misc
/python.man \
103 $(prefix)/man
/man1
/python
.1
105 # install the include files
107 -if
test ! -d
$(prefix)/include/Py
; \
108 then mkdir
$(prefix)/include/Py
; \
110 cp
$(srcdir)/Include
/*.h
$(prefix)/include/Py
112 # install the lib*.a files and miscellaneous stuff needed by extensions
113 LIBP
= $(exec_prefix)/lib
/python
116 -if
test ! -d
$(LIBP
); \
117 then mkdir
$(LIBP
); \
119 -if
test ! -d
$(LIBPL
); \
120 then mkdir
$(LIBPL
); \
122 for i in
$(SUBDIRS
); do \
123 echo
$$i; $(INSTALL
) $$i/lib
$$i.a
$(LIBPL
)/lib
$$i.a
; \
125 $(INSTALL
) Modules
/config.c
$(LIBPL
)/config.c
126 $(INSTALL
) $(srcdir)/Modules
/config.c.in
$(LIBPL
)/config.c.in
127 $(INSTALL
) Modules
/Makefile
$(LIBPL
)/Makefile
128 $(INSTALL
) Modules
/Setup
$(LIBPL
)/Setup
129 $(INSTALL
) $(srcdir)/Modules
/makesetup
$(LIBPL
)/makesetup
130 $(INSTALL
) config.h
$(LIBPL
)/config.h
132 # Build the sub-Makefiles
133 Makefiles
: config.status
134 (cd Modules
; $(MAKE
) -f Makefile.pre Makefile
)
135 for i in .
$(SUBDIRS
); do \
136 (echo
$$i; cd
$$i; $(MAKE
) Makefile
); \
139 # Build the toplevel Makefile
140 Makefile
: Makefile.in
141 CONFIG_FILES
=Makefile CONFIG_HEADERS
= $(SHELL
) config.status
143 # Run the configure script. If config.status already exists,
144 # call it with the --recheck argument, which reruns configure with the
145 # same options as it was run last time; otherwise run the configure
146 # script with options taken from the $(WITH) variable
147 config.status
: $(srcdir)/configure
148 if
test -f config.status
; \
149 then
$(SHELL
) config.status
--recheck
; \
150 else $(SHELL
) $(srcdir)/configure
$(WITH
); \
153 .PRECIOUS
: config.status python
155 # Rerun configure with the same options as it was run last time,
156 # provided the config.status script exists
158 $(SHELL
) config.status
--recheck
160 # Rebuild the configure script from configure.in; also rebuild config.h.in
162 (cd
$(srcdir); autoconf
; autoheader
)
164 # Create a tags file for vi
166 ctags
-w
-t Include
/*.h
167 for i in
$(SUBDIRS
); do ctags
-w
-t
-a
$$i/*.
[ch
]; done
170 # Create a tags file for GNU Emacs
173 for i in
$(SUBDIRS
); do etags
-t
-a
$$i/*.
[ch
]; done
175 # Add dependencies to sub-Makefiles
177 for i in
$(SUBDIRS
); do \
178 (echo
$$i; cd
$$i; $(MAKE
) depend
); \
181 # Sanitation targets -- clean leaves libraries, executables and tags
182 # files, which clobber removes those as well
185 -rm -f core
*~
[@
,#]* *.old *.orig *.rej
188 -for i in
$(SUBDIRS
); do \
190 if
test -f Makefile
; \
191 then
$(MAKE
) clean; \
192 else $(MAKE
) -f Makefile.
*in
clean; \
196 localclobber
: localclean
197 -rm -f
tags TAGS config.status
199 clobber: localclobber
200 -for i in
$(SUBDIRS
); do \
202 if
test -f Makefile
; \
203 then
$(MAKE
) clobber; \
204 else $(MAKE
) -f Makefile.in
clobber; \
208 # Make things extra clean, before making a distribution
210 -$(MAKE
) SUBDIRS
="$(SUBDIRSTOO)" clobber
211 -rm -f config.h Makefile
212 -for i in
$(SUBDIRS
) $(SUBDIRSTOO
); do \
213 for f in
$$i/*.in
; do \
214 f
=`basename "$$f" .in`; \
215 if
test "$$f" != "*"; then \
216 echo
rm -f
"$$i/$$f"; \
222 # Find files with funny names
224 find
$(DISTDIRS
) -type d \
242 -o
-name Repository \
247 -o
-name .cvsignore \
251 # Build a distribution tar file (run make distclean first)
252 # (This leaves the RCS and CVS directories in :-( )
254 tar cf
- $(DIST
) | compress
>dist.
tar.Z