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