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