Catch divide-by-zero in ${eval:...}.
[exim.git] / src / Makefile
CommitLineData
0a49a7a4 1# $Cambridge: exim/src/Makefile,v 1.7 2009/11/16 19:50:36 nm4 Exp $
0f4f2a88
PH
2
3# Top-level makefile for Exim; handles creating a build directory with
4# appropriate links, and then creating and running the main makefile in that
5# directory.
6
0a49a7a4 7# Copyright (c) University of Cambridge, 1995 - 2007
0f4f2a88
PH
8# See the file NOTICE for conditions of use and distribution.
9
10# IRIX make uses the shell that is in the SHELL variable, which often defaults
11# to csh, so put this in to make it use the Bourne shell. In systems where
12# /bin/sh is not a Bourne-compatible shell, this line will have to be edited,
13# or "make" must be called with a different SHELL= setting.
14
15SHELL=/bin/sh
ebcb507f 16RM_COMMAND=/bin/rm
0f4f2a88
PH
17
18# If a build name has not been specified by running this make file via a
19# command of the form "make build=xxxx", then determine the name of the
20# operating system and the machine architecture and use that. This does not
21# provide an override for the OS type and architecture type; they still have
22# to be used for the OS-specific files. To override them, you can set the
23# shell variables OSTYPE and ARCHTYPE when running make.
24
25buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}
26
27# The default target checks for the existence of Local/Makefile, that the main
28# makefile is built and up-to-date, and then it runs it.
29
23510047
TF
30all: Local/Makefile configure
31 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
0f4f2a88
PH
32
33Local/Makefile:
34 @echo ""
35 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
36 @echo "*** appropriate changes for your site."
37 @echo ""
38 @test ! -d Local && mkdir Local
39 @false
40
41# This is separated off so that "make build-directory" can be obeyed on
42# its own if necessary.
43
44build-directory:
45 @builddir=build-$(buildname); \
46 case "$$builddir" in *UnKnown*) exit 1;; esac; \
47 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
48 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
49
50# The "configure" target ensures that the build directory exists, then arranges
51# to build the main makefile from inside the build directory, by calling the
52# Configure-Makefile script. This does its own dependency checking because of
53# the optional files.
54
55configure: build-directory
56 @cd build-$(buildname); \
0a349494
PP
57 build=$(build) $(SHELL) ../scripts/Configure-Makefile; \
58 $(SHELL) ../scripts/lookups-Makefile
0f4f2a88
PH
59
60# The "makefile" target forces a rebuild of the makefile (as opposed to
61# "configure", which doesn't force it).
62
63makefile: build-directory
ebcb507f 64 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
0a349494
PP
65 build=$(build) $(SHELL) ../scripts/Configure-Makefile; \
66 $(SHELL) ../scripts/lookups-Makefile
0f4f2a88 67
0f4f2a88
PH
68# The installation commands are kept in a separate script, which expects
69# to be run from inside the build directory.
70
71install:; @cd build-$(buildname); \
72 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
73
74# Tidy-up targets
75
76clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
77 @echo '*** Use "make makefile" to force a rebuild of the makefile'
78 @echo ""
79 cd build-$(buildname); \
ebcb507f 80 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
0f4f2a88 81 routers/*.o routers/*.a transports/*.o transports/*.a \
80a47a2c 82 pdkim/*.o pdkim/*.a
0f4f2a88
PH
83
84clean_exim:; cd build-$(buildname); \
ebcb507f 85 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
e6d225ae 86 routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
0f4f2a88 87
c35e155c
PH
88distclean:; $(RM_COMMAND) -rf build-*
89
0f4f2a88 90# End of top-level makefile