Microfix in SECURITY.md: exim-VERSION+fixes
[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
f9ba5e22 5# Copyright (c) University of Cambridge, 1995 - 2018
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 15
84590578
HSHR
16# The buildname defaults to "<os-type>-<arch-type>". It can be
17# overridden by the "build" parameter when invoking make (e.g. make
18# build=xxx) This does not provide an override for the OS type and
19# architecture type used during the build process; they still have to be
20# used for the OS-specific files. To override them, you can set the
0f4f2a88 21# shell variables OSTYPE and ARCHTYPE when running make.
fefe59d9 22#
84590578
HSHR
23# EXIM_BUILD_SUFFIX gets appended to the buildname. (This enables
24# parallel builds on a file system shared among different Linux distros
25# (same os-type, same arch-type). The ../test/runtest script honours the
26# EXIM_BUILD_SUFFIX when searching the Exim binary.)
fefe59d9
HSHR
27
28buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}$${EXIM_BUILD_SUFFIX:+.$$EXIM_BUILD_SUFFIX}
0f4f2a88
PH
29
30# The default target checks for the existence of Local/Makefile, that the main
31# makefile is built and up-to-date, and then it runs it.
84590578 32# If Local/Makefile-<buildname> exists, it is read too.
0f4f2a88 33
23510047
TF
34all: Local/Makefile configure
35 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
0f4f2a88 36
4c04137d 37# This pair for the convenience of of the Debian maintainers
8497e842
JH
38exim: Local/Makefile configure
39 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) exim
40utils: Local/Makefile configure
41 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) utils
42
0f4f2a88
PH
43Local/Makefile:
44 @echo ""
45 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
46 @echo "*** appropriate changes for your site."
47 @echo ""
48 @test ! -d Local && mkdir Local
49 @false
50
51# This is separated off so that "make build-directory" can be obeyed on
52# its own if necessary.
53
54build-directory:
55 @builddir=build-$(buildname); \
56 case "$$builddir" in *UnKnown*) exit 1;; esac; \
57 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
58 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
59
f9d04f08
JH
60checks:
61 $(SHELL) scripts/source_checks
62
0f4f2a88
PH
63# The "configure" target ensures that the build directory exists, then arranges
64# to build the main makefile from inside the build directory, by calling the
65# Configure-Makefile script. This does its own dependency checking because of
66# the optional files.
67
f9d04f08 68configure: checks build-directory
0f4f2a88 69 @cd build-$(buildname); \
58ee1eb6 70 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88
PH
71
72# The "makefile" target forces a rebuild of the makefile (as opposed to
73# "configure", which doesn't force it).
74
75makefile: build-directory
ebcb507f 76 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
58ee1eb6 77 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88 78
0f4f2a88
PH
79# The installation commands are kept in a separate script, which expects
80# to be run from inside the build directory.
81
7f2a2a43
PP
82install: all
83 @cd build-$(buildname); \
0f4f2a88
PH
84 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
85
86# Tidy-up targets
87
88clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
89 @echo '*** Use "make makefile" to force a rebuild of the makefile'
90 @echo ""
91 cd build-$(buildname); \
ebcb507f 92 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
0f4f2a88 93 routers/*.o routers/*.a transports/*.o transports/*.a \
80a47a2c 94 pdkim/*.o pdkim/*.a
0f4f2a88
PH
95
96clean_exim:; cd build-$(buildname); \
ebcb507f 97 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
e6d225ae 98 routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
0f4f2a88 99
1e2a8d33
JH
100distclean:; $(RM_COMMAND) -rf build-* cscope*
101
102cscope.files: FRC
103 echo "-q" > $@
104 echo "-p3" >> $@
e91ad4a7 105 find src Local OS exim_monitor -name "*.[cshyl]" -print \
b6323c75 106 -o -name "os.[ch]*" -print \
1e2a8d33 107 -o -name "*akefile*" -print \
090ab487 108 -o -name config.h.defaults -print \
1e2a8d33
JH
109 -o -name EDITME -print >> $@
110
111FRC:
c35e155c 112
0f4f2a88 113# End of top-level makefile