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