Merge branch 'SMTPUTF8_1516'. Bug 1516
[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
5a66c31b 5# Copyright (c) University of Cambridge, 1995 - 2014
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.
22
23buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}
24
25# The default target checks for the existence of Local/Makefile, that the main
26# makefile is built and up-to-date, and then it runs it.
27
23510047
TF
28all: Local/Makefile configure
29 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
0f4f2a88 30
8497e842
JH
31
32# This pair for the convinience of of the Debian maintainers
33exim: Local/Makefile configure
34 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) exim
35utils: Local/Makefile configure
36 @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS) utils
37
38
0f4f2a88
PH
39Local/Makefile:
40 @echo ""
41 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
42 @echo "*** appropriate changes for your site."
43 @echo ""
44 @test ! -d Local && mkdir Local
45 @false
46
47# This is separated off so that "make build-directory" can be obeyed on
48# its own if necessary.
49
50build-directory:
51 @builddir=build-$(buildname); \
52 case "$$builddir" in *UnKnown*) exit 1;; esac; \
53 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
54 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
55
f9d04f08
JH
56checks:
57 $(SHELL) scripts/source_checks
58
0f4f2a88
PH
59# The "configure" target ensures that the build directory exists, then arranges
60# to build the main makefile from inside the build directory, by calling the
61# Configure-Makefile script. This does its own dependency checking because of
62# the optional files.
63
f9d04f08 64configure: checks build-directory
0f4f2a88 65 @cd build-$(buildname); \
58ee1eb6 66 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88
PH
67
68# The "makefile" target forces a rebuild of the makefile (as opposed to
69# "configure", which doesn't force it).
70
71makefile: build-directory
ebcb507f 72 @cd build-$(buildname); $(RM_COMMAND) -f Makefile; \
58ee1eb6 73 build=$(build) $(SHELL) ../scripts/Configure-Makefile
0f4f2a88 74
0f4f2a88
PH
75# The installation commands are kept in a separate script, which expects
76# to be run from inside the build directory.
77
7f2a2a43
PP
78install: all
79 @cd build-$(buildname); \
0f4f2a88
PH
80 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
81
82# Tidy-up targets
83
84clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
85 @echo '*** Use "make makefile" to force a rebuild of the makefile'
86 @echo ""
87 cd build-$(buildname); \
ebcb507f 88 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
0f4f2a88 89 routers/*.o routers/*.a transports/*.o transports/*.a \
80a47a2c 90 pdkim/*.o pdkim/*.a
0f4f2a88
PH
91
92clean_exim:; cd build-$(buildname); \
ebcb507f 93 $(RM_COMMAND) -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
e6d225ae 94 routers/*.o routers/*.a transports/*.o transports/*.a lookups/*.so
0f4f2a88 95
1e2a8d33
JH
96distclean:; $(RM_COMMAND) -rf build-* cscope*
97
98cscope.files: FRC
99 echo "-q" > $@
100 echo "-p3" >> $@
e91ad4a7 101 find src Local OS exim_monitor -name "*.[cshyl]" -print \
93d4b03a 102 -o -name "os.h*" -print \
1e2a8d33
JH
103 -o -name "*akefile*" -print \
104 -o -name EDITME -print >> $@
c3680ef0 105 ls OS/* >> $@
1e2a8d33
JH
106
107FRC:
c35e155c 108
0f4f2a88 109# End of top-level makefile