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