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