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