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