Tidy up "make" output along the lines of a 2.6 kernel make (just a short
[exim.git] / src / OS / Makefile-Base
CommitLineData
c1ac6996 1# $Cambridge: exim/src/OS/Makefile-Base,v 1.6 2005/05/17 09:53:34 ph10 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
99.PHONY: all allexim buildauths buildlookups buildpcre buildrouters \
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
106allexim: config.h buildpcre $(EXIM_MONITOR) exicyclog exinext exiwhat \
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 \
112 buildauths exim
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)?" \
135 -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \
136 -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \
137 -e "s?MV_COMMAND?$(MV_COMMAND)?" \
138 -e "s?RM_COMMAND?$(RM_COMMAND)?" \
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
fb2274d4 301OBJ_EXPERIMENTAL = bmi_spam.o spf.o srs.o dk.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
306OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
307 directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
308 filtertest.o globals.o \
309 header.o host.o ip.o log.o lss.o match.o moan.o \
310 os.o parse.o queue.o \
311 rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
312 route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
313 store.o string.o tls.o tod.o transport.o tree.o verify.o \
8523533c 314 local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \
8e669ac1 315 $(OBJ_WITH_OLD_DEMIME) $(OBJ_EXPERIMENTAL)
61ec970d
PH
316
317exim: pcre/libpcre.a lookups/lookups.a auths/auths.a \
318 routers/routers.a transports/transports.a \
319 $(OBJ_EXIM) version.c
320 @echo " "
321 awk '{ print ($$1+1) }' cnumber.h > cnumber.temp
322 rm -f cnumber.h; mv cnumber.temp cnumber.h
c1ac6996
PH
323 @echo "$(CC) version.c"
324 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
61ec970d 325 rm -f exim
c1ac6996
PH
326 @echo "$(LNCC) -o exim"
327 $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
61ec970d
PH
328 pcre/libpcre.a \
329 routers/routers.a transports/transports.a lookups/lookups.a \
330 auths/auths.a \
331 $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
332 $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
8523533c 333 $(PERL_LIBS) $(TLS_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
362exim_fixdb: $(OBJ_FIXDB)
c1ac6996
PH
363 @echo "$(LNCC) -o exim_fixdb"
364 $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
61ec970d
PH
365 $(LIBS) $(EXTRALIBS) $(DBMLIB)
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
403exim_lock: exim_lock.c
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
432eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) pcre/libpcre.a \
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) \
61ec970d
PH
439 $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 pcre/libpcre.a \
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
455HDRS = config.h dbfunctions.h dbstuff.h exim.h functions.h globals.h local_scan.h macros.h mytypes.h structs.h
456PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../globals.h ../local_scan.h ../macros.h ../mytypes.h ../structs.h
457
458.SUFFIXES: .o .c
c1ac6996
PH
459.c.o:; @echo "$(CC) $*.c"
460 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
61ec970d
PH
461
462# This is the dummy module for use by test compiles of individual modules. It
463# contains functions such as log_write() that may be called from bits of Exim
464# in the tested code.
465
466dummies.o: dummies.c
467
468# Compile instructions for perl.o for when EXIM_PERL is set
469
470perl.o: $(HDRS) perl.c
c1ac6996
PH
471 @echo "$(PERL_CC) perl.c"
472 $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c
61ec970d
PH
473
474# Compile instructions for the database utility modules
475
476exim_dumpdb.o: $(HDRS) exim_dbutil.c
c1ac6996
PH
477 @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c"
478 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
61ec970d
PH
479 -DCOMPILE_UTILITY \
480 -DEXIM_DUMPDB \
481 -o exim_dumpdb.o exim_dbutil.c
482
483exim_fixdb.o: $(HDRS) exim_dbutil.c
c1ac6996
PH
484 @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c"
485 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
61ec970d
PH
486 -DCOMPILE_UTILITY \
487 -DEXIM_FIXDB \
488 -o exim_fixdb.o exim_dbutil.c
489
490exim_tidydb.o: $(HDRS) exim_dbutil.c
c1ac6996
PH
491 @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c"
492 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
61ec970d
PH
493 -DCOMPILE_UTILITY \
494 -DEXIM_TIDYDB \
495 -o exim_tidydb.o exim_dbutil.c
496
497# Compile instructions for exim_dbmbuild
498
499exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
c1ac6996
PH
500 @echo "$(CC) exim_dbmbuild.c"
501 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -o exim_dbmbuild.o exim_dbmbuild.c
61ec970d
PH
502
503# Utilities use special versions of some modules - typically with debugging
504# calls cut out.
505
506util-spool_in.o: $(HDRS) spool_in.c
c1ac6996
PH
507 @echo "$(CC) -DCOMPILE_UTILITY spool_in.c"
508 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
61ec970d
PH
509
510util-store.o: $(HDRS) store.c
c1ac6996
PH
511 @echo "$(CC) -DCOMPILE_UTILITY store.c"
512 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
61ec970d
PH
513
514util-string.o: $(HDRS) string.c
c1ac6996
PH
515 @echo "$(CC) -DCOMPILE_UTILITY string.c"
516 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
61ec970d
PH
517
518util-os.o: $(HDRS) os.c
c1ac6996
PH
519 @echo "$(CC) -DCOMPILE_UTILITY os.c"
520 $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \
61ec970d
PH
521 -DCOMPILE_UTILITY \
522 -DOS_LOAD_AVERAGE \
523 -DFIND_RUNNING_INTERFACES \
524 -o util-os.o os.c
525
526# The local scan module depends only on its own special header, and is compiled
527# from a source whose location is set by configuration.
528
529local_scan.o: Makefile local_scan.h ../$(LOCAL_SCAN_SOURCE)
c1ac6996
PH
530 @echo "$(CC) local_scan.c"
531 $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
61ec970d
PH
532
533# Dependencies for the "ordinary" exim modules
534
535acl.o: $(HDRS) acl.c
536child.o: $(HDRS) child.c
537crypt16.o: $(HDRS) crypt16.c
538daemon.o: $(HDRS) daemon.c
539dbfn.o: $(HDRS) dbfn.c
540debug.o: $(HDRS) debug.c
541deliver.o: $(HDRS) deliver.c
542directory.o: $(HDRS) directory.c
543dns.o: $(HDRS) dns.c
544enq.o: $(HDRS) enq.c
545exim.o: $(HDRS) exim.c
546expand.o: $(HDRS) expand.c
547filter.o: $(HDRS) filter.c
548filtertest.o: $(HDRS) filtertest.c
549globals.o: $(HDRS) globals.c
550header.o: $(HDRS) header.c
551host.o: $(HDRS) host.c
552ip.o: $(HDRS) ip.c
553log.o: $(HDRS) log.c
554lss.o: $(HDRS) lss.c
555match.o: $(HDRS) match.c
556moan.o: $(HDRS) moan.c
557os.o: $(HDRS) os.c
558parse.o: $(HDRS) parse.c
559queue.o: $(HDRS) queue.c
560rda.o: $(HDRS) rda.c
561readconf.o: $(HDRS) readconf.c
562receive.o: $(HDRS) receive.c
563retry.o: $(HDRS) retry.c
564rewrite.o: $(HDRS) rewrite.c
565rfc2047.o: $(HDRS) rfc2047.c
566route.o: $(HDRS) route.c
567search.o: $(HDRS) search.c
568sieve.o: $(HDRS) sieve.c
569smtp_in.o: $(HDRS) smtp_in.c
570smtp_out.o: $(HDRS) smtp_out.c
571spool_in.o: $(HDRS) spool_in.c
572spool_out.o: $(HDRS) spool_out.c
573store.o: $(HDRS) store.c
574string.o: $(HDRS) string.c
575tls.o: $(HDRS) tls.c tls-gnu.c tls-openssl.c
576tod.o: $(HDRS) tod.c
577transport.o: $(HDRS) transport.c
578tree.o: $(HDRS) tree.c
579verify.o: $(HDRS) verify.c
580
8523533c
TK
581
582# Dependencies for WITH_CONTENT_SCAN modules
583
584malware.o: $(HDRS) malware.c
585mime.o: $(HDRS) mime.c
586regex.o: $(HDRS) regex.c
587spam.o: $(HDRS) spam.c
588spool_mbox.o: $(HDRS) spool_mbox.c
589
590
591# Dependencies for WITH_OLD_DEMIME modules
592
593demime.o: $(HDRS) demime.c
594
595
596# Dependencies for EXPERIMENTAL_* modules
597
598bmi_spam.o: $(HDRS) bmi_spam.c
599spf.o: $(HDRS) spf.c
600srs.o: $(HDRS) srs.c
fb2274d4 601dk.o: $(HDRS) dk.c
8523533c 602
61ec970d
PH
603# The module containing tables of available lookups, routers, auths, and
604# transports must be rebuilt if any of them are. However, because the makefiles
605# for the drivers are always run, we don't actually put the dependencies here,
606# because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
607# drtables.o even though the .a files haven't in fact been updated. Instead
608# it is arranged that the lower-level makefiles remove drtables.o when they
609# rebuild the .a files.
610
611drtables.o: $(HDRS) drtables.c
612
613
614# The exim monitor's private modules - the sources live in a private
615# subdirectory. The final binary combines the private modules with some
616# modules from the main exim binary.
617
618em_StripChart.o: ../exim_monitor/em_StripChart.c
619em_TextPop.o: ../exim_monitor/em_TextPop.c
620em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
621em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h
622em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h
623em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h
624em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h
625em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h
626em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h
627em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h
628em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h
629em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
630$(MONBIN): $(HDRS)
c1ac6996
PH
631 @echo "$(CC) exim_monitor/`echo $@ | sed 's/o$$/c/'`"
632 $(FE)$(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
61ec970d
PH
633 ../exim_monitor/`echo $@ | sed 's/o$$/c/'`
634
635
636# Targets for the various libraries that Exim uses. This coding is tedious,
637# because different versions of "make" behave in different ways with regard
638# to rebuilding. If these target names are of the form pcre/libpcre.a, for
639# example, then a forcing mechanism is required to get them obeyed each time.
640# That's fine on Solaris and other systems; the rebuilding of the exim target
641# happens only if the libraries are actually rebuilt. However, on IRIX, if
642# the target is forced, the exim target gets unnecessarily rebuilt even if
643# the .a file is not. Contrariwise, if we use dummy names, they don't interact
644# with the building of exim (and eximon.bin), but for libpcre Exim doesn't get
645# rebuilt when it should. (For the others it does, because they remove
646# drtables.o when they rebuild.) To get round this, we forcibly remove the
647# binary when it needs to be rebuilt.
648
649# The PCRE regex library. Move the pcretest program to the util directory. Some
650# "clever" versions of make notice that there are two successive shell
651# commands, and they run them in the same shell. This means that we have to
652# take care to encapsulate change of directory in parentheses, so that it
653# reverts when it should.
654
655buildpcre:
656 @(cd pcre; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" \
c1ac6996 657 FE="$(FE)" CFLAGS="$(CFLAGS) $(PCRE_CFLAGS)" \
61ec970d
PH
658 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
659 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)")
660 @if $(SHELL) $(SCRIPTS)/newer pcre/libpcre.a exim; then \
661 rm -f exim eximon.bin; fi
c1ac6996 662 @echo " "
61ec970d
PH
663
664# The lookups library.
665
666buildlookups:
667 @cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
c1ac6996 668 FE="$(FE)" RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
61ec970d
PH
669 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \
670 echo " "
671
672# The routers library.
673
674buildrouters:
675 @cd routers; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
c1ac6996 676 FE="$(FE)" RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
61ec970d
PH
677 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
678 echo " "
679
680# The transports library.
681
682buildtransports:
683 @cd transports; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
c1ac6996 684 FE="$(FE)" RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
61ec970d
PH
685 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
686 echo " "
687
688# The library of authorization modules
689
690buildauths:
691 @cd auths; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
c1ac6996 692 FE="$(FE)" RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
61ec970d
PH
693 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
694 echo " "
695
696# The "clean", "install", and "makefile" targets just pass themselves back to
697# the main Exim makefile. These targets will be obeyed only if "make" is obeyed
698# for them in the build directory.
699
700clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
701
702# Targets for building stand-alone testing programs for basic testing of
703# some of the building blocks. These are not integrated with the makefile-
704# building targets. If you change something that is going to cause the
705# makefile to be rebuilt, you must run "make makefile" before running one
706# of these.
707
708# The testing programs use different versions of some modules - usually
709# with bits cut out that are not relevant to the test in hand. For those
710# that are used by several tests, we use a different name.
711
712sa-globals.o: $(HDRS) globals.c
713 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
714
715sa-os.o: $(HDRS) os.c
716 $(CC) -c $(CFLAGS) $(INCLUDE) \
717 -DFIND_RUNNING_INTERFACES \
718 -o sa-os.o os.c
719
720# These are the test targets themselves
721
722test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
723 string.o tod.o version.o
724 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
725 $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
726 dummies.o sa-globals.o sa-os.o store.o string.o \
727 tod.o version.o $(LIBS) $(DBMLIB)
728 rm -f dbfn.o
729
730test_host: config.h host.c dns.c dummies.o sa-globals.o sa-os.o store.o \
731 string.o tod.o tree.o
732 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
733 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
734 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
735 $(LNCC) -o test_host $(LFLAGS) \
736 host.o dns.o dummies.o sa-globals.o os.o store.o string.o tod.o tree.o \
737 $(LIBS) $(LIBRESOLV)
738 rm -f dummies.o host.o dns.o
739
740test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o
741 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
742 $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
743 sa-globals.o store.o string.o tod.o $(LIBS)
744 rm -f os.o
745
746test_parse: config.h parse.c dummies.o sa-globals.o \
747 store.o string.o tod.o version.o
748 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
749 $(LNCC) -o test_parse $(LFLAGS) parse.o \
750 dummies.o sa-globals.o store.o string.o tod.o version.o
751 rm -f parse.o
752
753test_string: config.h string.c dummies.o sa-globals.o store.o tod.o
754 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
755 $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
756 dummies.o sa-globals.o store.o tod.o $(LIBS)
757 rm -f string.o
758
759# End