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