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