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