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
6 # Copyright (c) University of Cambridge, 1995 - 2018
7 # See the file NOTICE for conditions of use and distribution.
9 # IRIX make uses the shell that is in the SHELL variable, which often defaults
10 # to csh, so put this in to make it use the Bourne shell. In systems where
11 # /bin/sh is not a Bourne-compatible shell, this line will have to be edited,
12 # or "make" must be called with a different SHELL= setting.
17 # The buildname defaults to "<os-type>-<arch-type>". It can be
18 # overridden by the "build" parameter when invoking make (e.g. make
19 # build=xxx) This does not provide an override for the OS type and
20 # architecture type used during the build process; they still have to be
21 # used for the OS-specific files. To override them, you can set the
22 # shell variables OSTYPE and ARCHTYPE when running make.
24 # EXIM_BUILD_SUFFIX gets appended to the buildname. (This enables
25 # parallel builds on a file system shared among different Linux distros
26 # (same os-type, same arch-type). The ../test/runtest script honours the
27 # EXIM_BUILD_SUFFIX when searching the Exim binary.)
29 buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}$${EXIM_BUILD_SUFFIX:+.$$EXIM_BUILD_SUFFIX}
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 # If Local/Makefile-<buildname> exists, it is read too.
35 all: Local/Makefile configure
36 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
38 # This pair for the convenience of of the Debian maintainers
39 exim: Local/Makefile configure
40 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) exim
41 utils: Local/Makefile configure
42 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) utils
46 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
47 @echo "*** appropriate changes for your site."
49 @test ! -d Local && mkdir Local
52 # This is separated off so that "make build-directory" can be obeyed on
53 # its own if necessary.
56 @builddir=build-$(buildname); \
57 case "$$builddir" in *UnKnown*) exit 1;; esac; \
58 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
59 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
62 $(SHELL) scripts/source_checks
64 # The "configure" target ensures that the build directory exists, then arranges
65 # to build the main makefile from inside the build directory, by calling the
66 # Configure-Makefile script. This does its own dependency checking because of
69 configure: checks build-directory
70 @cd build-$(buildname); \
71 build=$(build) $(SHELL) ../scripts/Configure-Makefile
73 # The "makefile" target forces a rebuild of the makefile (as opposed to
74 # "configure", which doesn't force it).
76 makefile: build-directory
77 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
78 build=$(build) $(SHELL) ../scripts/Configure-Makefile
80 # The installation commands are kept in a separate script, which expects
81 # to be run from inside the build directory.
84 @cd build-$(buildname); \
85 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
89 clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
90 @echo '*** Use "make makefile" to force a rebuild of the makefile'
92 cd build-$(buildname); \
93 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
94 routers/*.o routers/*.a transports/*.o transports/*.a \
97 clean_exim:; cd build-$(buildname); \
98 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
99 routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
101 distclean:; $(RM_COMMAND) -rf build-* cscope*
106 -bd=build-$(buildname); [ -d $$bd ] && echo -e "$$bd/config.h\n$$bd/Makefile" >> $@
107 find src Local OS exim_monitor -name "*.[cshyl]" -print \
108 -o -name "os.[ch]*" -print \
109 -o -name "*akefile*" -print \
110 -o -name config.h.defaults -print \
111 -o -name EDITME -print >> $@
115 # End of top-level makefile