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