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