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
5 # Copyright (c) The Exim Maintainers 2022 - 2023
6 # Copyright (c) University of Cambridge, 1995 - 2018
7 # SPDX-License-Identifier: GPL-2.0-or-later
8 # See the file NOTICE for conditions of use and distribution.
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.
18 # The buildname defaults to "<os-type>-<arch-type>". It can be
19 # overridden by the "build" parameter when invoking make (e.g. make
20 # build=xxx) This does not provide an override for the OS type and
21 # architecture type used during the build process; they still have to be
22 # used for the OS-specific files. To override them, you can set the
23 # shell variables OSTYPE and ARCHTYPE when running make.
25 # EXIM_BUILD_SUFFIX gets appended to the buildname. (This enables
26 # parallel builds on a file system shared among different Linux distros
27 # (same os-type, same arch-type). The ../test/runtest script honours the
28 # EXIM_BUILD_SUFFIX when searching the Exim binary.)
30 buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}$${EXIM_BUILD_SUFFIX:+.$$EXIM_BUILD_SUFFIX}
32 # The default target checks for the existence of Local/Makefile, that the main
33 # makefile is built and up-to-date, and then it runs it.
34 # If Local/Makefile-<buildname> exists, it is read too.
36 all: Local/Makefile configure
37 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
39 # This pair for the convenience of of the Debian maintainers
40 exim utils: Local/Makefile configure
41 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) $@
43 # For testsuite builds
44 exim_openssl exim_gnutls: Local/Makefile configure
45 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) $@
49 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
50 @echo "*** appropriate changes for your site."
52 @test ! -d Local && mkdir Local
55 # This is separated off so that "make build-directory" can be obeyed on
56 # its own if necessary.
59 @builddir=build-$(buildname); \
60 case "$$builddir" in *UnKnown*) exit 1;; esac; \
61 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
62 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
65 $(SHELL) scripts/source_checks
67 # The "configure" target ensures that the build directory exists, then arranges
68 # to build the main makefile from inside the build directory, by calling the
69 # Configure-Makefile script. This does its own dependency checking because of
72 configure: checks build-directory
73 @cd build-$(buildname); \
74 build=$(build) $(SHELL) ../scripts/Configure-Makefile
76 # The "makefile" target forces a rebuild of the makefile (as opposed to
77 # "configure", which doesn't force it).
79 makefile: build-directory
80 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
81 build=$(build) $(SHELL) ../scripts/Configure-Makefile
83 # The installation commands are kept in a separate script, which expects
84 # to be run from inside the build directory.
87 @cd build-$(buildname); \
88 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
92 clean_exim:; cd build-$(buildname); \
93 $(RM_COMMAND) -f *.o; \
94 for d in lookups auths routers transports miscmods; do \
95 $(RM_COMMAND) -f $$d/*.{o,a,so}; \
97 $(RM_COMMAND) -fr dynmodules
100 @echo ""; echo '*** "make clean" just removes all .o and .a files'
101 @echo '*** Use "make makefile" to force a rebuild of the makefile'
104 distclean:; $(RM_COMMAND) -rf build-* cscope*
109 -bd=build-$(buildname); [ -d $$bd ] && echo -e "$$bd/config.h\n$$bd/Makefile" >> $@
110 find src Local OS exim_monitor -name "*.[cshyl]" -print \
111 -o -name "os.[ch]*" -print \
112 -o -name "*akefile*" -print \
113 -o -name config.h.defaults -print \
114 -o -name EDITME -print >> $@
118 # End of top-level makefile