Introduce EXIM_BUILD_SUFFIX for src/Makefile and testsuite
[exim.git] / src / Makefile
CommitLineData
0f4f2a88
PH
1# Top-level makefile for Exim; handles creating a build directory with
2# appropriate links, and then creating and running the main makefile in that
3# directory.
4
3386088d 5# Copyright (c) University of Cambridge, 1995 - 2015
0f4f2a88
PH
6# See the file NOTICE for conditions of use and distribution.
7
8# IRIX make uses the shell that is in the SHELL variable, which often defaults
9# to csh, so put this in to make it use the Bourne shell. In systems where
10# /bin/sh is not a Bourne-compatible shell, this line will have to be edited,
11# or "make" must be called with a different SHELL= setting.
12
13SHELL=/bin/sh
ebcb507f 14RM_COMMAND=/bin/rm
0f4f2a88
PH
15
16# If a build name has not been specified by running this make file via a
17# command of the form "make build=xxxx", then determine the name of the
18# operating system and the machine architecture and use that. This does not
19# provide an override for the OS type and architecture type; they still have
20# to be used for the OS-specific files. To override them, you can set the
21# shell variables OSTYPE and ARCHTYPE when running make.
fefe59d9
HSHR
22#
23# EXIM_BUILD_SUFFIX should be used to enable parallel builds on a file
24# system shared among different Linux distros (same os-type, same
25# arch-type). The ../test/runtest script is expected to honour the
26# EXIM_BUILD_SUFFIX when searching the Exim binary.
27# NOTE: EXIM_BUILD_SUFFIX is considered *experimental*.
28
29buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}$${EXIM_BUILD_SUFFIX:+.$$EXIM_BUILD_SUFFIX}
0f4f2a88
PH
30
31# The default target checks for the existence of Local/Makefile, that the main
32# makefile is built and up-to-date, and then it runs it.
33
23510047
TF
34all: Local/Makefile configure
35 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
0f4f2a88 36
8497e842
JH
37
38# This pair for the convinience of of the Debian maintainers
39exim: Local/Makefile configure
40 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) exim
41utils: Local/Makefile configure
42 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) utils
43
44
0f4f2a88
PH
45Local/Makefile:
46 @echo ""
47 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
48 @echo "*** appropriate changes for your site."
49 @echo ""
50 @test ! -d Local && mkdir Local
51 @false
52
53# This is separated off so that "make build-directory" can be obeyed on
54# its own if necessary.
55
56build-directory:
57 @builddir=build-$(buildname); \
58 case "$$builddir" in *UnKnown*) exit 1;; esac; \
59 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
60 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
61
f9d04f08
JH
62checks:
63 $(SHELL) scripts/source_checks
64
0f4f2a88
PH
65# The "configure" target ensures that the build directory exists, then arranges
66# to build the main makefile from inside the build directory, by calling the
67# Configure-Makefile script. This does its own dependency checking because of
68# the optional files.
69
f9d04f08 70configure: checks build-directory
0f4f2a88 71 @cd build-$(buildname); \
58ee1eb6 72 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88
PH
73
74# The "makefile" target forces a rebuild of the makefile (as opposed to
75# "configure", which doesn't force it).
76
77makefile: build-directory
ebcb507f 78 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
58ee1eb6 79 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88 80
0f4f2a88
PH
81# The installation commands are kept in a separate script, which expects
82# to be run from inside the build directory.
83
7f2a2a43
PP
84install: all
85 @cd build-$(buildname); \
0f4f2a88
PH
86 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
87
88# Tidy-up targets
89
90clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
91 @echo '*** Use "make makefile" to force a rebuild of the makefile'
92 @echo ""
93 cd build-$(buildname); \
ebcb507f 94 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
0f4f2a88 95 routers/*.o routers/*.a transports/*.o transports/*.a \
80a47a2c 96 pdkim/*.o pdkim/*.a
0f4f2a88
PH
97
98clean_exim:; cd build-$(buildname); \
ebcb507f 99 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
e6d225ae 100 routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
0f4f2a88 101
1e2a8d33
JH
102distclean:; $(RM_COMMAND) -rf build-* cscope*
103
104cscope.files: FRC
105 echo "-q" > $@
106 echo "-p3" >> $@
e91ad4a7 107 find src Local OS exim_monitor -name "*.[cshyl]" -print \
93d4b03a 108 -o -name "os.h*" -print \
1e2a8d33 109 -o -name "*akefile*" -print \
090ab487 110 -o -name config.h.defaults -print \
1e2a8d33 111 -o -name EDITME -print >> $@
c3680ef0 112 ls OS/* >> $@
1e2a8d33
JH
113
114FRC:
c35e155c 115
0f4f2a88 116# End of top-level makefile