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