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