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