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