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
8 # Copyright (c) The Exim Maintainers 2016
13 EDITME = ../Local/Makefile
14 EXIMON_EDITME = ../Local/eximon.conf
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.
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.
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.
39 config: $(EDITME) checklocalmake Makefile os.c config.h version.h macro.c
42 @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
43 $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(ARCHTYPE) $(EDITME) || \
44 $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EDITME); \
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); \
52 if [ -f $(EXIMON_EDITME) ]; then touch $(EXIMON_EDITME); fi \
57 @echo "*** Please create Local/Makefile by copying src/EDITME and making"
58 @echo "*** appropriate changes for your site."
64 @echo "*** Please create Local/eximon.conf by copying exim_monitor/EDITME and making"
65 @echo "*** appropriate changes for your site."
67 @test ! -d ../Local && mkdir ../Local
70 # Check that the local Makefile is up-to-date
72 Makefile: ../OS/Makefile-Base ../OS/Makefile-Default \
73 $(SCRIPTS)/Configure $(SCRIPTS)/Configure-Makefile $(EDITME)
75 @echo "*** Makefile needs rebuilding"
76 @echo "*** Please run \"make makefile\" at top level"
80 # Build (link) the os.h file
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
98 os.h: $(SCRIPTS)/Configure-os.h \
103 $(SHELL) $(SCRIPTS)/Configure-os.h
105 # Build the os.c file
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
115 $(SCRIPTS)/Configure-os.c \
117 $(SHELL) $(SCRIPTS)/Configure-os.c
119 # Build the config.h file.
121 config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME)
122 $(SHELL) $(SCRIPTS)/Configure-config.h "$(MAKE)"
124 # Build the builtin-macros data struct
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 \
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\
139 $(OBJ_MACRO): $(MACRO_HSRC)
141 macro_predef.o : macro_predef.c
142 @echo "$(CC) -DMACRO_PREDEF $<"
143 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
144 macro-globals.o : globals.c
145 @echo "$(CC) -DMACRO_PREDEF $<"
146 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
147 macro-readconf.o : readconf.c
148 @echo "$(CC) -DMACRO_PREDEF $<"
149 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
150 macro-route.o : route.c
151 @echo "$(CC) -DMACRO_PREDEF $<"
152 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
153 macro-transport.o: transport.c
154 @echo "$(CC) -DMACRO_PREDEF $<"
155 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
156 macro-drtables.o : drtables.c
157 @echo "$(CC) -DMACRO_PREDEF $<"
158 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
159 macro-appendfile.o : transports/appendfile.c
160 @echo "$(CC) -DMACRO_PREDEF $<"
161 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
162 macro-autoreply.o : transports/autoreply.c
163 @echo "$(CC) -DMACRO_PREDEF $<"
164 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
165 macro-lmtp.o: transports/lmtp.c
166 @echo "$(CC) -DMACRO_PREDEF $<"
167 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
168 macro-pipe.o : transports/pipe.c
169 @echo "$(CC) -DMACRO_PREDEF $<"
170 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
171 macro-queuefile.o : transports/queuefile.c
172 @echo "$(CC) -DMACRO_PREDEF $<"
173 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
174 macro-smtp.o : transports/smtp.c
175 @echo "$(CC) -DMACRO_PREDEF $<"
176 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
177 macro-accept.o : routers/accept.c
178 @echo "$(CC) -DMACRO_PREDEF $<"
179 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
180 macro-dnslookup.o : routers/dnslookup.c
181 @echo "$(CC) -DMACRO_PREDEF $<"
182 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
183 macro-ipliteral.o : routers/ipliteral.c
184 @echo "$(CC) -DMACRO_PREDEF $<"
185 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
186 macro-iplookup.o : routers/iplookup.c
187 @echo "$(CC) -DMACRO_PREDEF $<"
188 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
189 macro-manualroute.o : routers/manualroute.c
190 @echo "$(CC) -DMACRO_PREDEF $<"
191 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
192 macro-queryprogram.o : routers/queryprogram.c
193 @echo "$(CC) -DMACRO_PREDEF $<"
194 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
195 macro-redirect.o : routers/redirect.c
196 @echo "$(CC) -DMACRO_PREDEF $<"
197 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
198 macro-auth-spa.o : auths/auth-spa.c
199 @echo "$(CC) -DMACRO_PREDEF $<"
200 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
201 macro-cram_md5.o : auths/cram_md5.c
202 @echo "$(CC) -DMACRO_PREDEF $<"
203 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
204 macro-cyrus_sasl.o : auths/cyrus_sasl.c
205 @echo "$(CC) -DMACRO_PREDEF $<"
206 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
207 macro-dovecot.o: auths/dovecot.c
208 @echo "$(CC) -DMACRO_PREDEF $<"
209 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
210 macro-gsasl_exim.o : auths/gsasl_exim.c
211 @echo "$(CC) -DMACRO_PREDEF $<"
212 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
213 macro-heimdal_gssapi.o: auths/heimdal_gssapi.c
214 @echo "$(CC) -DMACRO_PREDEF $<"
215 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
216 macro-plaintext.o : auths/plaintext.c
217 @echo "$(CC) -DMACRO_PREDEF $<"
218 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
219 macro-spa.o : auths/spa.c
220 @echo "$(CC) -DMACRO_PREDEF $<"
221 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
222 macro-tls.o: auths/tls.c
223 @echo "$(CC) -DMACRO_PREDEF $<"
224 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
226 macro_predef: $(OBJ_MACRO)
227 @echo "$(LNCC) -o $<"
228 $(FE)$(LNCC) -o $@ $(LFLAGS) $(OBJ_MACRO)
230 macro.c: macro_predef
231 ./macro_predef > macro.c
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.
238 .PHONY: all config utils \
239 buildauths buildlookups buildpdkim buildrouters \
240 buildtransports checklocalmake clean
243 utils: $(EXIM_MONITOR) exicyclog exinext exiwhat \
244 exigrep eximstats exipick exiqgrep exiqsumm \
245 transport-filter.pl convert4r3 convert4r4 \
247 exim_dbmbuild exim_dumpdb exim_fixdb exim_tidydb exim_lock
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)
256 # Target for the exicyclog utility script
257 exicyclog: config ../src/exicyclog.src
260 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
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 ../src/exicyclog.src > exicyclog-t
277 @mv exicyclog-t exicyclog
279 @echo ">>> exicyclog script built"
281 # Target for the exinext utility script
282 exinext: config ../src/exinext.src
285 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
288 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
289 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
290 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
291 ../src/exinext.src > exinext-t
292 @mv exinext-t exinext
294 @echo ">>> exinext script built"
296 # Target for the exiwhat utility script
297 exiwhat: config ../src/exiwhat.src
300 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
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?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
307 -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
308 -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \
309 -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
310 -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
311 -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
312 ../src/exiwhat.src > exiwhat-t
313 @mv exiwhat-t exiwhat
315 @echo ">>> exiwhat script built"
317 # Target for the exim_checkaccess utility script
318 exim_checkaccess: config ../src/exim_checkaccess.src
319 @rm -f exim_checkaccess
321 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
324 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
325 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
326 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
327 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
328 ../src/exim_checkaccess.src > exim_checkaccess-t
329 @mv exim_checkaccess-t exim_checkaccess
330 @chmod a+x exim_checkaccess
331 @echo ">>> exim_checkaccess script built"; echo ""
333 # Target for the Exim monitor start-up script
334 eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
337 $(SHELL) $(SCRIPTS)/Configure-eximon
339 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
342 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
343 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
344 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
345 -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
346 -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
347 -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
348 ../src/eximon.src >> eximon
349 @echo ">>> eximon script built"; echo ""
351 # Targets for utilities; these are all Perl scripts that have to get the
352 # location of Perl put in them. A few need other things as well.
354 exigrep: Makefile ../src/exigrep.src
357 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
360 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
361 -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
362 -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
363 ../src/exigrep.src > exigrep-t
364 @mv exigrep-t exigrep
366 @echo ">>> exigrep script built"
368 eximstats: Makefile ../src/eximstats.src
371 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
372 ../src/eximstats.src > eximstats-t
373 @mv eximstats-t eximstats
375 @echo ">>> eximstats script built"
377 exiqgrep: Makefile ../src/exiqgrep.src
380 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
383 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
384 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
385 ../src/exiqgrep.src > exiqgrep-t
386 @mv exiqgrep-t exiqgrep
388 @echo ">>> exiqgrep script built"
390 exiqsumm: Makefile ../src/exiqsumm.src
392 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
393 ../src/exiqsumm.src > exiqsumm-t
394 @mv exiqsumm-t exiqsumm
396 @echo ">>> exiqsumm script built"
398 exipick: Makefile ../src/exipick.src
400 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
401 -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
402 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
403 ../src/exipick.src > exipick-t
404 @mv exipick-t exipick
406 @echo ">>> exipick script built"
408 transport-filter.pl: Makefile ../src/transport-filter.src
409 @rm -f transport-filter.pl
410 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
411 ../src/transport-filter.src > transport-filter.pl-t
412 @mv transport-filter.pl-t transport-filter.pl
413 @chmod a+x transport-filter.pl
414 @echo ">>> transport-filter.pl script built"
416 convert4r3: Makefile ../src/convert4r3.src
418 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
419 ../src/convert4r3.src > convert4r3-t
420 @mv convert4r3-t convert4r3
421 @chmod a+x convert4r3
422 @echo ">>> convert4r3 script built"
424 convert4r4: Makefile ../src/convert4r4.src
426 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
427 ../src/convert4r4.src > convert4r4-t
428 @mv convert4r4-t convert4r4
429 @chmod a+x convert4r4
430 @echo ">>> convert4r4 script built"
433 # These are objects of optional features. They are always compiled, but
434 # if the corresponding #defines are not set, they wind up empty and
435 # are thrown away by the linker.
437 OBJ_WITH_CONTENT_SCAN = malware.o mime.o regex.o spam.o spool_mbox.o
438 OBJ_EXPERIMENTAL = bmi_spam.o \
447 # Targets for final binaries; the main one has a build number which is
448 # updated each time. We don't bother with that for the auxiliaries.
450 OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
452 OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
453 directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
454 filtertest.o globals.o dkim.o dkim_transport.o hash.o \
455 header.o host.o ip.o log.o lss.o match.o moan.o \
456 os.o parse.o queue.o \
457 rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
458 route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
459 std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
460 environment.o macro.o \
462 local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
465 exim: buildlookups buildauths pdkim/pdkim.a \
466 buildrouters buildtransports \
467 $(OBJ_EXIM) version.o
468 @echo "$(LNCC) -o exim"
469 $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
470 routers/routers.a transports/transports.a lookups/lookups.a \
471 auths/auths.a pdkim/pdkim.a \
472 $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
473 $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
474 $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
475 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
476 echo $(STRIP_COMMAND) exim; \
477 $(STRIP_COMMAND) exim; \
481 @echo ">>> exim binary built"
484 # The utility for dumping the contents of an exim database
486 OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
488 exim_dumpdb: $(OBJ_DUMPDB)
489 @echo "$(LNCC) -o exim_dumpdb"
490 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
491 $(LIBS) $(EXTRALIBS) $(DBMLIB)
492 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
493 echo $(STRIP_COMMAND) exim_dumpdb; \
494 $(STRIP_COMMAND) exim_dumpdb; \
496 @echo ">>> exim_dumpdb utility built"
499 # The utility for interrogating/fixing the contents of an exim database
501 OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o
503 exim_fixdb: $(OBJ_FIXDB) buildauths
504 @echo "$(LNCC) -o exim_fixdb"
505 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
506 auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB)
507 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
508 echo $(STRIP_COMMAND) exim_fixdb; \
509 $(STRIP_COMMAND) exim_fixdb; \
511 @echo ">>> exim_fixdb utility built"
514 # The utility for tidying the contents of an exim database
516 OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
518 exim_tidydb: $(OBJ_TIDYDB)
519 @echo "$(LNCC) -o exim_tidydb"
520 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
521 $(LIBS) $(EXTRALIBS) $(DBMLIB)
522 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
523 echo $(STRIP_COMMAND) exim_tidydb; \
524 $(STRIP_COMMAND) exim_tidydb; \
526 @echo ">>> exim_tidydb utility built"
529 # The utility for building dbm files
531 exim_dbmbuild: exim_dbmbuild.o
532 @echo "$(LNCC) -o exim_dbmbuild"
533 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
534 $(LIBS) $(EXTRALIBS) $(DBMLIB)
535 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
536 echo $(STRIP_COMMAND) exim_dbmbuild; \
537 $(STRIP_COMMAND) exim_dbmbuild; \
539 @echo ">>> exim_dbmbuild utility built"
542 # The utility for locking a mailbox while messing around with it
544 exim_lock: exim_lock.c os.h
545 @echo "$(CC) exim_lock.c"
546 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
547 @echo "$(LNCC) -o exim_lock"
548 $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
550 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
551 echo $(STRIP_COMMAND) exim_lock; \
552 $(STRIP_COMMAND) exim_lock; \
554 @echo ">>> exim_lock utility built"
557 # The X-based Exim monitor program's binary part. There's a macro for cutting
558 # out the modified TextPop module, because some antique link editors cannot
559 # handle the fact that it is redefining things that are found later in the
562 # Object modules that are the unique Eximon modules
564 MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
565 em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
568 # The complete modules list also includes some specially compiled versions of
569 # code from the main Exim source tree.
571 OBJ_MONBIN = util-spool_in.o \
579 eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) \
580 ../exim_monitor/em_version.c
581 @echo "$(CC) exim_monitor/em_version.c"
582 $(FE)$(CC) -o em_version.o -c \
583 $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
584 @echo "$(LNCC) -o eximon.bin"
585 $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
586 $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
587 $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
588 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
589 echo $(STRIP_COMMAND) eximon.bin; \
590 $(STRIP_COMMAND) eximon.bin; \
592 @echo ">>> exim monitor binary built"
596 # Compile step for most of the exim modules. HDRS is a list of headers
597 # which cause everything to be rebuilt. PHDRS is the same, for the use
598 # of routers, transports, and authenticators. I can't find a way of doing this
599 # in one. This list is overkill, but it doesn't really take much time to
600 # rebuild Exim on a modern computer.
616 PHDRS = ../config.h \
629 .c.o:; @echo "$(CC) $*.c"
630 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
632 # Update Exim's version information and build the version object.
635 @../scripts/reversion
639 version.o: $(HDRS) cnumber.h version.h version.c
641 # This is the dummy module for use by test compiles of individual modules. It
642 # contains functions such as log_write() that may be called from bits of Exim
643 # in the tested code.
647 # Compile instructions for perl.o for when EXIM_PERL is set
649 perl.o: $(HDRS) perl.c
650 @echo "$(PERL_CC) perl.c"
651 $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
653 # Compile instructions for the database utility modules
655 exim_dumpdb.o: $(HDRS) exim_dbutil.c
656 @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
657 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
660 -o exim_dumpdb.o exim_dbutil.c
662 exim_fixdb.o: $(HDRS) exim_dbutil.c
663 @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
664 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
667 -o exim_fixdb.o exim_dbutil.c
669 exim_tidydb.o: $(HDRS) exim_dbutil.c
670 @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
671 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
674 -o exim_tidydb.o exim_dbutil.c
676 # Compile instructions for exim_dbmbuild
678 exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
679 @echo "$(CC) exim_dbmbuild.c"
680 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \
681 -o exim_dbmbuild.o exim_dbmbuild.c
683 # Utilities use special versions of some modules - typically with debugging
686 util-spool_in.o: $(HDRS) spool_in.c
687 @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
688 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
690 util-store.o: $(HDRS) store.c
691 @echo "$(CC) -DCOMPILE_UTILITY store.c"
692 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
694 util-string.o: $(HDRS) string.c
695 @echo "$(CC) -DCOMPILE_UTILITY string.c"
696 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
698 util-queue.o: $(HDRS) queue.c
699 @echo "$(CC) -DCOMPILE_UTILITY queue.c"
700 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c
702 util-tod.o: $(HDRS) tod.c
703 @echo "$(CC) -DCOMPILE_UTILITY tod.c"
704 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c
706 util-os.o: $(HDRS) os.c
707 @echo "$(CC) -DCOMPILE_UTILITY os.c"
708 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
711 -DFIND_RUNNING_INTERFACES \
714 # The local scan module depends only on its own special header, and is compiled
715 # from a source whose location is set by configuration.
717 local_scan.o: config local_scan.h ../$(LOCAL_SCAN_SOURCE)
718 @echo "$(CC) local_scan.c"
719 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
721 # Dependencies for the "ordinary" exim modules
724 base64.o: $(HDRS) mime.h base64.c
725 child.o: $(HDRS) child.c
726 crypt16.o: $(HDRS) crypt16.c
727 daemon.o: $(HDRS) daemon.c
728 dbfn.o: $(HDRS) dbfn.c
729 debug.o: $(HDRS) debug.c
730 deliver.o: $(HDRS) transports/smtp.h deliver.c
731 directory.o: $(HDRS) directory.c
734 exim.o: $(HDRS) exim.c
735 expand.o: $(HDRS) expand.c
736 environment.o: $(HDRS) environment.c
737 filter.o: $(HDRS) filter.c
738 filtertest.o: $(HDRS) filtertest.c
739 globals.o: $(HDRS) globals.c
740 hash.o: $(HDRS) hash.c
741 header.o: $(HDRS) header.c
742 host.o: $(HDRS) host.c
746 match.o: $(HDRS) match.c
747 moan.o: $(HDRS) moan.c
748 os.o: $(HDRS) $(OS_C_INCLUDES) os.c
749 parse.o: $(HDRS) parse.c
750 queue.o: $(HDRS) queue.c
752 readconf.o: $(HDRS) readconf.c
753 receive.o: $(HDRS) receive.c
754 retry.o: $(HDRS) retry.c
755 rewrite.o: $(HDRS) rewrite.c
756 rfc2047.o: $(HDRS) rfc2047.c
757 route.o: $(HDRS) route.c
758 search.o: $(HDRS) search.c
759 sieve.o: $(HDRS) sieve.c
760 smtp_in.o: $(HDRS) smtp_in.c
761 smtp_out.o: $(HDRS) smtp_out.c
762 spool_in.o: $(HDRS) spool_in.c
763 spool_out.o: $(HDRS) spool_out.c
764 std-crypto.o: $(HDRS) std-crypto.c
765 store.o: $(HDRS) store.c
766 string.o: $(HDRS) string.c
767 tls.o: $(HDRS) tls.c \
768 tls-gnu.c tlscert-gnu.c \
769 tls-openssl.c tlscert-openssl.c
771 transport.o: $(HDRS) transport.c
772 tree.o: $(HDRS) tree.c
773 verify.o: $(HDRS) transports/smtp.h verify.c
774 dkim.o: $(HDRS) pdkim/pdkim.h dkim.c
775 dkim_transport.o: $(HDRS) dkim_transport.c
777 # Dependencies for WITH_CONTENT_SCAN modules
779 malware.o: $(HDRS) malware.c
780 mime.o: $(HDRS) mime.h mime.c
781 regex.o: $(HDRS) regex.c
782 spam.o: $(HDRS) spam.c
783 spool_mbox.o: $(HDRS) spool_mbox.c
786 # Dependencies for EXPERIMENTAL_* modules
788 bmi_spam.o: $(HDRS) bmi_spam.c
789 dane.o: $(HDRS) dane.c dane-gnu.c dane-openssl.c
790 dcc.o: $(HDRS) dcc.h dcc.c
791 dmarc.o: $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c
792 imap_utf7.o: $(HDRS) imap_utf7.c
793 spf.o: $(HDRS) spf.h spf.c
794 srs.o: $(HDRS) srs.h srs.c
795 utf8.o: $(HDRS) utf8.c
797 # The module containing tables of available lookups, routers, auths, and
798 # transports must be rebuilt if any of them are. However, because the makefiles
799 # for the drivers are always run, we don't actually put the dependencies here,
800 # because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
801 # drtables.o even though the .a files haven't in fact been updated. Instead
802 # it is arranged that the lower-level makefiles remove drtables.o when they
803 # rebuild the .a files.
805 drtables.o: $(HDRS) drtables.c
807 # We depend upon object files built as part of building the lookups library
808 # When using parallel make, we don't have the dependency to force building
809 # in the sub-directory unless we force that dependency:
811 $(OBJ_LOOKUPS): buildlookups
813 # The exim monitor's private modules - the sources live in a private
814 # subdirectory. The final binary combines the private modules with some
815 # modules from the main exim binary.
817 em_StripChart.o: ../exim_monitor/em_StripChart.c
818 em_TextPop.o: ../exim_monitor/em_TextPop.c
819 em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
820 em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h
821 em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h
822 em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h
823 em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h
824 em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h
825 em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h
826 em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h
827 em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h
828 em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
830 @echo "$(CC) exim_monitor/`echo $@ | sed 's/o$$/c/'`"
831 $(FE)$(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
832 ../exim_monitor/`echo $@ | sed 's/o$$/c/'`
835 # Targets for the various libraries that Exim uses.
837 # The lookups library.
840 @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
841 CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
842 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
843 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
846 # The routers library.
849 @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
850 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
851 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
854 # The transports library.
856 buildtransports: config
857 @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
858 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
859 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
862 # The library of authorization modules
865 @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
866 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
867 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
872 buildpdkim: pdkim/pdkim.a
873 pdkim/pdkim.a: config
874 @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
875 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
876 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
879 # The "clean", "install", and "makefile" targets just pass themselves back to
880 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
881 # for them in the build directory.
883 clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
885 # Targets for building stand-alone testing programs for basic testing of
886 # some of the building blocks. These are not integrated with the makefile-
887 # building targets. If you change something that is going to cause the
888 # makefile to be rebuilt, you must run "make makefile" before running one
891 # The testing programs use different versions of some modules - usually
892 # with bits cut out that are not relevant to the test in hand. For those
893 # that are used by several tests, we use a different name.
895 sa-globals.o: $(HDRS) globals.c
896 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
898 sa-os.o: $(HDRS) os.c
899 $(CC) -c $(CFLAGS) $(INCLUDE) \
900 -DFIND_RUNNING_INTERFACES \
903 # These are the test targets themselves
905 test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
906 string.o tod.o version.o utf8.o
907 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
908 $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
909 $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
910 dummies.o sa-globals.o sa-os.o store.o string.o \
911 tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
914 test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
915 store.o string.o tod.o tree.o
916 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c
917 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
918 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
919 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
920 $(LNCC) -o test_host $(LFLAGS) \
921 host.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
922 tod.o tree.o $(LIBS) $(LIBRESOLV)
923 rm -f child.o dummies.o host.o dns.o
925 test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
926 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
927 $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
928 sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
931 test_parse: config.h parse.c dummies.o sa-globals.o \
932 store.o string.o tod.o version.o utf8.o
933 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
934 $(LNCC) -o test_parse $(LFLAGS) parse.o \
935 dummies.o sa-globals.o store.o string.o tod.o version.o \
939 test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
940 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
941 $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
942 dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)