1 ########################################################################
2 # Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
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 or Corporation for National Research Initiatives or
13 # CNRI not be used in advertising or publicity pertaining to
14 # distribution of the software without specific, written prior
17 # While CWI is the initial source for this software, a modified version
18 # is made available by the Corporation for National Research Initiatives
19 # (CNRI) at the Internet address ftp://ftp.python.org.
21 # STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22 # REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23 # MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24 # CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25 # DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26 # PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27 # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28 # PERFORMANCE OF THIS SOFTWARE.
29 ########################################################################
31 # Top-level Makefile for Python
33 # As distributed, this file is called Makefile.in; it is processed
34 # into the real Makefile by running the script ./configure, which
35 # replaces things like @spam@ with values appropriate for your system.
36 # This means that if you edit Makefile, your changes get lost the next
37 # time you run the configure script. Ideally, you can do:
44 # The top-level Makefile invokes make recursively in a number of
45 # subdirectories (see the SUBDIRS variable below). If you want to,
46 # you can invoke make in individual subdirectories. However, the
47 # sub-Makefiles are also generated by configure, and the quickest way
48 # to make sure they are up to date is by running make (or "make
49 # Makefiles") at the top level. This is particularly important for
50 # Modules/Makefile, which has to be regenerated every time you edit
51 # Modules/Setup. The python executable is built in the Modules
52 # directory and then moved to the top-level directory. The recursive
53 # makes pass three options to subordinate makes: OPT (a quick way to
54 # change some compiler options; it usually defaults to -O), prefix and
55 # exec_prefix (the installation paths).
57 # If you have a previous version of Python installed that you don't
58 # want to overwrite, you can use "make altinstall" instead of "make
59 # install". This changes the install procedure so it installs the
60 # Python binary as "python<version>". The libraries and include files
61 # are always installed in a subdirectory called "python<version>".
62 # "make altinstall" does not install the manual page. If you want to
63 # make this installation the "official" installation but want to keep
64 # the old binary around "just in case", rename the installed python
65 # binary to "python<oldversion>" before running "make install".
66 # (This only works between different versions, e.g. 1.3 and 1.4 --
67 # different betas of the same version will overwrite each other in
68 # installation unless you override the VERSION Make variable.)
70 # In fact, "make install" or "make bininstall" installs the binary
71 # as python<version> and makes a hard link to python, so when
72 # installing a new version in the future, nothing of the current
73 # version will be lost (except for the man page).
75 # If recursive makes fail, try invoking make as "make MAKE=make".
77 # See also the section "Build instructions" in the README file.
79 # Substitutions by configure
88 # Machine-dependent subdirectories
91 # Install prefix for architecture-independent files
94 # Install prefix for architecture-dependent files
95 exec_prefix= @
exec_prefix@
97 # Expanded directories
98 BINDIR
= $(exec_prefix)/bin
99 LIBDIR
= $(exec_prefix)/lib
100 MANDIR
= $(prefix)/man
101 INCLUDEDIR
= $(prefix)/include
102 CONFINCLUDEDIR
= $(exec_prefix)/include
103 SCRIPTDIR
= $(prefix)/lib
105 # Detailed destination directories
106 BINLIBDEST
= $(LIBDIR
)/python
$(VERSION
)
107 LIBDEST
= $(SCRIPTDIR
)/python
$(VERSION
)
108 INCLUDEPY
= $(INCLUDEDIR
)/python
$(VERSION
)
109 CONFINCLUDEPY
= $(CONFINCLUDEDIR
)/python
$(VERSION
)
110 LIBP
= $(LIBDIR
)/python
$(VERSION
)
112 # Symbols used for using shared libraries
116 LINKFORSHARED
= @LINKFORSHARED@
117 DESTSHARED
= $(BINLIBDEST
)/lib-dynload
119 # Shell used by make (some versions default to the login shell, which is bad)
122 # Use ``EXE=.exe'' for Unix emulations on DOS/Windows (e.g. GNUWIN32)
125 # Modes for directories, executables and data files created by the
126 # install process. Default to group-writable directories but
127 # user-only-writable for executables and data files.
132 # Portable install script (configure doesn't always guess right)
133 INSTALL
= @
srcdir@
/install-sh
-c
134 INSTALL_PROGRAM
=${INSTALL} -m
$(EXEMODE
)
135 INSTALL_DATA
= ${INSTALL} -m
$(FILEMODE
)
137 # Use this to make a link between python$(VERSION) and python in $(BINDIR)
140 # --with-PACKAGE options for configure script
141 # e.g. --with-readline --with-svr5 --with-solaris --with-thread
142 # (see README for an explanation)
145 # Compiler options passed to subordinate makes
148 # Subdirectories where to run make recursively
149 SUBDIRS
= Parser Objects Python Modules
151 # Other subdirectories
152 SUBDIRSTOO
= Include Lib Misc Demo Grammar
154 # Files and directories to be distributed
155 CONFIGFILES
= configure configure.in acconfig.h config.h.in Makefile.in
156 DISTFILES
= README ChangeLog
$(CONFIGFILES
)
157 DISTDIRS
= $(SUBDIRS
) $(SUBDIRSTOO
) Ext-dummy
158 DIST
= $(DISTFILES
) $(DISTDIRS
)
160 # Compilation flags for getbuildinfo.c only
161 CFLAGS
= $(OPT
) -I.
$(DEFS
)
163 LIBRARY
= libpython
$(VERSION
).a
166 all: $(LIBRARY
) python sharedmods
168 # Build the interpreter
169 python
: $(LIBRARY
) buildno Modules
/python.o
170 expr
`cat buildno` + 1 >buildno1
171 mv
-f buildno1 buildno
172 $(CC
) -c
$(CFLAGS
) -DBUILD
=`cat buildno` \
173 $(srcdir)/Modules
/getbuildinfo.c
174 $(AR
) cr
$(LIBRARY
) getbuildinfo.o
177 cd Modules
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
178 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
179 LIBRARY
=..
/$(LIBRARY
) link
181 Modules
/python.o
: $(srcdir)/Modules
/python.c
182 cd Modules
; $(MAKE
) OPT
="$(OPT)" python.o
187 # Build the shared modules
189 cd Modules
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
190 prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
194 $(LIBRARY
): $(SUBDIRS
)
195 if
test ! -f
$(LIBRARY
); \
196 then for i in
$(SUBDIRS
); do
rm -f
$$i/add2lib
; done
; true
; \
198 for i in
$(SUBDIRS
); do \
199 (cd
$$i; $(MAKE
) VERSION
="$(VERSION)" add2lib
); done
201 # This rule is only here for DG/UX!!!
202 libpython
$(VERSION
).so
: $(LIBRARY
)
203 test -d dgux || mkdir dgux
204 (cd dgux
;ar x ..
/$^
;ld -G
-o ..
/$@
* )
207 $(SUBDIRS
): Makefiles
210 cd Parser
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
211 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
214 cd Python
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
215 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
218 cd Objects
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
219 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
221 Modules
: Parser Python Objects
222 cd Modules
; $(MAKE
) OPT
="$(OPT)" VERSION
="$(VERSION)" \
223 prefix="$(prefix)" exec_prefix="$(exec_prefix)" all
225 # Test the interpreter (twice, once without .pyc files, once with)
227 TESTPROG
= $(srcdir)/Lib
/test/regrtest.py
230 -rm -f
$(srcdir)/Lib
/test/*.py
[co]
231 -PYTHONPATH
= $(TESTPYTHON
) $(TESTPROG
) $(TESTOPTS
)
232 PYTHONPATH
= $(TESTPYTHON
) $(TESTPROG
) $(TESTOPTS
)
235 install: altinstall bininstall maninstall
237 # Install almost everything without disturbing previous versions
238 altinstall
: altbininstall libinstall inclinstall libainstall sharedinstall
240 # Install the interpreter (by creating a hard link to python$(VERSION))
241 bininstall
: altbininstall
242 -if
test -f
$(BINDIR
)/python
; \
243 then
rm -f
$(BINDIR
)/python
; \
246 (cd
$(BINDIR
); $(LN
) python
$(VERSION
)$(EXE
) python
$(EXE
))
248 # Install the interpreter with $(VERSION) affixed
249 # This goes into $(exec_prefix)
250 altbininstall
: python
251 @for i in
$(BINDIR
); \
253 if
test ! -d
$$i; then \
254 echo
"Creating directory $$i"; \
256 chmod
$(DIRMODE
) $$i; \
260 $(INSTALL_PROGRAM
) python
$(EXE
) $(BINDIR
)/python
$(VERSION
)$(EXE
)
262 if
test -f libpython
$(VERSION
).so
; then \
263 $(INSTALL_DATA
) libpython
$(VERSION
).so
$(LIBDIR
); \
267 # Install the manual page
269 @for i in
$(MANDIR
) $(MANDIR
)/man1
; \
271 if
test ! -d
$$i; then \
272 echo
"Creating directory $$i"; \
274 chmod
$(DIRMODE
) $$i; \
278 $(INSTALL_DATA
) $(srcdir)/Misc
/python.man \
279 $(MANDIR
)/man1
/python
.1
281 # Install the library
282 PLATDIR
= plat-
$(MACHDEP
)
284 LIBSUBDIRS
= lib-stdwin lib-tk
test test/output
$(MACHDEPS
)
285 libinstall
: python
$(srcdir)/Lib
/$(PLATDIR
)
286 @for i in
$(SCRIPTDIR
) $(LIBDEST
); \
288 if
test ! -d
$$i; then \
289 echo
"Creating directory $$i"; \
291 chmod
$(DIRMODE
) $$i; \
295 @for d in
$(LIBSUBDIRS
); \
297 a
=$(srcdir)/Lib
/$$d; \
298 if
test ! -d
$$a; then continue
; else true
; fi
; \
300 if
test ! -d
$$b; then \
301 echo
"Creating directory $$b"; \
303 chmod
$(DIRMODE
) $$b; \
307 @for i in
$(srcdir)/Lib
/*.py
$(srcdir)/Lib
/*.doc
; \
309 if
test -x
$$i; then \
310 $(INSTALL_PROGRAM
) $$i $(LIBDEST
); \
311 echo
$(INSTALL_PROGRAM
) $$i $(LIBDEST
); \
313 $(INSTALL_DATA
) $$i $(LIBDEST
); \
314 echo
$(INSTALL_DATA
) $$i $(LIBDEST
); \
317 @for d in
$(LIBSUBDIRS
); \
319 a
=$(srcdir)/Lib
/$$d; \
320 if
test ! -d
$$a; then continue
; else true
; fi
; \
329 if
test -d
$$i; then continue
; fi
; \
330 if
test -x
$$i; then \
331 echo
$(INSTALL_PROGRAM
) $$i $$b; \
332 $(INSTALL_PROGRAM
) $$i $$b; \
334 echo
$(INSTALL_DATA
) $$i $$b; \
335 $(INSTALL_DATA
) $$i $$b; \
340 PYTHONPATH
=$(LIBDEST
) \
341 .
/python
$(LIBDEST
)/compileall.py
$(LIBDEST
)
342 PYTHONPATH
=$(LIBDEST
) \
343 .
/python
-O
$(LIBDEST
)/compileall.py
$(LIBDEST
)
345 # Create the PLATDIR source directory, if one wasn't distributed..
346 $(srcdir)/Lib
/$(PLATDIR
):
347 mkdir
$(srcdir)/Lib
/$(PLATDIR
)
348 cp
$(srcdir)/Lib
/plat-generic
/regen
$(srcdir)/Lib
/$(PLATDIR
)/regen
349 export PATH
; PATH
="`pwd`:$$PATH"; \
350 export PYTHONPATH
; PYTHONPATH
="`pwd`/Lib"; \
351 cd
$(srcdir)/Lib
/$(PLATDIR
); .
/regen
353 # Install the include files
354 INCLDIRSTOMAKE
=$(INCLUDEDIR
) $(CONFINCLUDEDIR
) $(INCLUDEPY
) $(CONFINCLUDEPY
)
356 @for i in
$(INCLDIRSTOMAKE
); \
358 if
test ! -d
$$i; then \
359 echo
"Creating directory $$i"; \
361 chmod
$(DIRMODE
) $$i; \
365 @for i in
$(srcdir)/Include
/*.h
; \
367 echo
$(INSTALL_DATA
) $$i $(INCLUDEPY
); \
368 $(INSTALL_DATA
) $$i $(INCLUDEPY
); \
370 $(INSTALL_DATA
) config.h
$(CONFINCLUDEPY
)/config.h
372 # Install the library and miscellaneous stuff needed for extending/embedding
373 # This goes into $(exec_prefix)
374 LIBPL
= $(LIBP
)/config
376 @for i in
$(LIBDIR
) $(LIBP
) $(LIBPL
); \
378 if
test ! -d
$$i; then \
379 echo
"Creating directory $$i"; \
381 chmod
$(DIRMODE
) $$i; \
385 $(INSTALL_DATA
) $(LIBRARY
) $(LIBPL
)/$(LIBRARY
)
386 $(RANLIB
) $(LIBPL
)/$(LIBRARY
)
387 $(INSTALL_DATA
) Modules
/config.c
$(LIBPL
)/config.c
388 $(INSTALL_DATA
) Modules
/python.o
$(LIBPL
)/python.o
389 $(INSTALL_DATA
) $(srcdir)/Modules
/config.c.in
$(LIBPL
)/config.c.in
390 $(INSTALL_DATA
) Modules
/Makefile
$(LIBPL
)/Makefile
391 $(INSTALL_DATA
) Modules
/Setup
$(LIBPL
)/Setup
392 $(INSTALL_DATA
) Modules
/Setup.local
$(LIBPL
)/Setup.local
393 $(INSTALL_DATA
) Modules
/Setup.thread
$(LIBPL
)/Setup.thread
394 $(INSTALL_PROGRAM
) $(srcdir)/Modules
/makesetup
$(LIBPL
)/makesetup
395 $(INSTALL_PROGRAM
) $(srcdir)/install-sh
$(LIBPL
)/install-sh
396 $(INSTALL_DATA
) $(srcdir)/Misc
/Makefile.pre.in
$(LIBPL
)/Makefile.pre.in
397 @if
[ -s Modules
/python.exp
-a \
398 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
399 echo
; echo
"Installing support files for building shared extension modules on AIX:"; \
400 $(INSTALL_DATA
) Modules
/python.exp \
401 $(LIBPL
)/python.exp
; \
402 echo
; echo
"$(LIBPL)/python.exp"; \
403 $(INSTALL_PROGRAM
) $(srcdir)/Modules
/makexp_aix \
404 $(LIBPL
)/makexp_aix
; \
405 echo
"$(LIBPL)/makexp_aix"; \
406 $(INSTALL_PROGRAM
) $(srcdir)/Modules
/ld_so_aix \
407 $(LIBPL
)/ld_so_aix
; \
408 echo
"$(LIBPL)/ld_so_aix"; \
409 echo
; echo
"See Misc/AIX-NOTES for details."; \
413 # Install the dynamically loadable modules
414 # This goes into $(exec_prefix)
416 cd Modules
; $(MAKE
) \
418 VERSION
="$(VERSION)" \
420 LDSHARED
="$(LDSHARED)" \
421 CCSHARED
="$(CCSHARED)" \
422 LINKFORSHARED
="$(LINKFORSHARED)" \
423 DESTSHARED
="$(DESTSHARED)" \
425 exec_prefix="$(exec_prefix)" \
428 # Build the sub-Makefiles
429 Makefiles
: config.status Modules
/Makefile.pre
430 (cd Modules
; $(MAKE
) -f Makefile.pre Makefile
)
431 @for i in .
$(SUBDIRS
); do \
432 (echo making Makefile in subdirectory
$$i; cd
$$i; \
435 -(rm -f Modules
/hassignal
; cd Modules
; $(MAKE
) hassignal
)
437 # Build the intermediate Makefile in Modules
438 Modules
/Makefile.pre
: config.status
439 $(SHELL
) config.status
441 # Build the toplevel Makefile
442 Makefile
: Makefile.in config.status
443 CONFIG_FILES
=Makefile CONFIG_HEADERS
= $(SHELL
) config.status
445 # Run the configure script. If config.status already exists,
446 # call it with the --recheck argument, which reruns configure with the
447 # same options as it was run last time; otherwise run the configure
448 # script with options taken from the $(WITH) variable
449 config.status
: $(srcdir)/configure
450 if
test -f config.status
; \
451 then
$(SHELL
) config.status
--recheck
; \
452 $(SHELL
) config.status
; \
453 else $(SHELL
) $(srcdir)/configure
$(WITH
); \
456 .PRECIOUS
: config.status python
458 # Rerun configure with the same options as it was run last time,
459 # provided the config.status script exists
461 $(SHELL
) config.status
--recheck
462 $(SHELL
) config.status
464 # Rebuild the configure script from configure.in; also rebuild config.h.in
466 (cd
$(srcdir); autoconf
)
467 (cd
$(srcdir); autoheader
)
469 # Create a tags file for vi
471 ctags
-w
-t Include
/*.h
472 for i in
$(SUBDIRS
); do ctags
-w
-t
-a
$$i/*.
[ch
]; done
475 # Create a tags file for GNU Emacs
478 for i in
$(SUBDIRS
); do etags
-a
$$i/*.
[ch
]; done
480 # Add dependencies to sub-Makefiles
482 @for i in
$(SUBDIRS
); do \
483 (echo making depend in subdirectory
$$i; cd
$$i; \
487 # Sanitation targets -- clean leaves libraries, executables and tags
488 # files, which clobber removes those as well
491 -rm -f core
*~
[@
,#]* *.old *.orig *.rej
494 -for i in
$(SUBDIRS
); do \
495 if
test -d
$$i; then \
496 (echo making
clean in subdirectory
$$i; cd
$$i; \
497 if
test -f Makefile
; \
498 then
$(MAKE
) clean; \
499 else $(MAKE
) -f Makefile.
*in
clean; \
504 localclobber
: localclean
505 -rm -f
tags TAGS python
$(LIBRARY
) *.o
506 -rm -f config.log config.cache config.h
508 clobber: localclobber
509 -for i in
$(SUBDIRS
); do \
510 if
test -d
$$i; then \
511 (echo clobbering subdirectory
$$i; cd
$$i; \
512 if
test -f Makefile
; \
513 then
$(MAKE
) clobber; \
514 else $(MAKE
) -f
$(srcdir)/Makefile
*.in
clobber; \
519 # Make things extra clean, before making a distribution:
520 # remove all generated files, even Makefile[.pre]
522 -$(MAKE
) -f
$(srcdir)/Makefile.in \
523 SUBDIRS
="$(SUBDIRSTOO)" clobber
524 -rm -f config.status config.log config.cache config.h Makefile
526 -rm -f Modules
/Makefile
527 -for i in
$(SUBDIRS
) $(SUBDIRSTOO
); do \
528 for f in
$$i/*.in
; do \
529 f
=`basename "$$f" .in`; \
530 if
test "$$f" != "*"; then \
531 echo
rm -f
"$$i/$$f"; \
537 # Check for smelly exported symbols (not starting with Py/_Py)
539 for i in
$(SUBDIRS
); do \
541 nm
-p
$$i/lib
$$i.a | \
542 sed
-n
"/ [TDB] /s/.* //p" | grep
-v
"^_*Py" |
sort -u
; \
545 # Find files with funny names
547 find
$(DISTDIRS
) -type d \
564 -o
-name Repository \
570 -o
-name .cvsignore \