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