c01e911ceaedb29ab923ddd052208b342b12e671
[exim.git] / src / OS / Makefile-Base
1 # This file is the basis of the main makefile for Exim and friends. The
2 # makefile at the top level arranges to build the main makefile by calling
3 # scripts/Configure-Makefile from within the build directory. This
4 # concatenates the configuration settings from Local/Makefile and other,
5 # optional, Local/* files at the front of this file, to create Makefile in the
6 # build directory.
7 #
8 # Copyright (c) The Exim Maintainers 1995 - 2022
9 # SPDX-License-Identifier: GPL-2.0-or-later
10
11 SHELL      = $(MAKE_SHELL)
12 SCRIPTS    = ../scripts
13 O          = ../OS
14 EDITME     = ../Local/Makefile
15 EXIMON_EDITME = ../Local/eximon.conf
16
17 # The compiler used for linking is normally the same as the compiler used for
18 # compiling. However, by giving it a different name, we can override it from
19 # the command line, and this is helpful for certain types of testing.
20
21 LNCC = $(CC)
22
23 # The compile commands can be very long. To make the output look better,
24 # they are not normally echoed in full. To get full echoing, the caller
25 # must set FULLECHO='' on the command line and call make with -e. We default
26 # FULLECHO to '@' to suppress the full echo. Then define an abbreviation.
27
28 FULLECHO = @
29 FE       = $(FULLECHO)
30
31 # The default target double-checks the existence of $(EDITME) and then arranges
32 # to touch it if it exists and any of the optional configuration files, which
33 # depend on the os or the architecture, have been altered. The same sub-target
34 # does the same thing for the eximon configuration file if it exists. Then
35 # there is a check that the Makefile (the one built from this file) is
36 # up-to-date. Then the os-specific source files and the C configuration file
37 # are set up, and finally it goes to the main Exim target.
38
39 all:       utils exim
40 config:    $(EDITME) checklocalmake Makefile os.c config.h version.h version.sh macro.c
41
42 checklocalmake:
43         @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
44           $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(ARCHTYPE) $(EDITME) || \
45           $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EDITME); \
46         then \
47           touch $(EDITME); \
48         fi
49         @if $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE) $(EXIMON_EDITME) || \
50           $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(ARCHTYPE) $(EXIMON_EDITME) || \
51           $(SHELL) $(SCRIPTS)/newer $(EXIMON_EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EXIMON_EDITME); \
52         then \
53           if [ -f $(EXIMON_EDITME) ]; then touch $(EXIMON_EDITME); fi \
54         fi
55
56 $(EDITME):
57         @echo " "
58         @echo "*** Please create Local/Makefile by copying src/EDITME and making"
59         @echo "*** appropriate changes for your site."
60         @echo " "
61         @false
62
63 $(EXIMON_EDITME):
64         @echo " "
65         @echo "*** Please create Local/eximon.conf by copying exim_monitor/EDITME and making"
66         @echo "*** appropriate changes for your site."
67         @echo " "
68         @test ! -d ../Local && mkdir ../Local
69         @false
70
71 # Check that the local Makefile is up-to-date
72
73 Makefile: ../OS/Makefile-Base ../OS/Makefile-Default \
74           $(SCRIPTS)/Configure $(SCRIPTS)/Configure-Makefile $(EDITME)
75         @echo " "
76         @echo "*** Makefile needs rebuilding"
77         @echo "*** Please run \"make makefile\" at top level"
78         @echo " "
79         @false
80
81 # Build (link) the os.h file
82
83 os.h:   $(SCRIPTS)/Configure-os.h \
84         $(O)/os.h-FreeBSD       \
85         $(O)/os.h-GNU           \
86         $(O)/os.h-Linux         \
87         $(O)/os.h-OpenBSD       \
88         $(O)/os.h-SunOS5
89         $(SHELL) $(SCRIPTS)/Configure-os.h
90
91 # Build the os.c file
92
93 os.c:   ../src/os.c \
94         $(SCRIPTS)/Configure-os.c \
95         $(O)/os.c-FreeBSD       \
96         $(O)/os.c-GNU           \
97         $(O)/os.c-Linux         \
98         $(O)/os.c-SunOS5
99         $(SHELL) $(SCRIPTS)/Configure-os.c
100
101 # Build the config.h file.
102
103 config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME)
104         $(SHELL) $(SCRIPTS)/Configure-config.h "$(MAKE)"
105
106 # Build the builtin-macros data struct
107
108 MACRO_HSRC = macro_predef.h os.h globals.h config.h macros.h \
109         routers/accept.h routers/dnslookup.h routers/ipliteral.h \
110         routers/iplookup.h routers/manualroute.h routers/queryprogram.h \
111         routers/redirect.h
112
113 OBJ_MACRO = macro_predef.o \
114         macro-globals.o macro-readconf.o macro-expand.o macro-route.o \
115         macro-transport.o macro-drtables.o macro-acl.o macro-tls.o \
116         macro-appendfile.o macro-autoreply.o macro-lmtp.o macro-pipe.o macro-queuefile.o \
117         macro-smtp.o macro-accept.o macro-dnslookup.o macro-ipliteral.o macro-iplookup.o \
118         macro-manualroute.o macro-queryprogram.o macro-redirect.o \
119         macro-auth-spa.o macro-cram_md5.o macro-cyrus_sasl.o macro-dovecot.o macro-gsasl_exim.o \
120         macro-heimdal_gssapi.o macro-plaintext.o macro-spa.o macro-authtls.o macro-external.o \
121         macro-dkim.o macro-malware.o macro-signing.o
122
123 $(OBJ_MACRO):   $(MACRO_HSRC)
124
125 macro_predef.o :        macro_predef.c
126         @echo "$(CC) -DMACRO_PREDEF macro_predef.c"
127         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ macro_predef.c
128 macro-globals.o :       globals.c
129         @echo "$(CC) -DMACRO_PREDEF globals.c"
130         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ globals.c
131 macro-readconf.o :      readconf.c
132         @echo "$(CC) -DMACRO_PREDEF readconf.c"
133         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ readconf.c
134 macro-expand.o :        expand.c
135         @echo "$(CC) -DMACRO_PREDEF expand.c"
136         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ expand.c
137 macro-route.o :         route.c
138         @echo "$(CC) -DMACRO_PREDEF route.c"
139         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ route.c
140 macro-transport.o:      transport.c
141         @echo "$(CC) -DMACRO_PREDEF transport.c"
142         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transport.c
143 macro-drtables.o :      drtables.c
144         @echo "$(CC) -DMACRO_PREDEF drtables.c"
145         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ drtables.c
146 macro-acl.o:    acl.c
147         @echo "$(CC) -DMACRO_PREDEF acl.c"
148         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ acl.c
149 macro-tls.o:    tls.c tls-gnu.c tls-openssl.c
150         @echo "$(CC) -DMACRO_PREDEF tls.c"
151         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ tls.c
152 macro-appendfile.o :    transports/appendfile.c
153         @echo "$(CC) -DMACRO_PREDEF transports/appendfile.c"
154         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/appendfile.c
155 macro-autoreply.o :     transports/autoreply.c
156         @echo "$(CC) -DMACRO_PREDEF transports/autoreply.c"
157         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/autoreply.c
158 macro-lmtp.o:           transports/lmtp.c
159         @echo "$(CC) -DMACRO_PREDEF transports/lmtp.c"
160         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/lmtp.c
161 macro-pipe.o :          transports/pipe.c
162         @echo "$(CC) -DMACRO_PREDEF transports/pipe.c"
163         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/pipe.c
164 macro-queuefile.o :     transports/queuefile.c
165         @echo "$(CC) -DMACRO_PREDEF transports/queuefile.c"
166         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/queuefile.c
167 macro-smtp.o :          transports/smtp.c
168         @echo "$(CC) -DMACRO_PREDEF transports/smtp.c"
169         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/smtp.c
170 macro-accept.o :        routers/accept.c
171         @echo "$(CC) -DMACRO_PREDEF routers/accept.c"
172         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/accept.c
173 macro-dnslookup.o :     routers/dnslookup.c
174         @echo "$(CC) -DMACRO_PREDEF routers/dnslookup.c"
175         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/dnslookup.c
176 macro-ipliteral.o :     routers/ipliteral.c
177         @echo "$(CC) -DMACRO_PREDEF routers/ipliteral.c"
178         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/ipliteral.c
179 macro-iplookup.o :      routers/iplookup.c
180         @echo "$(CC) -DMACRO_PREDEF routers/iplookup.c"
181         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/iplookup.c
182 macro-manualroute.o :   routers/manualroute.c
183         @echo "$(CC) -DMACRO_PREDEF routers/manualroute.c"
184         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/manualroute.c
185 macro-queryprogram.o :  routers/queryprogram.c
186         @echo "$(CC) -DMACRO_PREDEF routers/queryprogram.c"
187         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/queryprogram.c
188 macro-redirect.o :      routers/redirect.c
189         @echo "$(CC) -DMACRO_PREDEF routers/redirect.c"
190         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/redirect.c
191 macro-auth-spa.o :      auths/auth-spa.c
192         @echo "$(CC) -DMACRO_PREDEF auths/auth-spa.c"
193         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/auth-spa.c
194 macro-cram_md5.o :      auths/cram_md5.c
195         @echo "$(CC) -DMACRO_PREDEF auths/cram_md5.c"
196         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/cram_md5.c
197 macro-cyrus_sasl.o :    auths/cyrus_sasl.c
198         @echo "$(CC) -DMACRO_PREDEF auths/cyrus_sasl.c"
199         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/cyrus_sasl.c
200 macro-dovecot.o:        auths/dovecot.c
201         @echo "$(CC) -DMACRO_PREDEF auths/dovecot.c"
202         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/dovecot.c
203 macro-external.o:       auths/external.c
204         @echo "$(CC) -DMACRO_PREDEF auths/external.c"
205         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/external.c
206 macro-gsasl_exim.o :    auths/gsasl_exim.c
207         @echo "$(CC) -DMACRO_PREDEF auths/gsasl_exim.c"
208         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/gsasl_exim.c
209 macro-heimdal_gssapi.o: auths/heimdal_gssapi.c
210         @echo "$(CC) -DMACRO_PREDEF auths/heimdal_gssapi.c"
211         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/heimdal_gssapi.c
212 macro-plaintext.o :     auths/plaintext.c
213         @echo "$(CC) -DMACRO_PREDEF auths/plaintext.c"
214         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/plaintext.c
215 macro-spa.o :           auths/spa.c
216         @echo "$(CC) -DMACRO_PREDEF auths/spa.c"
217         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/spa.c
218 macro-authtls.o:        auths/tls.c
219         @echo "$(CC) -DMACRO_PREDEF auths/tls.c"
220         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/tls.c
221 macro-dkim.o:           dkim.c
222         @echo "$(CC) -DMACRO_PREDEF dkim.c"
223         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ dkim.c
224 macro-malware.o:        malware.c
225         @echo "$(CC) -DMACRO_PREDEF malware.c"
226         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ malware.c
227 macro-signing.o:        pdkim/signing.c
228         @echo "$(CC) -DMACRO_PREDEF pdkim/signing.c"
229         $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ pdkim/signing.c
230
231 macro_predef: $(OBJ_MACRO)
232         @echo "$(LNCC) -o $@"
233         $(FE)$(LNCC) -o $@ $(LFLAGS) $(OBJ_MACRO)
234
235 macro.c: macro_predef
236         ./macro_predef > macro.c
237
238 # This target is recognized specially by GNU make. It records those targets
239 # that do not correspond to files that are being built and which should
240 # therefore always be run, even if the files exist. This shouldn't in fact be a
241 # problem, but it does no harm. Other make programs will just ignore this.
242
243 .PHONY: all config utils \
244         buildauths buildlookups buildpdkim buildrouters \
245         buildtransports checklocalmake clean
246
247
248 utils: $(EXIM_MONITOR) exicyclog exinext exiwhat \
249         exigrep eximstats exipick exiqgrep exiqsumm \
250         transport-filter.pl convert4r3 convert4r4 \
251         exim_checkaccess \
252         exim_dbmbuild exim_dumpdb exim_fixdb exim_tidydb \
253         exim_lock exim_msgdate exim_id_update
254
255
256 # Targets for special-purpose configuration header builders
257 buildconfig: buildconfig.c
258         @echo "$(CC) buildconfig.c"
259         $(FE)$(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS)
260
261
262 # Target for the exicyclog utility script
263 exicyclog: config ../src/exicyclog.src
264         @rm -f exicyclog
265         @. ./version.sh && sed \
266           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
267           -e "/^# /p" \
268           -e "/^# /d" \
269           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
270           -e "s?CONFIGURE_FILE_USE_EUID?$(CONFIGURE_FILE_USE_EUID)?" \
271           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
272           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
273           -e "s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)?" \
274           -e "s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)?" \
275           -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
276           -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \
277           -e "s?CHMOD_COMMAND?$(CHMOD_COMMAND)?" \
278           -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \
279           -e "s?MV_COMMAND?$(MV_COMMAND)?" \
280           -e "s?RM_COMMAND?$(RM_COMMAND)?" \
281           -e "s?TOUCH_COMMAND?$(TOUCH_COMMAND)?" \
282           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
283           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
284           ../src/exicyclog.src > exicyclog-t
285         @mv exicyclog-t exicyclog
286         @chmod a+x exicyclog
287         @echo ">>> exicyclog script built"
288
289 # Target for the exinext utility script
290 exinext: config ../src/exinext.src
291         @rm -f exinext
292         @. ./version.sh && sed \
293           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
294           -e "/^# /p" \
295           -e "/^# /d" \
296           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
297           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
298           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
299           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
300           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
301           ../src/exinext.src > exinext-t
302         @mv exinext-t exinext
303         @chmod a+x exinext
304         @echo ">>> exinext script built"
305
306 # Target for the exiwhat utility script
307 exiwhat: config ../src/exiwhat.src
308         @rm -f exiwhat
309         @. ./version.sh && sed \
310           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
311           -e "/^# /p" \
312           -e "/^# /d" \
313           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
314           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
315           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
316           -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
317           -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
318           -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \
319           -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
320           -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
321           -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
322           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
323           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
324           -e "s?RM_COMMAND?$(RM_COMMAND)?" \
325           ../src/exiwhat.src > exiwhat-t
326         @mv exiwhat-t exiwhat
327         @chmod a+x exiwhat
328         @echo ">>> exiwhat script built"
329
330 # Target for the exim_checkaccess utility script
331 exim_checkaccess: config ../src/exim_checkaccess.src
332         @rm -f exim_checkaccess
333         @. ./version.sh && sed \
334           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
335           -e "/^# /p" \
336           -e "/^# /d" \
337           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
338           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
339           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
340           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
341           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
342           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
343           ../src/exim_checkaccess.src > exim_checkaccess-t
344         @mv exim_checkaccess-t exim_checkaccess
345         @chmod a+x exim_checkaccess
346         @echo ">>> exim_checkaccess script built"; echo ""
347
348 # Target for the Exim monitor start-up script
349 eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
350           ../Local/eximon.conf
351         @rm -f eximon
352         $(SHELL) $(SCRIPTS)/Configure-eximon
353         @. ./version.sh && sed \
354           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
355           -e "/^# /p" \
356           -e "/^# /d" \
357           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
358           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
359           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
360           -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
361           -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
362           -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
363           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
364           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
365           ../src/eximon.src >> eximon
366         @echo ">>> eximon script built"; echo ""
367
368 # Targets for utilities; these are all Perl scripts that have to get the
369 # location of Perl put in them. A few need other things as well.
370
371 exigrep: config ../src/exigrep.src
372         @rm -f exigrep
373         @. ./version.sh && sed \
374           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
375           -e "/^# /p" \
376           -e "/^# /d" \
377           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
378           -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
379           -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
380           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
381           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
382           ../src/exigrep.src > exigrep-t
383         @mv exigrep-t exigrep
384         @chmod a+x exigrep
385         @echo ">>> exigrep script built"
386
387 exim_msgdate: config ../src/exim_msgdate.src
388         @rm -f exim_msgdate
389         @. ./version.sh && sed \
390           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
391           -e "/^[ \t]*# /p" \
392           -e "/^[ \t]*# /d" \
393           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
394           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
395           -e "s?BASE_62?$${BASE_62:-62}?" \
396           -e "s?CONFIGURE_FILE\"?$(CONFIGURE_FILE)\"?" \
397           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
398           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
399           ../src/exim_msgdate.src > exim_msgdate-t
400         @mv exim_msgdate-t exim_msgdate
401         @chmod a+x exim_msgdate
402         @echo ">>> exim_msgdate script built"
403
404 eximstats: config ../src/eximstats.src
405         @rm -f eximstats
406         @. ./version.sh && sed \
407           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
408           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
409           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
410           ../src/eximstats.src > eximstats-t
411         @mv eximstats-t eximstats
412         @chmod a+x eximstats
413         @echo ">>> eximstats script built"
414
415 exiqgrep: config ../src/exiqgrep.src
416         @rm -f exiqgrep
417         @. ./version.sh && sed \
418           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
419           -e "/^# /p" \
420           -e "/^# /d" \
421           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
422           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
423           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
424           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
425           ../src/exiqgrep.src > exiqgrep-t
426         @mv exiqgrep-t exiqgrep
427         @chmod a+x exiqgrep
428         @echo ">>> exiqgrep script built"
429
430 exiqsumm: config ../src/exiqsumm.src
431         @rm -f exiqsumm
432         @. ./version.sh && sed \
433           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
434           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
435           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
436           ../src/exiqsumm.src > exiqsumm-t
437         @mv exiqsumm-t exiqsumm
438         @chmod a+x exiqsumm
439         @echo ">>> exiqsumm script built"
440
441 exipick: config ../src/exipick.src
442         @rm -f exipick
443         @. ./version.sh && sed \
444           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
445           -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
446           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
447           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
448           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
449           ../src/exipick.src > exipick-t
450         @mv exipick-t exipick
451         @chmod a+x exipick
452         @echo ">>> exipick script built"
453
454 exim_id_update: config ../src/exim_id_update.src
455         @rm -f exim_id_update
456         @. ./version.sh && sed \
457           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
458           -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
459           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
460           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
461           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
462           ../src/exim_id_update.src > exim_id_update-t
463         @mv exim_id_update-t exim_id_update
464         @chmod a+x exim_id_update
465         @echo ">>> exim_id_update script built"
466
467 transport-filter.pl: config ../src/transport-filter.src
468         @rm -f transport-filter.pl
469         @. ./version.sh && sed \
470           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
471           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
472           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
473           ../src/transport-filter.src > transport-filter.pl-t
474         @mv transport-filter.pl-t transport-filter.pl
475         @chmod a+x transport-filter.pl
476         @echo ">>> transport-filter.pl script built"
477
478 convert4r3: config ../src/convert4r3.src
479         @rm -f convert4r3
480         @. ./version.sh && sed \
481           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
482           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
483           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
484           ../src/convert4r3.src > convert4r3-t
485         @mv convert4r3-t convert4r3
486         @chmod a+x convert4r3
487         @echo ">>> convert4r3 script built"
488
489 convert4r4: config ../src/convert4r4.src
490         @rm -f convert4r4
491         @. ./version.sh && sed \
492           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
493           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
494           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
495           ../src/convert4r4.src > convert4r4-t
496         @mv convert4r4-t convert4r4
497         @chmod a+x convert4r4
498         @echo ">>> convert4r4 script built"
499
500
501 # These are objects of optional features. They are always compiled, but
502 # if the corresponding #defines are not set, they wind up empty and
503 # are thrown away by the linker.
504
505 OBJ_WITH_CONTENT_SCAN = malware.o mime.o regex.o spam.o spool_mbox.o
506 OBJ_EXPERIMENTAL =      arc.o \
507                         bmi_spam.o \
508                         dane.o \
509                         dcc.o \
510                         dmarc.o \
511                         imap_utf7.o \
512                         spf.o \
513                         utf8.o \
514                         xclient.o
515
516 # Targets for final binaries; the main one has a build number which is
517 # updated each time. We don't bother with that for the auxiliaries.
518
519 OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
520
521 OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
522         directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
523         filtertest.o globals.o dkim.o dkim_transport.o dnsbl.o hash.o \
524         header.o host.o host_address.o ip.o log.o lss.o match.o md5.o moan.o \
525         os.o parse.o priv.o proxy.o queue.o \
526         rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o regex_cache.o \
527         route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
528         std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
529         environment.o macro.o \
530         $(OBJ_LOOKUPS) \
531         local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
532         $(OBJ_EXPERIMENTAL)
533
534 exim:   buildlookups buildauths pdkim/pdkim.a \
535         buildrouters buildtransports \
536         $(OBJ_EXIM) version.o
537         @echo "$(LNCC) -o exim"
538         $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
539           routers/routers.a transports/transports.a lookups/lookups.a \
540           auths/auths.a pdkim/pdkim.a \
541           $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
542           $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
543           $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
544         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
545           echo $(STRIP_COMMAND) exim; \
546           $(STRIP_COMMAND) exim; \
547         fi
548         $(EXIM_CHMOD)
549         @echo " "
550         @echo ">>> exim binary built"
551         @echo " "
552
553 # The utility for dumping the contents of an exim database
554
555 OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
556
557 exim_dumpdb: $(OBJ_DUMPDB)
558         @echo "$(LNCC) -o exim_dumpdb"
559         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
560           $(LIBS) $(EXTRALIBS) $(DBMLIB)
561         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
562           echo $(STRIP_COMMAND) exim_dumpdb; \
563           $(STRIP_COMMAND) exim_dumpdb; \
564         fi
565         @echo ">>> exim_dumpdb utility built"
566         @echo " "
567
568 # The utility for interrogating/fixing the contents of an exim database
569
570 OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o util-md5.o
571
572 exim_fixdb:  $(OBJ_FIXDB)
573         @echo "$(LNCC) -o exim_fixdb"
574         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
575           $(LIBS) $(EXTRALIBS) $(DBMLIB)
576         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
577           echo $(STRIP_COMMAND) exim_fixdb; \
578           $(STRIP_COMMAND) exim_fixdb; \
579         fi
580         @echo ">>> exim_fixdb utility built"
581         @echo " "
582
583 # The utility for tidying the contents of an exim database
584
585 OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
586
587 exim_tidydb: $(OBJ_TIDYDB)
588         @echo "$(LNCC) -o exim_tidydb"
589         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
590           $(LIBS) $(EXTRALIBS) $(DBMLIB)
591         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
592           echo $(STRIP_COMMAND) exim_tidydb; \
593           $(STRIP_COMMAND) exim_tidydb; \
594         fi
595         @echo ">>> exim_tidydb utility built"
596         @echo " "
597
598 # The utility for building dbm files
599
600 exim_dbmbuild: exim_dbmbuild.o
601         @echo "$(LNCC) -o exim_dbmbuild"
602         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
603           $(LIBS) $(EXTRALIBS) $(DBMLIB)
604         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
605           echo $(STRIP_COMMAND) exim_dbmbuild; \
606           $(STRIP_COMMAND) exim_dbmbuild; \
607         fi
608         @echo ">>> exim_dbmbuild utility built"
609         @echo " "
610
611 # The utility for locking a mailbox while messing around with it
612
613 exim_lock: exim_lock.c os.h
614         @echo "$(CC) exim_lock.c"
615         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
616         @echo "$(LNCC) -o exim_lock"
617         $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o  \
618           $(LIBS) $(EXTRALIBS)
619         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
620           echo $(STRIP_COMMAND) exim_lock; \
621           $(STRIP_COMMAND) exim_lock; \
622         fi
623         @echo ">>> exim_lock utility built"
624         @echo " "
625
626 # The X-based Exim monitor program's binary part. There's a macro for cutting
627 # out the modified TextPop module, because some antique link editors cannot
628 # handle the fact that it is redefining things that are found later in the
629 # Xaw library.
630
631 # Object modules that are the unique Eximon modules
632
633 MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
634         em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
635         em_text.o em_xs.o
636
637 # The complete modules list also includes some specially compiled versions of
638 # code from the main Exim source tree.
639
640 OBJ_MONBIN = util-host_address.o \
641              util-queue.o \
642              util-spool_in.o \
643              util-store.o \
644              util-string.o \
645              util-tod.o \
646              util-tree.o \
647              $(MONBIN)
648
649 eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) ../exim_monitor/em_version.c \
650                 mytypes.h store.h macros.h
651         @echo "$(CC) exim_monitor/em_version.c"
652         $(FE)$(CC) -o em_version.o -c \
653           $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
654         @echo "$(LNCC) -o eximon.bin"
655         $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
656           $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
657           $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
658         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
659           echo $(STRIP_COMMAND) eximon.bin; \
660           $(STRIP_COMMAND) eximon.bin; \
661         fi
662         @echo ">>> exim monitor binary built"
663         @echo " "
664
665
666 # Compile step for most of the exim modules. HDRS is a list of headers
667 # which cause everything to be rebuilt. PHDRS is the same, for the use
668 # of routers, transports, and authenticators. I can't find a way of doing this
669 # in one. This list is overkill, but it doesn't really take much time to
670 # rebuild Exim on a modern computer.
671
672 HDRS  = blob.h \
673         config.h \
674         dbfunctions.h \
675         exim.h \
676         functions.h \
677         globals.h \
678         hash.h \
679         hintsdb.h \
680         hintsdb_structs.h \
681         local_scan.h \
682         macros.h \
683         mytypes.h \
684         sha_ver.h \
685         structs.h \
686         os.h
687 PHDRS = ../config.h \
688         ../dbfunctions.h \
689         ../exim.h \
690         ../functions.h \
691         ../globals.h \
692         ../hintsdb.h \
693         ../hintsdb_structs.h \
694         ../local_scan.h \
695         ../macros.h \
696         ../mytypes.h \
697         ../structs.h \
698         ../os.h
699
700 .SUFFIXES: .o .c
701 .c.o:;  @echo "$(CC) $*.c"
702         $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
703
704 # Update Exim's version information and build the version object.  The dependency
705 # chain here avoids problems under parallel-make.
706
707 version.sh:
708         @../scripts/reversion
709
710 version.h: version.sh
711
712 cnumber.h: version.h
713
714 version.o: $(HDRS) cnumber.h version.h version.c
715
716 # This is the dummy module for use by test compiles of individual modules. It
717 # contains functions such as log_write() that may be called from bits of Exim
718 # in the tested code.
719
720 dummies.o:       dummies.c
721
722 # Compile instructions for perl.o for when EXIM_PERL is set
723
724 perl.o:          $(HDRS) perl.c
725         @echo "$(PERL_CC) perl.c"
726         $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
727
728 # Compile instructions for the database utility modules
729
730 exim_dumpdb.o:   $(HDRS) exim_dbutil.c
731         @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
732         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
733                                       -DCOMPILE_UTILITY \
734                                       -DEXIM_DUMPDB \
735                                       -o exim_dumpdb.o exim_dbutil.c
736
737 exim_fixdb.o:    $(HDRS) exim_dbutil.c
738         @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
739         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
740                                       -DCOMPILE_UTILITY \
741                                       -DEXIM_FIXDB \
742                                       -o exim_fixdb.o exim_dbutil.c
743
744 exim_tidydb.o:   $(HDRS) exim_dbutil.c
745         @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
746         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
747                                       -DCOMPILE_UTILITY \
748                                       -DEXIM_TIDYDB \
749                                       -o exim_tidydb.o exim_dbutil.c
750
751 # Compile instructions for exim_dbmbuild
752
753 exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
754         @echo "$(CC) exim_dbmbuild.c"
755         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \
756                 -o exim_dbmbuild.o exim_dbmbuild.c
757
758 # Utilities use special versions of some modules - typically with debugging
759 # calls cut out.
760
761 util-host_address.o:   $(HDRS) host_address.c
762         @echo "$(CC) -DCOMPILE_UTILITY host_address.c"
763         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-host_address.o host_address.c
764
765 util-md5.o:   $(HDRS) md5.c
766         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
767         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-md5.o md5.c
768
769 util-spool_in.o: $(HDRS) spool_in.c
770         @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
771         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
772
773 util-store.o:    $(HDRS) store.c
774         @echo "$(CC) -DCOMPILE_UTILITY store.c"
775         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
776
777 util-string.o:   $(HDRS) string.c
778         @echo "$(CC) -DCOMPILE_UTILITY string.c"
779         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
780
781 util-queue.o:   $(HDRS) queue.c
782         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
783         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c
784
785 util-tod.o:   $(HDRS) tod.c
786         @echo "$(CC) -DCOMPILE_UTILITY tod.c"
787         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c
788
789 util-tree.o:   $(HDRS) tree.c
790         @echo "$(CC) -DCOMPILE_UTILITY tree.c"
791         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tree.o tree.c
792
793 util-os.o:       $(HDRS) os.c
794         @echo "$(CC) -DCOMPILE_UTILITY os.c"
795         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
796                                       -DCOMPILE_UTILITY \
797                                       -DOS_LOAD_AVERAGE \
798                                       -DFIND_RUNNING_INTERFACES \
799                                       -o util-os.o os.c
800
801 # The local scan module depends only on its own special header, and is compiled
802 # from a source whose location is set by configuration.
803
804 local_scan.o:    config local_scan.h ../$(LOCAL_SCAN_SOURCE)
805         @echo "$(CC) local_scan.c"
806         $(FE)$(CC) -DLOCAL_SCAN -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
807
808 # Dependencies for the "ordinary" exim modules
809
810 acl.o:           $(HDRS) acl.c
811 base64.o:        $(HDRS) mime.h base64.c
812 child.o:         $(HDRS) child.c
813 crypt16.o:       $(HDRS) crypt16.c
814 daemon.o:        $(HDRS) daemon.c
815 dbfn.o:          $(HDRS) dbfn.c
816 debug.o:         $(HDRS) debug.c
817 deliver.o:       $(HDRS) transports/smtp.h deliver.c
818 directory.o:     $(HDRS) directory.c
819 dns.o:           $(HDRS) dns.c
820 dnsbl.o:         $(HDRS) dnsbl.c
821 enq.o:           $(HDRS) enq.c
822 exim.o:          $(HDRS) exim.c
823 expand.o:        $(HDRS) expand.c
824 environment.o:   $(HDRS) environment.c
825 filter.o:        $(HDRS) filter.c
826 filtertest.o:    $(HDRS) filtertest.c
827 globals.o:       $(HDRS) globals.c
828 hash.o:          $(HDRS) hash.c
829 header.o:        $(HDRS) header.c
830 host.o:          $(HDRS) host.c
831 host_address.o:  $(HDRS) host_address.c
832 ip.o:            $(HDRS) ip.c
833 log.o:           $(HDRS) log.c
834 lss.o:           $(HDRS) lss.c
835 match.o:         $(HDRS) match.c
836 md5.o:           $(HDRS) md5.c
837 moan.o:          $(HDRS) moan.c
838 os.o:            $(HDRS) $(OS_C_INCLUDES) os.c
839 parse.o:         $(HDRS) parse.c
840 priv.o:          $(HDRS) priv.c
841 proxy.o:         $(HDRS) proxy.c
842 queue.o:         $(HDRS) queue.c
843 rda.o:           $(HDRS) rda.c
844 readconf.o:      $(HDRS) readconf.c
845 receive.o:       $(HDRS) receive.c
846 retry.o:         $(HDRS) retry.c
847 rewrite.o:       $(HDRS) rewrite.c
848 regex_cache.o:   $(HDRS) regex_cache.c
849 rfc2047.o:       $(HDRS) rfc2047.c
850 route.o:         $(HDRS) route.c
851 search.o:        $(HDRS) search.c
852 sieve.o:         $(HDRS) sieve.c
853 smtp_in.o:       $(HDRS) smtp_in.c
854 smtp_out.o:      $(HDRS) smtp_out.c
855 spool_in.o:      $(HDRS) spool_in.c
856 spool_out.o:     $(HDRS) spool_out.c
857 std-crypto.o:    $(HDRS) std-crypto.c
858 store.o:         $(HDRS) store.c
859 string.o:        $(HDRS) string.c
860 tls.o:           $(HDRS) tls.c \
861                  tls-gnu.c tlscert-gnu.c \
862                  tls-openssl.c tlscert-openssl.c \
863                  tls-cipher-stdname.c
864 tod.o:           $(HDRS) tod.c
865 transport.o:     $(HDRS) transport.c
866 tree.o:          $(HDRS) tree.c
867 verify.o:        $(HDRS) transports/smtp.h verify.c
868 dkim.o:          $(HDRS) pdkim/pdkim.h dkim.c
869 dkim_transport.o: $(HDRS) dkim_transport.c
870
871 # Dependencies for WITH_CONTENT_SCAN modules
872
873 malware.o:       $(HDRS) malware.c
874 mime.o:          $(HDRS) mime.h mime.c
875 regex.o:         $(HDRS) regex.c
876 spam.o:          $(HDRS) spam.c
877 spool_mbox.o:    $(HDRS) spool_mbox.c
878
879
880 # Dependencies for EXPERIMENTAL_* modules
881
882 arc.o:          $(HDRS) pdkim/pdkim.h arc.c
883 bmi_spam.o:     $(HDRS) bmi_spam.c
884 dane.o:         $(HDRS) dane.c dane-openssl.c
885 dcc.o:          $(HDRS) dcc.h dcc.c
886 dmarc.o:        $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c
887 imap_utf7.o:    $(HDRS) imap_utf7.c
888 spf.o:          $(HDRS) spf.h spf.c
889 utf8.o:         $(HDRS) utf8.c
890 xclient.o:      $(HDRS) xclient.c
891
892 # The module containing tables of available lookups, routers, auths, and
893 # transports must be rebuilt if any of them are. However, because the makefiles
894 # for the drivers are always run, we don't actually put the dependencies here,
895 # because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
896 # drtables.o even though the .a files haven't in fact been updated. Instead
897 # it is arranged that the lower-level makefiles remove drtables.o when they
898 # rebuild the .a files.
899
900 drtables.o:      $(HDRS) drtables.c
901
902 # We depend upon object files built as part of building the lookups library
903 # When using parallel make, we don't have the dependency to force building
904 # in the sub-directory unless we force that dependency:
905
906 $(OBJ_LOOKUPS):  buildlookups
907
908 # The exim monitor's private modules - the sources live in a private
909 # subdirectory. The final binary combines the private modules with some
910 # modules from the main exim binary.
911
912 em_StripChart.o: ../exim_monitor/em_StripChart.c
913 em_TextPop.o:    ../exim_monitor/em_TextPop.c
914 em_globals.o:    ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
915 em_init.o:       ../exim_monitor/em_init.c    ../exim_monitor/em_hdr.h
916 em_log.o:        ../exim_monitor/em_log.c     ../exim_monitor/em_hdr.h
917 em_main.o:       ../exim_monitor/em_main.c    ../exim_monitor/em_hdr.h
918 em_menu.o:       ../exim_monitor/em_menu.c    ../exim_monitor/em_hdr.h
919 em_queue.o:      ../exim_monitor/em_queue.c   ../exim_monitor/em_hdr.h
920 em_strip.o:      ../exim_monitor/em_strip.c   ../exim_monitor/em_hdr.h
921 em_text.o:       ../exim_monitor/em_text.c    ../exim_monitor/em_hdr.h
922 em_xs.o:         ../exim_monitor/em_xs.c      ../exim_monitor/em_hdr.h
923 em_version.o:    ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
924 $(MONBIN): $(HDRS)
925                  @echo "$(CC) exim_monitor/$(@:.o=.c)"
926                  $(FE)$(CC) -o $@ -c $(CFLAGS) -DCOMPILE_UTILITY -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
927                    ../exim_monitor/$(@:.o=.c)
928
929
930 # Targets for the various libraries that Exim uses.
931
932 # The lookups library.
933
934 buildlookups: config
935          @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
936            CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
937            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
938            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
939          @echo " "
940
941 # The routers library.
942
943 buildrouters: config
944          @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
945            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
946            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
947          @echo " "
948
949 # The transports library.
950
951 buildtransports: config
952          @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
953            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
954            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
955          @echo " "
956
957 # The library of authorization modules
958
959 buildauths: config
960          @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
961            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
962            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
963          @echo " "
964
965 # The PDKIM library
966
967 buildpdkim: pdkim/pdkim.a
968 pdkim/pdkim.a: config
969          @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
970            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
971            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
972          @echo " "
973
974 # The "clean", "install", and "makefile" targets just pass themselves back to
975 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
976 # for them in the build directory.
977
978 clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
979
980 # Targets for building stand-alone testing programs for basic testing of
981 # some of the building blocks. These are not integrated with the makefile-
982 # building targets. If you change something that is going to cause the
983 # makefile to be rebuilt, you must run "make makefile" before running one
984 # of these.
985
986 # The testing programs use different versions of some modules - usually
987 # with bits cut out that are not relevant to the test in hand. For those
988 # that are used by several tests, we use a different name.
989
990 sa-globals.o:    $(HDRS) globals.c
991         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
992
993 sa-os.o:         $(HDRS) os.c
994         $(CC) -c $(CFLAGS) $(INCLUDE) \
995                                       -DFIND_RUNNING_INTERFACES \
996                                       -o sa-os.o os.c
997
998 # These are the test targets themselves
999
1000 test_dbfn:   config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
1001                string.o tod.o version.o utf8.o
1002         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
1003         $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
1004         $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
1005           dummies.o sa-globals.o sa-os.o store.o string.o \
1006           tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
1007         rm -f dbfn.o store.o
1008
1009 test_host:   config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
1010                host_address.o store.o string.o tod.o tree.o
1011         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c
1012         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
1013         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
1014         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
1015         $(LNCC) -o test_host $(LFLAGS) \
1016           host.o host_address.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
1017           tod.o tree.o $(LIBS) $(LIBRESOLV)
1018         rm -f child.o dummies.o host.o dns.o
1019
1020 test_os:     os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
1021         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
1022         $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
1023           sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1024         rm -f os.o
1025
1026 test_parse:  config.h parse.c dummies.o sa-globals.o \
1027              store.o string.o tod.o version.o utf8.o
1028         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
1029         $(LNCC) -o test_parse $(LFLAGS) parse.o \
1030           dummies.o sa-globals.o store.o string.o tod.o version.o \
1031           utf8.o $(LDFLAGS)
1032         rm -f parse.o
1033
1034 test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
1035         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
1036         $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
1037           dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1038         rm -f string.o
1039
1040 # End