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