a6354a4c934d84837b02de7c5dd10dbcab0b4405
[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 - 2024
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 path_max.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         @./exicyclog -v 2>&1 >/dev/null
291         @echo ">>> exicyclog script built"
292
293 # Target for the exinext utility script
294 exinext: config ../src/exinext.src
295         @rm -f exinext
296         @. ./version.sh && sed \
297           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
298           -e "/^# /p" \
299           -e "/^# /d" \
300           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
301           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
302           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
303           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
304           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
305           ../src/exinext.src > exinext-t
306         @mv exinext-t exinext
307         @chmod a+x exinext
308         @./exinext -v 2>&1 >/dev/null
309         @echo ">>> exinext script built"
310
311 # Target for the exiwhat utility script
312 exiwhat: config ../src/exiwhat.src
313         @rm -f exiwhat
314         @. ./version.sh && sed \
315           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
316           -e "/^# /p" \
317           -e "/^# /d" \
318           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
319           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
320           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
321           -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
322           -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
323           -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \
324           -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
325           -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
326           -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
327           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
328           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
329           -e "s?RM_COMMAND?$(RM_COMMAND)?" \
330           ../src/exiwhat.src > exiwhat-t
331         @mv exiwhat-t exiwhat
332         @chmod a+x exiwhat
333         @./exiwhat -v 2>&1 >/dev/null
334         @echo ">>> exiwhat script built"
335
336 # Target for the exim_checkaccess utility script
337 exim_checkaccess: config ../src/exim_checkaccess.src
338         @rm -f exim_checkaccess
339         @. ./version.sh && sed \
340           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
341           -e "/^# /p" \
342           -e "/^# /d" \
343           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
344           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
345           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
346           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
347           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
348           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
349           ../src/exim_checkaccess.src > exim_checkaccess-t
350         @mv exim_checkaccess-t exim_checkaccess
351         @chmod a+x exim_checkaccess
352         # @./exim_checkaccess -v 2>&1 >/dev/null
353         @echo ">>> exim_checkaccess script built"; echo ""
354
355 # Target for the Exim monitor start-up script
356 eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
357           ../Local/eximon.conf
358         @rm -f eximon
359         $(SHELL) $(SCRIPTS)/Configure-eximon
360         @. ./version.sh && sed \
361           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
362           -e "/^# /p" \
363           -e "/^# /d" \
364           -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
365           -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
366           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
367           -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
368           -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
369           -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
370           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
371           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
372           ../src/eximon.src >> eximon
373         @./eximon -v 2>&1 >/dev/null
374         @echo ">>> eximon script built"; echo ""
375
376 # Targets for utilities; these are all Perl scripts that have to get the
377 # location of Perl put in them. A few need other things as well.
378
379 exigrep: config ../src/exigrep.src
380         @rm -f exigrep
381         @. ./version.sh && sed \
382           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
383           -e "/^# /p" \
384           -e "/^# /d" \
385           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
386           -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
387           -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
388           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
389           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
390           ../src/exigrep.src > exigrep-t
391         @mv exigrep-t exigrep
392         @chmod a+x exigrep
393         @./exigrep --version 2>&1 >/dev/null
394         @echo ">>> exigrep script built"
395
396 exim_msgdate: config ../src/exim_msgdate.src
397         @rm -f exim_msgdate
398         @. ./version.sh && sed \
399           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
400           -e "/^[ \t]*# /p" \
401           -e "/^[ \t]*# /d" \
402           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
403           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
404           -e "s?BASE_62?$${BASE_62:-62}?" \
405           -e "s?CONFIGURE_FILE\"?$(CONFIGURE_FILE)\"?" \
406           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
407           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
408           ../src/exim_msgdate.src > exim_msgdate-t
409         @mv exim_msgdate-t exim_msgdate
410         @chmod a+x exim_msgdate
411         @./exim_msgdate -v 2>&1 >/dev/null
412         @echo ">>> exim_msgdate script built"
413
414 eximstats: config ../src/eximstats.src
415         @rm -f eximstats
416         @. ./version.sh && sed \
417           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
418           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
419           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
420           ../src/eximstats.src > eximstats-t
421         @mv eximstats-t eximstats
422         @chmod a+x eximstats
423         @./eximstats -v 2>&1 >/dev/null
424         @echo ">>> eximstats script built"
425
426 exiqgrep: config ../src/exiqgrep.src
427         @rm -f exiqgrep
428         @. ./version.sh && sed \
429           -e "s?PROCESSED_FLAG?This file has been so processed.?"\
430           -e "/^# /p" \
431           -e "/^# /d" \
432           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
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/exiqgrep.src > exiqgrep-t
437         @mv exiqgrep-t exiqgrep
438         @chmod a+x exiqgrep
439         @./exiqgrep -v 2>&1 >/dev/null
440         @echo ">>> exiqgrep script built"
441
442 exiqsumm: config ../src/exiqsumm.src
443         @rm -f exiqsumm
444         @. ./version.sh && sed \
445           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
446           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
447           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
448           ../src/exiqsumm.src > exiqsumm-t
449         @mv exiqsumm-t exiqsumm
450         @chmod a+x exiqsumm
451         @./exiqsumm -v 2>&1 >/dev/null
452         @echo ">>> exiqsumm script built"
453
454 exipick: config ../src/exipick.src
455         @rm -f exipick
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/exipick.src > exipick-t
463         @mv exipick-t exipick
464         @chmod a+x exipick
465         @./exipick -v 2>&1 >/dev/null
466         @echo ">>> exipick script built"
467
468 exim_id_update: config ../src/exim_id_update.src
469         @rm -f exim_id_update
470         @. ./version.sh && sed \
471           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
472           -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
473           -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
474           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
475           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
476           ../src/exim_id_update.src > exim_id_update-t
477         @mv exim_id_update-t exim_id_update
478         @chmod a+x exim_id_update
479         @./exim_id_update -v 2>&1 >/dev/null
480         @echo ">>> exim_id_update script built"
481
482 transport-filter.pl: config ../src/transport-filter.src
483         @rm -f transport-filter.pl
484         @. ./version.sh && sed \
485           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
486           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
487           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
488           ../src/transport-filter.src > transport-filter.pl-t
489         @mv transport-filter.pl-t transport-filter.pl
490         @chmod a+x transport-filter.pl
491         @echo ">>> transport-filter.pl script built"
492
493 convert4r3: config ../src/convert4r3.src
494         @rm -f convert4r3
495         @. ./version.sh && sed \
496           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
497           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
498           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
499           ../src/convert4r3.src > convert4r3-t
500         @mv convert4r3-t convert4r3
501         @chmod a+x convert4r3
502         @./convert4r3 -v 2>&1 >/dev/null
503         @echo ">>> convert4r3 script built"
504
505 convert4r4: config ../src/convert4r4.src
506         @rm -f convert4r4
507         @. ./version.sh && sed \
508           -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
509           -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
510           -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
511           ../src/convert4r4.src > convert4r4-t
512         @mv convert4r4-t convert4r4
513         @chmod a+x convert4r4
514         @./convert4r4 -v 2>&1 >/dev/null
515         @echo ">>> convert4r4 script built"
516
517
518 # These are objects of optional features. They are always compiled, but
519 # if the corresponding #defines are not set, they wind up empty and
520 # are thrown away by the linker.
521
522 OBJ_WITH_CONTENT_SCAN = malware.o mime.o regex.o spam.o spool_mbox.o
523 OBJ_EXPERIMENTAL =      arc.o \
524                         bmi_spam.o \
525                         dane.o \
526                         dcc.o \
527                         dmarc.o \
528                         imap_utf7.o \
529                         spf.o \
530                         utf8.o \
531                         xclient.o
532
533 # Targets for final binaries; the main one has a build number which is
534 # updated each time. We don't bother with that for the auxiliaries.
535
536 OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
537
538 OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
539         directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
540         filtertest.o globals.o dkim.o dkim_transport.o dnsbl.o hash.o \
541         header.o host.o host_address.o ip.o log.o lss.o match.o md5.o moan.o \
542         os.o parse.o priv.o proxy.o queue.o \
543         rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o regex_cache.o \
544         route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
545         std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
546         environment.o macro.o \
547         $(OBJ_LOOKUPS) \
548         local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
549         $(OBJ_EXPERIMENTAL)
550
551 exim:   buildlookups buildauths pdkim/pdkim.a \
552         buildrouters buildtransports \
553         $(OBJ_EXIM) version.o
554         @echo "$(LNCC) -o exim"
555         $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
556           routers/routers.a transports/transports.a lookups/lookups.a \
557           auths/auths.a pdkim/pdkim.a \
558           $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
559           $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
560           $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
561         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
562           echo $(STRIP_COMMAND) exim; \
563           $(STRIP_COMMAND) exim; \
564         fi
565         $(EXIM_CHMOD)
566         @echo " "
567         @echo ">>> exim binary built"
568         @echo " "
569
570 # The utility for dumping the contents of an exim database
571
572 OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
573
574 exim_dumpdb: $(OBJ_DUMPDB)
575         @echo "$(LNCC) -o exim_dumpdb"
576         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
577           $(LIBS) $(EXTRALIBS) $(DBMLIB)
578         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
579           echo $(STRIP_COMMAND) exim_dumpdb; \
580           $(STRIP_COMMAND) exim_dumpdb; \
581         fi
582         @echo ">>> exim_dumpdb utility built"
583         @echo " "
584
585 # The utility for interrogating/fixing the contents of an exim database
586
587 OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o util-md5.o
588
589 exim_fixdb:  $(OBJ_FIXDB)
590         @echo "$(LNCC) -o exim_fixdb"
591         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
592           $(LIBS) $(EXTRALIBS) $(DBMLIB)
593         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
594           echo $(STRIP_COMMAND) exim_fixdb; \
595           $(STRIP_COMMAND) exim_fixdb; \
596         fi
597         @echo ">>> exim_fixdb utility built"
598         @echo " "
599
600 # The utility for tidying the contents of an exim database
601
602 OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
603
604 exim_tidydb: $(OBJ_TIDYDB)
605         @echo "$(LNCC) -o exim_tidydb"
606         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
607           $(LIBS) $(EXTRALIBS) $(DBMLIB)
608         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
609           echo $(STRIP_COMMAND) exim_tidydb; \
610           $(STRIP_COMMAND) exim_tidydb; \
611         fi
612         @echo ">>> exim_tidydb utility built"
613         @echo " "
614
615 # The utility for building dbm files
616
617 exim_dbmbuild: exim_dbmbuild.o
618         @echo "$(LNCC) -o exim_dbmbuild"
619         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
620           $(LIBS) $(EXTRALIBS) $(DBMLIB)
621         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
622           echo $(STRIP_COMMAND) exim_dbmbuild; \
623           $(STRIP_COMMAND) exim_dbmbuild; \
624         fi
625         @echo ">>> exim_dbmbuild utility built"
626         @echo " "
627
628 # The utility for locking a mailbox while messing around with it
629
630 exim_lock: exim_lock.c os.h
631         @echo "$(CC) exim_lock.c"
632         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
633         @echo "$(LNCC) -o exim_lock"
634         $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o  \
635           $(LIBS) $(EXTRALIBS)
636         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
637           echo $(STRIP_COMMAND) exim_lock; \
638           $(STRIP_COMMAND) exim_lock; \
639         fi
640         @echo ">>> exim_lock utility built"
641         @echo " "
642
643 # The X-based Exim monitor program's binary part. There's a macro for cutting
644 # out the modified TextPop module, because some antique link editors cannot
645 # handle the fact that it is redefining things that are found later in the
646 # Xaw library.
647
648 # Object modules that are the unique Eximon modules
649
650 MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
651         em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
652         em_text.o em_xs.o
653
654 # The complete modules list also includes some specially compiled versions of
655 # code from the main Exim source tree.
656
657 OBJ_MONBIN = util-host_address.o \
658              util-queue.o \
659              util-spool_in.o \
660              util-store.o \
661              util-string.o \
662              util-tod.o \
663              util-tree.o \
664              $(MONBIN)
665
666 eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) ../exim_monitor/em_version.c \
667                 mytypes.h store.h path_max.h macros.h
668         @echo "$(CC) exim_monitor/em_version.c"
669         $(FE)$(CC) -o em_version.o -c \
670           $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
671         @echo "$(LNCC) -o eximon.bin"
672         $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
673           $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
674           $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
675         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
676           echo $(STRIP_COMMAND) eximon.bin; \
677           $(STRIP_COMMAND) eximon.bin; \
678         fi
679         @echo ">>> exim monitor binary built"
680         @echo " "
681
682
683 # Compile step for most of the exim modules. HDRS is a list of headers
684 # which cause everything to be rebuilt. PHDRS is the same, for the use
685 # of routers, transports, and authenticators. I can't find a way of doing this
686 # in one. This list is overkill, but it doesn't really take much time to
687 # rebuild Exim on a modern computer.
688
689 HDRS  = blob.h \
690         config.h \
691         dbfunctions.h \
692         exim.h \
693         functions.h \
694         globals.h \
695         hash.h \
696         hintsdb.h \
697         hintsdb_structs.h \
698         hintsdb/hints_bdb.h \
699         hintsdb/hints_gdbm.h \
700         hintsdb/hints_ndbm.h \
701         hintsdb/hints_sqlite.h \
702         hintsdb/hints_tdb.h \
703         local_scan.h \
704         macros.h \
705         mytypes.h \
706         path_max.h \
707         sha_ver.h \
708         structs.h \
709         os.h
710 PHDRS = ../config.h \
711         ../dbfunctions.h \
712         ../exim.h \
713         ../functions.h \
714         ../globals.h \
715         ../hintsdb.h \
716         ../hintsdb_structs.h \
717         ../hintsdb/hints_bdb.h \
718         ../hintsdb/hints_gdbm.h \
719         ../hintsdb/hints_ndbm.h \
720         ../hintsdb/hints_sqlite.h \
721         ../hintsdb/hints_tdb.h \
722         ../local_scan.h \
723         ../macros.h \
724         ../mytypes.h \
725         ../path_max.h \
726         ../structs.h \
727         ../os.h
728
729 .SUFFIXES: .o .c
730 .c.o:;  @echo "$(CC) $*.c"
731         $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
732
733 # Update Exim's version information and build the version object.  The dependency
734 # chain here avoids problems under parallel-make.
735
736 version.sh:
737         @../scripts/reversion
738
739 version.h: version.sh
740
741 cnumber.h: version.h
742
743 version.o: $(HDRS) cnumber.h version.h version.c
744
745 # This is the dummy module for use by test compiles of individual modules. It
746 # contains functions such as log_write() that may be called from bits of Exim
747 # in the tested code.
748
749 dummies.o:       dummies.c
750
751 # Compile instructions for perl.o for when EXIM_PERL is set
752
753 perl.o:          $(HDRS) perl.c
754         @echo "$(PERL_CC) perl.c"
755         $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
756
757 # Compile instructions for the database utility modules
758
759 exim_dumpdb.o:   $(HDRS) exim_dbutil.c
760         @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
761         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
762                                       -DCOMPILE_UTILITY \
763                                       -DEXIM_DUMPDB \
764                                       -o exim_dumpdb.o exim_dbutil.c
765
766 exim_fixdb.o:    $(HDRS) exim_dbutil.c
767         @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
768         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
769                                       -DCOMPILE_UTILITY \
770                                       -DEXIM_FIXDB \
771                                       -o exim_fixdb.o exim_dbutil.c
772
773 exim_tidydb.o:   $(HDRS) exim_dbutil.c
774         @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
775         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
776                                       -DCOMPILE_UTILITY \
777                                       -DEXIM_TIDYDB \
778                                       -o exim_tidydb.o exim_dbutil.c
779
780 # Compile instructions for exim_dbmbuild
781
782 exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
783         @echo "$(CC) exim_dbmbuild.c"
784         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \
785                 -o exim_dbmbuild.o exim_dbmbuild.c
786
787 # Utilities use special versions of some modules - typically with debugging
788 # calls cut out.
789
790 util-host_address.o:   $(HDRS) host_address.c
791         @echo "$(CC) -DCOMPILE_UTILITY host_address.c"
792         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-host_address.o host_address.c
793
794 util-md5.o:   $(HDRS) md5.c
795         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
796         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-md5.o md5.c
797
798 util-spool_in.o: $(HDRS) spool_in.c
799         @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
800         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
801
802 util-store.o:    $(HDRS) store.c
803         @echo "$(CC) -DCOMPILE_UTILITY store.c"
804         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
805
806 util-string.o:   $(HDRS) string.c
807         @echo "$(CC) -DCOMPILE_UTILITY string.c"
808         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
809
810 util-queue.o:   $(HDRS) queue.c
811         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
812         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c
813
814 util-tod.o:   $(HDRS) tod.c
815         @echo "$(CC) -DCOMPILE_UTILITY tod.c"
816         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c
817
818 util-tree.o:   $(HDRS) tree.c
819         @echo "$(CC) -DCOMPILE_UTILITY tree.c"
820         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tree.o tree.c
821
822 util-os.o:       $(HDRS) os.c
823         @echo "$(CC) -DCOMPILE_UTILITY os.c"
824         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
825                                       -DCOMPILE_UTILITY \
826                                       -DOS_LOAD_AVERAGE \
827                                       -DFIND_RUNNING_INTERFACES \
828                                       -o util-os.o os.c
829
830 # The local scan module depends only on its own special header, and is compiled
831 # from a source whose location is set by configuration.
832
833 local_scan.o:    config local_scan.h ../$(LOCAL_SCAN_SOURCE)
834         @echo "$(CC) local_scan.c"
835         $(FE)$(CC) -DLOCAL_SCAN -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
836
837 # Dependencies for the "ordinary" exim modules
838
839 acl.o:           $(HDRS) acl.c
840 base64.o:        $(HDRS) mime.h base64.c
841 child.o:         $(HDRS) child.c
842 crypt16.o:       $(HDRS) crypt16.c
843 daemon.o:        $(HDRS) daemon.c
844 dbfn.o:          $(HDRS) dbfn.c
845 debug.o:         $(HDRS) debug.c
846 deliver.o:       $(HDRS) transports/smtp.h deliver.c
847 directory.o:     $(HDRS) directory.c
848 dns.o:           $(HDRS) dns.c
849 dnsbl.o:         $(HDRS) dnsbl.c
850 enq.o:           $(HDRS) enq.c
851 exim.o:          $(HDRS) exim.c
852 expand.o:        $(HDRS) expand.c
853 environment.o:   $(HDRS) environment.c
854 filter.o:        $(HDRS) filter.c
855 filtertest.o:    $(HDRS) filtertest.c
856 globals.o:       $(HDRS) globals.c
857 hash.o:          $(HDRS) hash.c
858 header.o:        $(HDRS) header.c
859 host.o:          $(HDRS) host.c
860 host_address.o:  $(HDRS) host_address.c
861 ip.o:            $(HDRS) ip.c
862 log.o:           $(HDRS) log.c
863 lss.o:           $(HDRS) lss.c
864 match.o:         $(HDRS) match.c
865 md5.o:           $(HDRS) md5.c
866 moan.o:          $(HDRS) moan.c
867 os.o:            $(HDRS) $(OS_C_INCLUDES) os.c
868 parse.o:         $(HDRS) parse.c
869 priv.o:          $(HDRS) priv.c
870 proxy.o:         $(HDRS) proxy.c
871 queue.o:         $(HDRS) queue.c
872 rda.o:           $(HDRS) rda.c
873 readconf.o:      $(HDRS) readconf.c
874 receive.o:       $(HDRS) receive.c
875 retry.o:         $(HDRS) retry.c
876 rewrite.o:       $(HDRS) rewrite.c
877 regex_cache.o:   $(HDRS) regex_cache.c
878 rfc2047.o:       $(HDRS) rfc2047.c
879 route.o:         $(HDRS) route.c
880 search.o:        $(HDRS) search.c
881 sieve.o:         $(HDRS) sieve.c
882 smtp_in.o:       $(HDRS) smtp_in.c
883 smtp_out.o:      $(HDRS) smtp_out.c
884 spool_in.o:      $(HDRS) spool_in.c
885 spool_out.o:     $(HDRS) spool_out.c
886 std-crypto.o:    $(HDRS) std-crypto.c
887 store.o:         $(HDRS) store.c
888 string.o:        $(HDRS) string.c
889 tls.o:           $(HDRS) tls.c \
890                  tls-gnu.c tlscert-gnu.c \
891                  tls-openssl.c tlscert-openssl.c \
892                  tls-cipher-stdname.c
893 tod.o:           $(HDRS) tod.c
894 transport.o:     $(HDRS) transport.c
895 tree.o:          $(HDRS) tree.c
896 verify.o:        $(HDRS) transports/smtp.h verify.c
897 dkim.o:          $(HDRS) pdkim/pdkim.h dkim.c
898 dkim_transport.o: $(HDRS) dkim_transport.c
899
900 # Dependencies for WITH_CONTENT_SCAN modules
901
902 malware.o:       $(HDRS) malware.c
903 mime.o:          $(HDRS) mime.h mime.c
904 regex.o:         $(HDRS) regex.c
905 spam.o:          $(HDRS) spam.c
906 spool_mbox.o:    $(HDRS) spool_mbox.c
907
908
909 # Dependencies for EXPERIMENTAL_* modules
910
911 arc.o:          $(HDRS) pdkim/pdkim.h arc.c
912 bmi_spam.o:     $(HDRS) bmi_spam.c
913 dane.o:         $(HDRS) dane.c dane-openssl.c
914 dcc.o:          $(HDRS) dcc.h dcc.c
915 dmarc.o:        $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c
916 imap_utf7.o:    $(HDRS) imap_utf7.c
917 spf.o:          $(HDRS) spf.h spf.c
918 utf8.o:         $(HDRS) utf8.c
919 xclient.o:      $(HDRS) xclient.c
920
921 # The module containing tables of available lookups, routers, auths, and
922 # transports must be rebuilt if any of them are. However, because the makefiles
923 # for the drivers are always run, we don't actually put the dependencies here,
924 # because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
925 # drtables.o even though the .a files haven't in fact been updated. Instead
926 # it is arranged that the lower-level makefiles remove drtables.o when they
927 # rebuild the .a files.
928
929 drtables.o:      $(HDRS) drtables.c
930
931 # We depend upon object files built as part of building the lookups library
932 # When using parallel make, we don't have the dependency to force building
933 # in the sub-directory unless we force that dependency:
934
935 $(OBJ_LOOKUPS):  buildlookups
936
937 # The exim monitor's private modules - the sources live in a private
938 # subdirectory. The final binary combines the private modules with some
939 # modules from the main exim binary.
940
941 em_StripChart.o: ../exim_monitor/em_StripChart.c
942 em_TextPop.o:    ../exim_monitor/em_TextPop.c
943 em_globals.o:    ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
944 em_init.o:       ../exim_monitor/em_init.c    ../exim_monitor/em_hdr.h
945 em_log.o:        ../exim_monitor/em_log.c     ../exim_monitor/em_hdr.h
946 em_main.o:       ../exim_monitor/em_main.c    ../exim_monitor/em_hdr.h
947 em_menu.o:       ../exim_monitor/em_menu.c    ../exim_monitor/em_hdr.h
948 em_queue.o:      ../exim_monitor/em_queue.c   ../exim_monitor/em_hdr.h
949 em_strip.o:      ../exim_monitor/em_strip.c   ../exim_monitor/em_hdr.h
950 em_text.o:       ../exim_monitor/em_text.c    ../exim_monitor/em_hdr.h
951 em_xs.o:         ../exim_monitor/em_xs.c      ../exim_monitor/em_hdr.h
952 em_version.o:    ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
953 $(MONBIN): $(HDRS)
954                  @echo "$(CC) exim_monitor/$(@:.o=.c)"
955                  $(FE)$(CC) -o $@ -c $(CFLAGS) -DCOMPILE_UTILITY -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
956                    ../exim_monitor/$(@:.o=.c)
957
958
959 # Targets for the various libraries that Exim uses.
960
961 # The lookups library.
962
963 buildlookups: config
964          @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
965            CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
966            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
967            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
968          @echo " "
969
970 # The routers library.
971
972 buildrouters: config
973          @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
974            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
975            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
976          @echo " "
977
978 # The transports library.
979
980 buildtransports: config
981          @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
982            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
983            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
984          @echo " "
985
986 # The library of authorization modules
987
988 buildauths: config
989          @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
990            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
991            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
992          @echo " "
993
994 # The PDKIM library
995
996 buildpdkim: pdkim/pdkim.a
997 pdkim/pdkim.a: config
998          @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
999            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
1000            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
1001          @echo " "
1002
1003 # The "clean", "install", and "makefile" targets just pass themselves back to
1004 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
1005 # for them in the build directory.
1006
1007 clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
1008
1009 # Targets for building stand-alone testing programs for basic testing of
1010 # some of the building blocks. These are not integrated with the makefile-
1011 # building targets. If you change something that is going to cause the
1012 # makefile to be rebuilt, you must run "make makefile" before running one
1013 # of these.
1014
1015 # The testing programs use different versions of some modules - usually
1016 # with bits cut out that are not relevant to the test in hand. For those
1017 # that are used by several tests, we use a different name.
1018
1019 sa-globals.o:    $(HDRS) globals.c
1020         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
1021
1022 sa-os.o:         $(HDRS) os.c
1023         $(CC) -c $(CFLAGS) $(INCLUDE) \
1024                                       -DFIND_RUNNING_INTERFACES \
1025                                       -o sa-os.o os.c
1026
1027 # These are the test targets themselves
1028
1029 test_dbfn:   config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
1030                string.o tod.o version.o utf8.o
1031         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
1032         $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
1033         $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
1034           dummies.o sa-globals.o sa-os.o store.o string.o \
1035           tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
1036         rm -f dbfn.o store.o
1037
1038 test_host:   config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
1039                host_address.o store.o string.o tod.o tree.o
1040         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c
1041         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
1042         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
1043         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
1044         $(LNCC) -o test_host $(LFLAGS) \
1045           host.o host_address.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
1046           tod.o tree.o $(LIBS) $(LIBRESOLV)
1047         rm -f child.o dummies.o host.o dns.o
1048
1049 test_os:     os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
1050         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
1051         $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
1052           sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1053         rm -f os.o
1054
1055 test_parse:  config.h parse.c dummies.o sa-globals.o \
1056              store.o string.o tod.o version.o utf8.o
1057         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
1058         $(LNCC) -o test_parse $(LFLAGS) parse.o \
1059           dummies.o sa-globals.o store.o string.o tod.o version.o \
1060           utf8.o $(LDFLAGS)
1061         rm -f parse.o
1062
1063 test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
1064         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
1065         $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
1066           dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1067         rm -f string.o
1068
1069 # End