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 = 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_PLAIN = macro-predef.o \
132 macro-globals.o macro-readconf.o macro-route.o macro-transport.o macro-drtables.o \
135 macro-appendfile.o macro-autoreply.o macro-lmtp.o macro-pipe.o macro-queuefile.o \
138 macro-accept.o macro-dnslookup.o macro-ipliteral.o macro-iplookup.o \
139 macro-manualroute.o macro-queryprogram.o macro-redirect.o
141 macro-auth-spa.o macro-cram_md5.o macro-cyrus_sasl.o macro-dovecot.o macro-gsasl_exim.o \
142 macro-heimdal_gssapi.o macro-plaintext.o macro-spa.o macro-tls.o
144 OBJ_MACRO = $(OBJ_MACRO_PLAIN) $(OBJ_MACRO_TP) $(OBJ_MACRO_RT) $(OBJ_MACRO_AU)
145 $(OBJ_MACRO): $(MACRO_HSRC)
147 $(OBJ_MACRO_PLAIN): macro-%.o : %.c
148 @echo "$(CC) -DMACRO_PREDEF $<"
149 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
150 $(OBJ_MACRO_TP): macro-%.o : transports/%.c
151 @echo "$(CC) -DMACRO_PREDEF $<"
152 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
153 $(OBJ_MACRO_RT): macro-%.o : routers/%.c
154 @echo "$(CC) -DMACRO_PREDEF $<"
155 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
156 $(OBJ_MACRO_AU): macro-%.o : auths/%.c
157 @echo "$(CC) -DMACRO_PREDEF $<"
158 $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ $<
160 macro_predef: $(OBJ_MACRO)
161 @echo "$(LNCC) -o $@"
162 $(FE)$(LNCC) -o $@ $(LFLAGS) $(OBJ_MACRO)
164 macro.c: macro_predef
165 ./macro_predef > macro.c
167 # This target is recognized specially by GNU make. It records those targets
168 # that do not correspond to files that are being built and which should
169 # therefore always be run, even if the files exist. This shouldn't in fact be a
170 # problem, but it does no harm. Other make programs will just ignore this.
172 .PHONY: all config utils \
173 buildauths buildlookups buildpdkim buildrouters \
174 buildtransports checklocalmake clean
177 utils: $(EXIM_MONITOR) exicyclog exinext exiwhat \
178 exigrep eximstats exipick exiqgrep exiqsumm \
179 transport-filter.pl convert4r3 convert4r4 \
181 exim_dbmbuild exim_dumpdb exim_fixdb exim_tidydb exim_lock
184 # Targets for special-purpose configuration header builders
185 buildconfig: buildconfig.c
186 @echo "$(CC) buildconfig.c"
187 $(FE)$(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS)
190 # Target for the exicyclog utility script
191 exicyclog: config ../src/exicyclog.src
194 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
197 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
198 -e "s?CONFIGURE_FILE_USE_EUID?$(CONFIGURE_FILE_USE_EUID)?" \
199 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
200 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
201 -e "s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)?" \
202 -e "s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)?" \
203 -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
204 -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \
205 -e "s?CHMOD_COMMAND?$(CHMOD_COMMAND)?" \
206 -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \
207 -e "s?MV_COMMAND?$(MV_COMMAND)?" \
208 -e "s?RM_COMMAND?$(RM_COMMAND)?" \
209 -e "s?TOUCH_COMMAND?$(TOUCH_COMMAND)?" \
210 ../src/exicyclog.src > exicyclog-t
211 @mv exicyclog-t exicyclog
213 @echo ">>> exicyclog script built"
215 # Target for the exinext utility script
216 exinext: config ../src/exinext.src
219 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
222 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
223 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
224 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
225 ../src/exinext.src > exinext-t
226 @mv exinext-t exinext
228 @echo ">>> exinext script built"
230 # Target for the exiwhat utility script
231 exiwhat: config ../src/exiwhat.src
234 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
237 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
238 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
239 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
240 -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
241 -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
242 -e "s?EXIWHAT_KILL_SIGNAL?$(EXIWHAT_KILL_SIGNAL)?" \
243 -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
244 -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
245 -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
246 ../src/exiwhat.src > exiwhat-t
247 @mv exiwhat-t exiwhat
249 @echo ">>> exiwhat script built"
251 # Target for the exim_checkaccess utility script
252 exim_checkaccess: config ../src/exim_checkaccess.src
253 @rm -f exim_checkaccess
255 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
258 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
259 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
260 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
261 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
262 ../src/exim_checkaccess.src > exim_checkaccess-t
263 @mv exim_checkaccess-t exim_checkaccess
264 @chmod a+x exim_checkaccess
265 @echo ">>> exim_checkaccess script built"; echo ""
267 # Target for the Exim monitor start-up script
268 eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
271 $(SHELL) $(SCRIPTS)/Configure-eximon
273 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
276 -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
277 -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
278 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
279 -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
280 -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
281 -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
282 ../src/eximon.src >> eximon
283 @echo ">>> eximon script built"; echo ""
285 # Targets for utilities; these are all Perl scripts that have to get the
286 # location of Perl put in them. A few need other things as well.
288 exigrep: Makefile ../src/exigrep.src
291 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
294 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
295 -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
296 -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
297 ../src/exigrep.src > exigrep-t
298 @mv exigrep-t exigrep
300 @echo ">>> exigrep script built"
302 eximstats: Makefile ../src/eximstats.src
305 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
306 ../src/eximstats.src > eximstats-t
307 @mv eximstats-t eximstats
309 @echo ">>> eximstats script built"
311 exiqgrep: Makefile ../src/exiqgrep.src
314 -e "s?PROCESSED_FLAG?This file has been so processed.?"\
317 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
318 -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
319 ../src/exiqgrep.src > exiqgrep-t
320 @mv exiqgrep-t exiqgrep
322 @echo ">>> exiqgrep script built"
324 exiqsumm: Makefile ../src/exiqsumm.src
326 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
327 ../src/exiqsumm.src > exiqsumm-t
328 @mv exiqsumm-t exiqsumm
330 @echo ">>> exiqsumm script built"
332 exipick: Makefile ../src/exipick.src
334 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
335 -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
336 -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
337 ../src/exipick.src > exipick-t
338 @mv exipick-t exipick
340 @echo ">>> exipick script built"
342 transport-filter.pl: Makefile ../src/transport-filter.src
343 @rm -f transport-filter.pl
344 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
345 ../src/transport-filter.src > transport-filter.pl-t
346 @mv transport-filter.pl-t transport-filter.pl
347 @chmod a+x transport-filter.pl
348 @echo ">>> transport-filter.pl script built"
350 convert4r3: Makefile ../src/convert4r3.src
352 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
353 ../src/convert4r3.src > convert4r3-t
354 @mv convert4r3-t convert4r3
355 @chmod a+x convert4r3
356 @echo ">>> convert4r3 script built"
358 convert4r4: Makefile ../src/convert4r4.src
360 @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
361 ../src/convert4r4.src > convert4r4-t
362 @mv convert4r4-t convert4r4
363 @chmod a+x convert4r4
364 @echo ">>> convert4r4 script built"
367 # These are objects of optional features. They are always compiled, but
368 # if the corresponding #defines are not set, they wind up empty and
369 # are thrown away by the linker.
371 OBJ_WITH_CONTENT_SCAN = malware.o mime.o regex.o spam.o spool_mbox.o
372 OBJ_EXPERIMENTAL = bmi_spam.o \
381 # Targets for final binaries; the main one has a build number which is
382 # updated each time. We don't bother with that for the auxiliaries.
384 OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o
386 OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
387 directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
388 filtertest.o globals.o dkim.o dkim_transport.o hash.o \
389 header.o host.o ip.o log.o lss.o match.o moan.o \
390 os.o parse.o queue.o \
391 rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
392 route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
393 std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \
394 environment.o macro.o \
396 local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
399 exim: buildlookups buildauths pdkim/pdkim.a \
400 buildrouters buildtransports \
401 $(OBJ_EXIM) version.o
402 @echo "$(LNCC) -o exim"
403 $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
404 routers/routers.a transports/transports.a lookups/lookups.a \
405 auths/auths.a pdkim/pdkim.a \
406 $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
407 $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
408 $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS)
409 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
410 echo $(STRIP_COMMAND) exim; \
411 $(STRIP_COMMAND) exim; \
415 @echo ">>> exim binary built"
418 # The utility for dumping the contents of an exim database
420 OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
422 exim_dumpdb: $(OBJ_DUMPDB)
423 @echo "$(LNCC) -o exim_dumpdb"
424 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
425 $(LIBS) $(EXTRALIBS) $(DBMLIB)
426 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
427 echo $(STRIP_COMMAND) exim_dumpdb; \
428 $(STRIP_COMMAND) exim_dumpdb; \
430 @echo ">>> exim_dumpdb utility built"
433 # The utility for interrogating/fixing the contents of an exim database
435 OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o
437 exim_fixdb: $(OBJ_FIXDB) buildauths
438 @echo "$(LNCC) -o exim_fixdb"
439 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
440 auths/auths.a $(LIBS) $(EXTRALIBS) $(DBMLIB)
441 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
442 echo $(STRIP_COMMAND) exim_fixdb; \
443 $(STRIP_COMMAND) exim_fixdb; \
445 @echo ">>> exim_fixdb utility built"
448 # The utility for tidying the contents of an exim database
450 OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
452 exim_tidydb: $(OBJ_TIDYDB)
453 @echo "$(LNCC) -o exim_tidydb"
454 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
455 $(LIBS) $(EXTRALIBS) $(DBMLIB)
456 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
457 echo $(STRIP_COMMAND) exim_tidydb; \
458 $(STRIP_COMMAND) exim_tidydb; \
460 @echo ">>> exim_tidydb utility built"
463 # The utility for building dbm files
465 exim_dbmbuild: exim_dbmbuild.o
466 @echo "$(LNCC) -o exim_dbmbuild"
467 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
468 $(LIBS) $(EXTRALIBS) $(DBMLIB)
469 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
470 echo $(STRIP_COMMAND) exim_dbmbuild; \
471 $(STRIP_COMMAND) exim_dbmbuild; \
473 @echo ">>> exim_dbmbuild utility built"
476 # The utility for locking a mailbox while messing around with it
478 exim_lock: exim_lock.c os.h
479 @echo "$(CC) exim_lock.c"
480 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
481 @echo "$(LNCC) -o exim_lock"
482 $(FE)$(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
484 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
485 echo $(STRIP_COMMAND) exim_lock; \
486 $(STRIP_COMMAND) exim_lock; \
488 @echo ">>> exim_lock utility built"
491 # The X-based Exim monitor program's binary part. There's a macro for cutting
492 # out the modified TextPop module, because some antique link editors cannot
493 # handle the fact that it is redefining things that are found later in the
496 # Object modules that are the unique Eximon modules
498 MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
499 em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
502 # The complete modules list also includes some specially compiled versions of
503 # code from the main Exim source tree.
505 OBJ_MONBIN = util-spool_in.o \
513 eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) \
514 ../exim_monitor/em_version.c
515 @echo "$(CC) exim_monitor/em_version.c"
516 $(FE)$(CC) -o em_version.o -c \
517 $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
518 @echo "$(LNCC) -o eximon.bin"
519 $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
520 $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \
521 $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
522 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
523 echo $(STRIP_COMMAND) eximon.bin; \
524 $(STRIP_COMMAND) eximon.bin; \
526 @echo ">>> exim monitor binary built"
530 # Compile step for most of the exim modules. HDRS is a list of headers
531 # which cause everything to be rebuilt. PHDRS is the same, for the use
532 # of routers, transports, and authenticators. I can't find a way of doing this
533 # in one. This list is overkill, but it doesn't really take much time to
534 # rebuild Exim on a modern computer.
550 PHDRS = ../config.h \
563 .c.o:; @echo "$(CC) $*.c"
564 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
566 # Update Exim's version information and build the version object.
569 @../scripts/reversion
573 version.o: $(HDRS) cnumber.h version.h version.c
575 # This is the dummy module for use by test compiles of individual modules. It
576 # contains functions such as log_write() that may be called from bits of Exim
577 # in the tested code.
581 # Compile instructions for perl.o for when EXIM_PERL is set
583 perl.o: $(HDRS) perl.c
584 @echo "$(PERL_CC) perl.c"
585 $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
587 # Compile instructions for the database utility modules
589 exim_dumpdb.o: $(HDRS) exim_dbutil.c
590 @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
591 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
594 -o exim_dumpdb.o exim_dbutil.c
596 exim_fixdb.o: $(HDRS) exim_dbutil.c
597 @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
598 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
601 -o exim_fixdb.o exim_dbutil.c
603 exim_tidydb.o: $(HDRS) exim_dbutil.c
604 @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
605 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
608 -o exim_tidydb.o exim_dbutil.c
610 # Compile instructions for exim_dbmbuild
612 exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
613 @echo "$(CC) exim_dbmbuild.c"
614 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \
615 -o exim_dbmbuild.o exim_dbmbuild.c
617 # Utilities use special versions of some modules - typically with debugging
620 util-spool_in.o: $(HDRS) spool_in.c
621 @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
622 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
624 util-store.o: $(HDRS) store.c
625 @echo "$(CC) -DCOMPILE_UTILITY store.c"
626 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
628 util-string.o: $(HDRS) string.c
629 @echo "$(CC) -DCOMPILE_UTILITY string.c"
630 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
632 util-queue.o: $(HDRS) queue.c
633 @echo "$(CC) -DCOMPILE_UTILITY queue.c"
634 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c
636 util-tod.o: $(HDRS) tod.c
637 @echo "$(CC) -DCOMPILE_UTILITY tod.c"
638 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c
640 util-os.o: $(HDRS) os.c
641 @echo "$(CC) -DCOMPILE_UTILITY os.c"
642 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
645 -DFIND_RUNNING_INTERFACES \
648 # The local scan module depends only on its own special header, and is compiled
649 # from a source whose location is set by configuration.
651 local_scan.o: config local_scan.h ../$(LOCAL_SCAN_SOURCE)
652 @echo "$(CC) local_scan.c"
653 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
655 # Dependencies for the "ordinary" exim modules
658 base64.o: $(HDRS) mime.h base64.c
659 child.o: $(HDRS) child.c
660 crypt16.o: $(HDRS) crypt16.c
661 daemon.o: $(HDRS) daemon.c
662 dbfn.o: $(HDRS) dbfn.c
663 debug.o: $(HDRS) debug.c
664 deliver.o: $(HDRS) transports/smtp.h deliver.c
665 directory.o: $(HDRS) directory.c
668 exim.o: $(HDRS) exim.c
669 expand.o: $(HDRS) expand.c
670 environment.o: $(HDRS) environment.c
671 filter.o: $(HDRS) filter.c
672 filtertest.o: $(HDRS) filtertest.c
673 globals.o: $(HDRS) globals.c
674 hash.o: $(HDRS) hash.c
675 header.o: $(HDRS) header.c
676 host.o: $(HDRS) host.c
680 match.o: $(HDRS) match.c
681 moan.o: $(HDRS) moan.c
682 os.o: $(HDRS) $(OS_C_INCLUDES) os.c
683 parse.o: $(HDRS) parse.c
684 queue.o: $(HDRS) queue.c
686 readconf.o: $(HDRS) readconf.c
687 receive.o: $(HDRS) receive.c
688 retry.o: $(HDRS) retry.c
689 rewrite.o: $(HDRS) rewrite.c
690 rfc2047.o: $(HDRS) rfc2047.c
691 route.o: $(HDRS) route.c
692 search.o: $(HDRS) search.c
693 sieve.o: $(HDRS) sieve.c
694 smtp_in.o: $(HDRS) smtp_in.c
695 smtp_out.o: $(HDRS) smtp_out.c
696 spool_in.o: $(HDRS) spool_in.c
697 spool_out.o: $(HDRS) spool_out.c
698 std-crypto.o: $(HDRS) std-crypto.c
699 store.o: $(HDRS) store.c
700 string.o: $(HDRS) string.c
701 tls.o: $(HDRS) tls.c \
702 tls-gnu.c tlscert-gnu.c \
703 tls-openssl.c tlscert-openssl.c
705 transport.o: $(HDRS) transport.c
706 tree.o: $(HDRS) tree.c
707 verify.o: $(HDRS) transports/smtp.h verify.c
708 dkim.o: $(HDRS) pdkim/pdkim.h dkim.c
709 dkim_transport.o: $(HDRS) dkim_transport.c
711 # Dependencies for WITH_CONTENT_SCAN modules
713 malware.o: $(HDRS) malware.c
714 mime.o: $(HDRS) mime.h mime.c
715 regex.o: $(HDRS) regex.c
716 spam.o: $(HDRS) spam.c
717 spool_mbox.o: $(HDRS) spool_mbox.c
720 # Dependencies for EXPERIMENTAL_* modules
722 bmi_spam.o: $(HDRS) bmi_spam.c
723 dane.o: $(HDRS) dane.c dane-gnu.c dane-openssl.c
724 dcc.o: $(HDRS) dcc.h dcc.c
725 dmarc.o: $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c
726 imap_utf7.o: $(HDRS) imap_utf7.c
727 spf.o: $(HDRS) spf.h spf.c
728 srs.o: $(HDRS) srs.h srs.c
729 utf8.o: $(HDRS) utf8.c
731 # The module containing tables of available lookups, routers, auths, and
732 # transports must be rebuilt if any of them are. However, because the makefiles
733 # for the drivers are always run, we don't actually put the dependencies here,
734 # because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
735 # drtables.o even though the .a files haven't in fact been updated. Instead
736 # it is arranged that the lower-level makefiles remove drtables.o when they
737 # rebuild the .a files.
739 drtables.o: $(HDRS) drtables.c
741 # We depend upon object files built as part of building the lookups library
742 # When using parallel make, we don't have the dependency to force building
743 # in the sub-directory unless we force that dependency:
745 $(OBJ_LOOKUPS): buildlookups
747 # The exim monitor's private modules - the sources live in a private
748 # subdirectory. The final binary combines the private modules with some
749 # modules from the main exim binary.
751 em_StripChart.o: ../exim_monitor/em_StripChart.c
752 em_TextPop.o: ../exim_monitor/em_TextPop.c
753 em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
754 em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h
755 em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h
756 em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h
757 em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h
758 em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h
759 em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h
760 em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h
761 em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h
762 em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
764 @echo "$(CC) exim_monitor/`echo $@ | sed 's/o$$/c/'`"
765 $(FE)$(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
766 ../exim_monitor/`echo $@ | sed 's/o$$/c/'`
769 # Targets for the various libraries that Exim uses.
771 # The lookups library.
774 @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
775 CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
776 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
777 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
780 # The routers library.
783 @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
784 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
785 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
788 # The transports library.
790 buildtransports: config
791 @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
792 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
793 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
796 # The library of authorization modules
799 @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
800 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
801 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
806 buildpdkim: pdkim/pdkim.a
807 pdkim/pdkim.a: config
808 @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
809 FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
810 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
813 # The "clean", "install", and "makefile" targets just pass themselves back to
814 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
815 # for them in the build directory.
817 clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
819 # Targets for building stand-alone testing programs for basic testing of
820 # some of the building blocks. These are not integrated with the makefile-
821 # building targets. If you change something that is going to cause the
822 # makefile to be rebuilt, you must run "make makefile" before running one
825 # The testing programs use different versions of some modules - usually
826 # with bits cut out that are not relevant to the test in hand. For those
827 # that are used by several tests, we use a different name.
829 sa-globals.o: $(HDRS) globals.c
830 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
832 sa-os.o: $(HDRS) os.c
833 $(CC) -c $(CFLAGS) $(INCLUDE) \
834 -DFIND_RUNNING_INTERFACES \
837 # These are the test targets themselves
839 test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
840 string.o tod.o version.o utf8.o
841 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
842 $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c
843 $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
844 dummies.o sa-globals.o sa-os.o store.o string.o \
845 tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS)
848 test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \
849 store.o string.o tod.o tree.o
850 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c
851 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
852 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
853 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
854 $(LNCC) -o test_host $(LFLAGS) \
855 host.o child.o dns.o dummies.o sa-globals.o os.o store.o string.o \
856 tod.o tree.o $(LIBS) $(LIBRESOLV)
857 rm -f child.o dummies.o host.o dns.o
859 test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.o
860 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
861 $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
862 sa-globals.o store.o string.o tod.o utf8.o $(LIBS) $(LDFLAGS)
865 test_parse: config.h parse.c dummies.o sa-globals.o \
866 store.o string.o tod.o version.o utf8.o
867 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
868 $(LNCC) -o test_parse $(LFLAGS) parse.o \
869 dummies.o sa-globals.o store.o string.o tod.o version.o \
873 test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.o
874 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
875 $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
876 dummies.o sa-globals.o store.o tod.o utf8.o $(LIBS) $(LDFLAGS)