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