71aee4d93592c53d5ab8cedd1d153db2bd751b3c
[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                         xclient.o
502
503 # Targets for final binaries; the main one has a build number which is
504 # updated each time. We don't bother with that for the auxiliaries.
505
506 OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
507
508 OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
509         directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
510         filtertest.o globals.o dkim.o dkim_transport.o dnsbl.o hash.o \
511         header.o host.o host_address.o ip.o log.o lss.o match.o md5.o moan.o \
512         os.o parse.o priv.o proxy.o queue.o \
513         rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o regex_cache.o \
514         route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
515         std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
516         environment.o macro.o \
517         $(OBJ_LOOKUPS) \
518         local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
519         $(OBJ_EXPERIMENTAL)
520
521 exim:   buildlookups buildauths pdkim/pdkim.a \
522         buildrouters buildtransports \
523         $(OBJ_EXIM) version.o
524         @echo "$(LNCC) -o exim"
525         $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
526           routers/routers.a transports/transports.a lookups/lookups.a \
527           auths/auths.a pdkim/pdkim.a \
528           $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
529           $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
530           $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
531         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
532           echo $(STRIP_COMMAND) exim; \
533           $(STRIP_COMMAND) exim; \
534         fi
535         $(EXIM_CHMOD)
536         @echo " "
537         @echo ">>> exim binary built"
538         @echo " "
539
540 # The utility for dumping the contents of an exim database
541
542 OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
543
544 exim_dumpdb: $(OBJ_DUMPDB)
545         @echo "$(LNCC) -o exim_dumpdb"
546         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
547           $(LIBS) $(EXTRALIBS) $(DBMLIB)
548         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
549           echo $(STRIP_COMMAND) exim_dumpdb; \
550           $(STRIP_COMMAND) exim_dumpdb; \
551         fi
552         @echo ">>> exim_dumpdb utility built"
553         @echo " "
554
555 # The utility for interrogating/fixing the contents of an exim database
556
557 OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o util-md5.o
558
559 exim_fixdb:  $(OBJ_FIXDB)
560         @echo "$(LNCC) -o exim_fixdb"
561         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
562           $(LIBS) $(EXTRALIBS) $(DBMLIB)
563         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
564           echo $(STRIP_COMMAND) exim_fixdb; \
565           $(STRIP_COMMAND) exim_fixdb; \
566         fi
567         @echo ">>> exim_fixdb utility built"
568         @echo " "
569
570 # The utility for tidying the contents of an exim database
571
572 OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
573
574 exim_tidydb: $(OBJ_TIDYDB)
575         @echo "$(LNCC) -o exim_tidydb"
576         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
577           $(LIBS) $(EXTRALIBS) $(DBMLIB)
578         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
579           echo $(STRIP_COMMAND) exim_tidydb; \
580           $(STRIP_COMMAND) exim_tidydb; \
581         fi
582         @echo ">>> exim_tidydb utility built"
583         @echo " "
584
585 # The utility for building dbm files
586
587 exim_dbmbuild: exim_dbmbuild.o
588         @echo "$(LNCC) -o exim_dbmbuild"
589         $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
590           $(LIBS) $(EXTRALIBS) $(DBMLIB)
591         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
592           echo $(STRIP_COMMAND) exim_dbmbuild; \
593           $(STRIP_COMMAND) exim_dbmbuild; \
594         fi
595         @echo ">>> exim_dbmbuild utility built"
596         @echo " "
597
598 # The utility for locking a mailbox while messing around with it
599
600 exim_lock: exim_lock.c os.h
601         @echo "$(CC) exim_lock.c"
602         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
603         @echo "$(LNCC) -o exim_lock"
604         $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o  \
605           $(LIBS) $(EXTRALIBS)
606         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
607           echo $(STRIP_COMMAND) exim_lock; \
608           $(STRIP_COMMAND) exim_lock; \
609         fi
610         @echo ">>> exim_lock utility built"
611         @echo " "
612
613 # The X-based Exim monitor program's binary part. There's a macro for cutting
614 # out the modified TextPop module, because some antique link editors cannot
615 # handle the fact that it is redefining things that are found later in the
616 # Xaw library.
617
618 # Object modules that are the unique Eximon modules
619
620 MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
621         em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
622         em_text.o em_xs.o
623
624 # The complete modules list also includes some specially compiled versions of
625 # code from the main Exim source tree.
626
627 OBJ_MONBIN = util-host_address.o \
628              util-queue.o \
629              util-spool_in.o \
630              util-store.o \
631              util-string.o \
632              util-tod.o \
633              util-tree.o \
634              $(MONBIN)
635
636 eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) ../exim_monitor/em_version.c \
637                 mytypes.h store.h macros.h
638         @echo "$(CC) exim_monitor/em_version.c"
639         $(FE)$(CC) -o em_version.o -c \
640           $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
641         @echo "$(LNCC) -o eximon.bin"
642         $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
643           $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
644           $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
645         @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
646           echo $(STRIP_COMMAND) eximon.bin; \
647           $(STRIP_COMMAND) eximon.bin; \
648         fi
649         @echo ">>> exim monitor binary built"
650         @echo " "
651
652
653 # Compile step for most of the exim modules. HDRS is a list of headers
654 # which cause everything to be rebuilt. PHDRS is the same, for the use
655 # of routers, transports, and authenticators. I can't find a way of doing this
656 # in one. This list is overkill, but it doesn't really take much time to
657 # rebuild Exim on a modern computer.
658
659 HDRS  = blob.h \
660         config.h \
661         dbfunctions.h \
662         exim.h \
663         functions.h \
664         globals.h \
665         hash.h \
666         hintsdb.h \
667         hintsdb_structs.h \
668         local_scan.h \
669         macros.h \
670         mytypes.h \
671         sha_ver.h \
672         structs.h \
673         os.h
674 PHDRS = ../config.h \
675         ../dbfunctions.h \
676         ../exim.h \
677         ../functions.h \
678         ../globals.h \
679         ../hintsdb.h \
680         ../hintsdb_structs.h \
681         ../local_scan.h \
682         ../macros.h \
683         ../mytypes.h \
684         ../structs.h \
685         ../os.h
686
687 .SUFFIXES: .o .c
688 .c.o:;  @echo "$(CC) $*.c"
689         $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
690
691 # Update Exim's version information and build the version object.  The dependency
692 # chain here avoids problems under parallel-make.
693
694 version.sh:
695         @../scripts/reversion
696
697 version.h: version.sh
698
699 cnumber.h: version.h
700
701 version.o: $(HDRS) cnumber.h version.h version.c
702
703 # This is the dummy module for use by test compiles of individual modules. It
704 # contains functions such as log_write() that may be called from bits of Exim
705 # in the tested code.
706
707 dummies.o:       dummies.c
708
709 # Compile instructions for perl.o for when EXIM_PERL is set
710
711 perl.o:          $(HDRS) perl.c
712         @echo "$(PERL_CC) perl.c"
713         $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
714
715 # Compile instructions for the database utility modules
716
717 exim_dumpdb.o:   $(HDRS) exim_dbutil.c
718         @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
719         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
720                                       -DCOMPILE_UTILITY \
721                                       -DEXIM_DUMPDB \
722                                       -o exim_dumpdb.o exim_dbutil.c
723
724 exim_fixdb.o:    $(HDRS) exim_dbutil.c
725         @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
726         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
727                                       -DCOMPILE_UTILITY \
728                                       -DEXIM_FIXDB \
729                                       -o exim_fixdb.o exim_dbutil.c
730
731 exim_tidydb.o:   $(HDRS) exim_dbutil.c
732         @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
733         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
734                                       -DCOMPILE_UTILITY \
735                                       -DEXIM_TIDYDB \
736                                       -o exim_tidydb.o exim_dbutil.c
737
738 # Compile instructions for exim_dbmbuild
739
740 exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
741         @echo "$(CC) exim_dbmbuild.c"
742         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \
743                 -o exim_dbmbuild.o exim_dbmbuild.c
744
745 # Utilities use special versions of some modules - typically with debugging
746 # calls cut out.
747
748 util-host_address.o:   $(HDRS) host_address.c
749         @echo "$(CC) -DCOMPILE_UTILITY host_address.c"
750         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-host_address.o host_address.c
751
752 util-md5.o:   $(HDRS) md5.c
753         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
754         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-md5.o md5.c
755
756 util-spool_in.o: $(HDRS) spool_in.c
757         @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
758         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
759
760 util-store.o:    $(HDRS) store.c
761         @echo "$(CC) -DCOMPILE_UTILITY store.c"
762         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
763
764 util-string.o:   $(HDRS) string.c
765         @echo "$(CC) -DCOMPILE_UTILITY string.c"
766         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
767
768 util-queue.o:   $(HDRS) queue.c
769         @echo "$(CC) -DCOMPILE_UTILITY queue.c"
770         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c
771
772 util-tod.o:   $(HDRS) tod.c
773         @echo "$(CC) -DCOMPILE_UTILITY tod.c"
774         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c
775
776 util-tree.o:   $(HDRS) tree.c
777         @echo "$(CC) -DCOMPILE_UTILITY tree.c"
778         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tree.o tree.c
779
780 util-os.o:       $(HDRS) os.c
781         @echo "$(CC) -DCOMPILE_UTILITY os.c"
782         $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
783                                       -DCOMPILE_UTILITY \
784                                       -DOS_LOAD_AVERAGE \
785                                       -DFIND_RUNNING_INTERFACES \
786                                       -o util-os.o os.c
787
788 # The local scan module depends only on its own special header, and is compiled
789 # from a source whose location is set by configuration.
790
791 local_scan.o:    config local_scan.h ../$(LOCAL_SCAN_SOURCE)
792         @echo "$(CC) local_scan.c"
793         $(FE)$(CC) -DLOCAL_SCAN -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
794
795 # Dependencies for the "ordinary" exim modules
796
797 acl.o:           $(HDRS) acl.c
798 base64.o:        $(HDRS) mime.h base64.c
799 child.o:         $(HDRS) child.c
800 crypt16.o:       $(HDRS) crypt16.c
801 daemon.o:        $(HDRS) daemon.c
802 dbfn.o:          $(HDRS) dbfn.c
803 debug.o:         $(HDRS) debug.c
804 deliver.o:       $(HDRS) transports/smtp.h deliver.c
805 directory.o:     $(HDRS) directory.c
806 dns.o:           $(HDRS) dns.c
807 dnsbl.o:         $(HDRS) dnsbl.c
808 enq.o:           $(HDRS) enq.c
809 exim.o:          $(HDRS) exim.c
810 expand.o:        $(HDRS) expand.c
811 environment.o:   $(HDRS) environment.c
812 filter.o:        $(HDRS) filter.c
813 filtertest.o:    $(HDRS) filtertest.c
814 globals.o:       $(HDRS) globals.c
815 hash.o:          $(HDRS) hash.c
816 header.o:        $(HDRS) header.c
817 host.o:          $(HDRS) host.c
818 host_address.o:  $(HDRS) host_address.c
819 ip.o:            $(HDRS) ip.c
820 log.o:           $(HDRS) log.c
821 lss.o:           $(HDRS) lss.c
822 match.o:         $(HDRS) match.c
823 md5.o:           $(HDRS) md5.c
824 moan.o:          $(HDRS) moan.c
825 os.o:            $(HDRS) $(OS_C_INCLUDES) os.c
826 parse.o:         $(HDRS) parse.c
827 priv.o:          $(HDRS) priv.c
828 proxy.o:         $(HDRS) proxy.c
829 queue.o:         $(HDRS) queue.c
830 rda.o:           $(HDRS) rda.c
831 readconf.o:      $(HDRS) readconf.c
832 receive.o:       $(HDRS) receive.c
833 retry.o:         $(HDRS) retry.c
834 rewrite.o:       $(HDRS) rewrite.c
835 regex_cache.o:   $(HDRS) regex_cache.c
836 rfc2047.o:       $(HDRS) rfc2047.c
837 route.o:         $(HDRS) route.c
838 search.o:        $(HDRS) search.c
839 sieve.o:         $(HDRS) sieve.c
840 smtp_in.o:       $(HDRS) smtp_in.c
841 smtp_out.o:      $(HDRS) smtp_out.c
842 spool_in.o:      $(HDRS) spool_in.c
843 spool_out.o:     $(HDRS) spool_out.c
844 std-crypto.o:    $(HDRS) std-crypto.c
845 store.o:         $(HDRS) store.c
846 string.o:        $(HDRS) string.c
847 tls.o:           $(HDRS) tls.c \
848                  tls-gnu.c tlscert-gnu.c \
849                  tls-openssl.c tlscert-openssl.c \
850                  tls-cipher-stdname.c
851 tod.o:           $(HDRS) tod.c
852 transport.o:     $(HDRS) transport.c
853 tree.o:          $(HDRS) tree.c
854 verify.o:        $(HDRS) transports/smtp.h verify.c
855 dkim.o:          $(HDRS) pdkim/pdkim.h dkim.c
856 dkim_transport.o: $(HDRS) dkim_transport.c
857
858 # Dependencies for WITH_CONTENT_SCAN modules
859
860 malware.o:       $(HDRS) malware.c
861 mime.o:          $(HDRS) mime.h mime.c
862 regex.o:         $(HDRS) regex.c
863 spam.o:          $(HDRS) spam.c
864 spool_mbox.o:    $(HDRS) spool_mbox.c
865
866
867 # Dependencies for EXPERIMENTAL_* modules
868
869 arc.o:          $(HDRS) pdkim/pdkim.h arc.c
870 bmi_spam.o:     $(HDRS) bmi_spam.c
871 dane.o:         $(HDRS) dane.c dane-openssl.c
872 dcc.o:          $(HDRS) dcc.h dcc.c
873 dmarc.o:        $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c
874 imap_utf7.o:    $(HDRS) imap_utf7.c
875 spf.o:          $(HDRS) spf.h spf.c
876 utf8.o:         $(HDRS) utf8.c
877 xclient.o:      $(HDRS) xclient.c
878
879 # The module containing tables of available lookups, routers, auths, and
880 # transports must be rebuilt if any of them are. However, because the makefiles
881 # for the drivers are always run, we don't actually put the dependencies here,
882 # because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
883 # drtables.o even though the .a files haven't in fact been updated. Instead
884 # it is arranged that the lower-level makefiles remove drtables.o when they
885 # rebuild the .a files.
886
887 drtables.o:      $(HDRS) drtables.c
888
889 # We depend upon object files built as part of building the lookups library
890 # When using parallel make, we don't have the dependency to force building
891 # in the sub-directory unless we force that dependency:
892
893 $(OBJ_LOOKUPS):  buildlookups
894
895 # The exim monitor's private modules - the sources live in a private
896 # subdirectory. The final binary combines the private modules with some
897 # modules from the main exim binary.
898
899 em_StripChart.o: ../exim_monitor/em_StripChart.c
900 em_TextPop.o:    ../exim_monitor/em_TextPop.c
901 em_globals.o:    ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
902 em_init.o:       ../exim_monitor/em_init.c    ../exim_monitor/em_hdr.h
903 em_log.o:        ../exim_monitor/em_log.c     ../exim_monitor/em_hdr.h
904 em_main.o:       ../exim_monitor/em_main.c    ../exim_monitor/em_hdr.h
905 em_menu.o:       ../exim_monitor/em_menu.c    ../exim_monitor/em_hdr.h
906 em_queue.o:      ../exim_monitor/em_queue.c   ../exim_monitor/em_hdr.h
907 em_strip.o:      ../exim_monitor/em_strip.c   ../exim_monitor/em_hdr.h
908 em_text.o:       ../exim_monitor/em_text.c    ../exim_monitor/em_hdr.h
909 em_xs.o:         ../exim_monitor/em_xs.c      ../exim_monitor/em_hdr.h
910 em_version.o:    ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
911 $(MONBIN): $(HDRS)
912                  @echo "$(CC) exim_monitor/$(@:.o=.c)"
913                  $(FE)$(CC) -o $@ -c $(CFLAGS) -DCOMPILE_UTILITY -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
914                    ../exim_monitor/$(@:.o=.c)
915
916
917 # Targets for the various libraries that Exim uses.
918
919 # The lookups library.
920
921 buildlookups: config
922          @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
923            CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
924            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
925            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
926          @echo " "
927
928 # The routers library.
929
930 buildrouters: config
931          @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
932            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
933            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
934          @echo " "
935
936 # The transports library.
937
938 buildtransports: config
939          @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
940            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
941            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
942          @echo " "
943
944 # The library of authorization modules
945
946 buildauths: config
947          @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
948            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
949            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
950          @echo " "
951
952 # The PDKIM library
953
954 buildpdkim: pdkim/pdkim.a
955 pdkim/pdkim.a: config
956          @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
957            FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
958            INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
959          @echo " "
960
961 # The "clean", "install", and "makefile" targets just pass themselves back to
962 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
963 # for them in the build directory.
964
965 clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
966
967 # Targets for building stand-alone testing programs for basic testing of
968 # some of the building blocks. These are not integrated with the makefile-
969 # building targets. If you change something that is going to cause the
970 # makefile to be rebuilt, you must run "make makefile" before running one
971 # of these.
972
973 # The testing programs use different versions of some modules - usually
974 # with bits cut out that are not relevant to the test in hand. For those
975 # that are used by several tests, we use a different name.
976
977 sa-globals.o:    $(HDRS) globals.c
978         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
979
980 sa-os.o:         $(HDRS) os.c
981         $(CC) -c $(CFLAGS) $(INCLUDE) \
982                                       -DFIND_RUNNING_INTERFACES \
983                                       -o sa-os.o os.c
984
985 # These are the test targets themselves
986
987 test_dbfn:   config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
988                string.o tod.o version.o utf8.o
989         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
990         $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
991         $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
992           dummies.o sa-globals.o sa-os.o store.o string.o \
993           tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
994         rm -f dbfn.o store.o
995
996 test_host:   config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
997                host_address.o store.o string.o tod.o tree.o
998         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c
999         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
1000         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
1001         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
1002         $(LNCC) -o test_host $(LFLAGS) \
1003           host.o host_address.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
1004           tod.o tree.o $(LIBS) $(LIBRESOLV)
1005         rm -f child.o dummies.o host.o dns.o
1006
1007 test_os:     os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
1008         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
1009         $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
1010           sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1011         rm -f os.o
1012
1013 test_parse:  config.h parse.c dummies.o sa-globals.o \
1014              store.o string.o tod.o version.o utf8.o
1015         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
1016         $(LNCC) -o test_parse $(LFLAGS) parse.o \
1017           dummies.o sa-globals.o store.o string.o tod.o version.o \
1018           utf8.o $(LDFLAGS)
1019         rm -f parse.o
1020
1021 test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
1022         $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
1023         $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
1024           dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)
1025         rm -f string.o
1026
1027 # End