Use compressed form of ipv6 in $sender_host_address under -bh. Bug 3027
[exim.git] / src / Makefile
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
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.
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
15 SHELL=/bin/sh
16 RM_COMMAND=/bin/rm
17
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.
24 #
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.)
29
30 buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}$${EXIM_BUILD_SUFFIX:+.$$EXIM_BUILD_SUFFIX}
31
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.
35
36 all: Local/Makefile configure
37         @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
38
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) $@
42
43 # For testsuite builds
44 exim_openssl exim_gnutls: Local/Makefile configure
45         @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) $@
46
47 Local/Makefile:
48         @echo ""
49         @echo "*** Please create Local/Makefile by copying src/EDITME and making"
50         @echo "*** appropriate changes for your site."
51         @echo ""
52         @test ! -d Local && mkdir Local
53         @false
54
55 # This is separated off so that "make build-directory" can be obeyed on
56 # its own if necessary.
57
58 build-directory:
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)";
63
64 checks:
65         $(SHELL) scripts/source_checks
66
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
70 # the optional files.
71
72 configure: checks build-directory
73         @cd build-$(buildname); \
74           build=$(build) $(SHELL) ../scripts/Configure-Makefile
75
76 # The "makefile" target forces a rebuild of the makefile (as opposed to
77 # "configure", which doesn't force it).
78
79 makefile: build-directory
80         @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
81           build=$(build) $(SHELL) ../scripts/Configure-Makefile
82
83 # The installation commands are kept in a separate script, which expects
84 # to be run from inside the build directory.
85
86 install:        all
87                 @cd build-$(buildname); \
88                 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
89
90 # Tidy-up targets
91
92 clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
93         @echo '*** Use "make makefile" to force a rebuild of the makefile'
94         @echo ""
95         cd build-$(buildname); \
96         $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
97         routers/*.o routers/*.a transports/*.o transports/*.a \
98         pdkim/*.o pdkim/*.a
99
100 clean_exim:; cd build-$(buildname); \
101          $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
102         routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
103
104 distclean:; $(RM_COMMAND) -rf build-* cscope*
105
106 cscope.files: FRC
107         echo "-q" > $@
108         echo "-p3" >> $@
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 >> $@
115
116 FRC:
117
118 # End of top-level makefile