463955ccfeeee86786d03e6f1b7d3301b7700dd1
[exim.git] / src / Makefile
1 # $Cambridge: exim/src/Makefile,v 1.2 2004/10/11 13:24:19 ph10 Exp $
2
3 # Top-level makefile for Exim; handles creating a build directory with
4 # appropriate links, and then creating and running the main makefile in that
5 # directory.
6
7 # Copyright (c) 2004 University of Cambridge.
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
17 # If a build name has not been specified by running this make file via a
18 # command of the form "make build=xxxx", then determine the name of the
19 # operating system and the machine architecture and use that. This does not
20 # provide an override for the OS type and architecture type; they still have
21 # to be used for the OS-specific files. To override them, you can set the
22 # shell variables OSTYPE and ARCHTYPE when running make.
23
24 buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}
25
26 # The default target checks for the existence of Local/Makefile, that the main
27 # makefile is built and up-to-date, and then it runs it.
28
29 all: Local/Makefile configure go
30
31 Local/Makefile:
32 @echo ""
33 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
34 @echo "*** appropriate changes for your site."
35 @echo ""
36 @test ! -d Local && mkdir Local
37 @false
38
39 # This is separated off so that "make build-directory" can be obeyed on
40 # its own if necessary.
41
42 build-directory:
43 @builddir=build-$(buildname); \
44 case "$$builddir" in *UnKnown*) exit 1;; esac; \
45 $(SHELL) -c "test -d $$builddir -a -r $$builddir/version.c || \
46 (mkdir $$builddir; cd $$builddir; $(SHELL) ../scripts/MakeLinks)";
47
48 # The "configure" target ensures that the build directory exists, then arranges
49 # to build the main makefile from inside the build directory, by calling the
50 # Configure-Makefile script. This does its own dependency checking because of
51 # the optional files.
52
53 configure: build-directory
54 @cd build-$(buildname); \
55 build=$(build) $(SHELL) ../scripts/Configure-Makefile
56
57 # The "makefile" target forces a rebuild of the makefile (as opposed to
58 # "configure", which doesn't force it).
59
60 makefile: build-directory
61 @cd build-$(buildname); /bin/rm -f Makefile; \
62 build=$(build) $(SHELL) ../scripts/Configure-Makefile
63
64 # Go to the build directory and do the business
65
66 go:; @cd build-$(buildname); $(MAKE) SHELL=$(SHELL) $(MFLAGS)
67
68 # The installation commands are kept in a separate script, which expects
69 # to be run from inside the build directory.
70
71 install:; @cd build-$(buildname); \
72 build=$(build) $(SHELL) ../scripts/exim_install $(INSTALL_ARG)
73
74 # Tidy-up targets
75
76 clean:; @echo ""; echo '*** "make clean" just removes all .o and .a files'
77 @echo '*** Use "make makefile" to force a rebuild of the makefile'
78 @echo ""
79 cd build-$(buildname); \
80 /bin/rm -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
81 routers/*.o routers/*.a transports/*.o transports/*.a \
82 pcre/*.o pcre/*.a
83
84 clean_exim:; cd build-$(buildname); \
85 /bin/rm -f *.o lookups/*.o lookups/*.a auths/*.o auths/*.a \
86 routers/*.o routers/*.a transports/*.o transports/*.a
87
88 # End of top-level makefile