Start
[exim.git] / src / OS / Makefile-Base
CommitLineData
61ec970d
PH
1# $Cambridge: exim/src/OS/Makefile-Base,v 1.1 2004/10/06 15:07:39 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
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# Targets for final binaries; the main one has a build number which is
288# updated each time. We don't bother with that for the auxiliaries.
289
290OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
291 directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
292 filtertest.o globals.o \
293 header.o host.o ip.o log.o lss.o match.o moan.o \
294 os.o parse.o queue.o \
295 rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
296 route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o \
297 store.o string.o tls.o tod.o transport.o tree.o verify.o \
298 local_scan.o $(EXIM_PERL)
299
300exim: pcre/libpcre.a lookups/lookups.a auths/auths.a \
301 routers/routers.a transports/transports.a \
302 $(OBJ_EXIM) version.c
303 @echo " "
304 awk '{ print ($$1+1) }' cnumber.h > cnumber.temp
305 rm -f cnumber.h; mv cnumber.temp cnumber.h
306 $(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
307 rm -f exim
308 $(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
309 pcre/libpcre.a \
310 routers/routers.a transports/transports.a lookups/lookups.a \
311 auths/auths.a \
312 $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \
313 $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \
314 $(PERL_LIBS) $(TLS_LIBS)
315 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
316 echo $(STRIP_COMMAND) exim; \
317 $(STRIP_COMMAND) exim; \
318 fi
319 $(EXIM_CHMOD)
320 @echo " "
321 @echo ">>> exim binary built"
322 @echo " "
323
324# The utility for dumping the contents of an exim database
325
326OBJ_DUMPDB = exim_dumpdb.o util-os.o util-store.o
327
328exim_dumpdb: $(OBJ_DUMPDB)
329 $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_dumpdb $(LFLAGS) $(OBJ_DUMPDB) \
330 $(LIBS) $(EXTRALIBS) $(DBMLIB)
331 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
332 echo $(STRIP_COMMAND) exim_dumpdb; \
333 $(STRIP_COMMAND) exim_dumpdb; \
334 fi
335 @echo " "
336 @echo ">>> exim_dumpdb utility built"
337 @echo " "
338
339# The utility for interrogating/fixing the contents of an exim database
340
341OBJ_FIXDB = exim_fixdb.o util-os.o util-store.o
342
343exim_fixdb: $(OBJ_FIXDB)
344 $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_fixdb $(LFLAGS) $(OBJ_FIXDB) \
345 $(LIBS) $(EXTRALIBS) $(DBMLIB)
346 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
347 echo $(STRIP_COMMAND) exim_fixdb; \
348 $(STRIP_COMMAND) exim_fixdb; \
349 fi
350 @echo " "
351 @echo ">>> exim_fixdb utility built"
352 @echo " "
353
354# The utility for tidying the contents of an exim database
355
356OBJ_TIDYDB = exim_tidydb.o util-os.o util-store.o
357
358exim_tidydb: $(OBJ_TIDYDB)
359 $(LNCC) $(CFLAGS) $(INCLUDE) -o exim_tidydb $(LFLAGS) $(OBJ_TIDYDB) \
360 $(LIBS) $(EXTRALIBS) $(DBMLIB)
361 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
362 echo $(STRIP_COMMAND) exim_tidydb; \
363 $(STRIP_COMMAND) exim_tidydb; \
364 fi
365 @echo " "
366 @echo ">>> exim_tidydb utility built"
367 @echo " "
368
369# The utility for building dbm files
370
371exim_dbmbuild: exim_dbmbuild.o
372 $(LNCC) -o exim_dbmbuild $(LFLAGS) exim_dbmbuild.o \
373 $(LIBS) $(EXTRALIBS) $(DBMLIB)
374 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
375 echo $(STRIP_COMMAND) exim_dbmbuild; \
376 $(STRIP_COMMAND) exim_dbmbuild; \
377 fi
378 @echo " "
379 @echo ">>> exim_dbmbuild utility built"
380 @echo " "
381
382# The utility for locking a mailbox while messing around with it
383
384exim_lock: exim_lock.c
385 $(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c
386 $(LNCC) -o exim_lock $(LFLAGS) exim_lock.o \
387 $(LIBS) $(EXTRALIBS)
388 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
389 echo $(STRIP_COMMAND) exim_lock; \
390 $(STRIP_COMMAND) exim_lock; \
391 fi
392 @echo " "
393 @echo ">>> exim_lock utility built"
394 @echo " "
395
396# The X-based Exim monitor program's binary part. There's a macro for cutting
397# out the modified TextPop module, because some antique link editors cannot
398# handle the fact that it is redefining things that are found later in the
399# Xaw library.
400
401# Object modules that are the unique Eximon modules
402
403MONBIN = em_StripChart.o $(EXIMON_TEXTPOP) em_globals.o em_init.o \
404 em_log.o em_main.o em_menu.o em_queue.o em_strip.o \
405 em_text.o em_xs.o
406
407# The complete modules list also includes some specially compiled versions of
408# code from the main Exim source tree.
409
410OBJ_MONBIN = util-spool_in.o util-store.o util-string.o tod.o tree.o $(MONBIN)
411
412eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) pcre/libpcre.a \
413 ../exim_monitor/em_version.c
414 $(CC) -o em_version.o -c \
415 $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c
416 $(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \
417 $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 pcre/libpcre.a \
418 $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc
419 @if [ x"$(STRIP_COMMAND)" != x"" ]; then \
420 echo $(STRIP_COMMAND) eximon.bin; \
421 $(STRIP_COMMAND) eximon.bin; \
422 fi
423 @echo " "
424 @echo ">>> exim monitor binary built"
425 @echo " "
426
427
428# Compile step for most of the exim modules. HDRS is a list of headers
429# which cause everthing to be rebuilt. PHDRS is the same, for the use
430# of routers, transports, and authenticators. I can't find a way of doing this
431# in one. This list is overkill, but it doesn't really take much time to
432# rebuild Exim on a modern computer.
433
434HDRS = config.h dbfunctions.h dbstuff.h exim.h functions.h globals.h local_scan.h macros.h mytypes.h structs.h
435PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../globals.h ../local_scan.h ../macros.h ../mytypes.h ../structs.h
436
437.SUFFIXES: .o .c
438.c.o:; $(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
439
440# This is the dummy module for use by test compiles of individual modules. It
441# contains functions such as log_write() that may be called from bits of Exim
442# in the tested code.
443
444dummies.o: dummies.c
445
446# Compile instructions for perl.o for when EXIM_PERL is set
447
448perl.o: $(HDRS) perl.c
449 $(PERL_CC) $(PERL_CCOPTS) $(INCLUDE) -c perl.c
450
451# Compile instructions for the database utility modules
452
453exim_dumpdb.o: $(HDRS) exim_dbutil.c
454 $(CC) -c $(CFLAGS) $(INCLUDE) \
455 -DCOMPILE_UTILITY \
456 -DEXIM_DUMPDB \
457 -o exim_dumpdb.o exim_dbutil.c
458
459exim_fixdb.o: $(HDRS) exim_dbutil.c
460 $(CC) -c $(CFLAGS) $(INCLUDE) \
461 -DCOMPILE_UTILITY \
462 -DEXIM_FIXDB \
463 -o exim_fixdb.o exim_dbutil.c
464
465exim_tidydb.o: $(HDRS) exim_dbutil.c
466 $(CC) -c $(CFLAGS) $(INCLUDE) \
467 -DCOMPILE_UTILITY \
468 -DEXIM_TIDYDB \
469 -o exim_tidydb.o exim_dbutil.c
470
471# Compile instructions for exim_dbmbuild
472
473exim_dbmbuild.o: $(HDRS) exim_dbmbuild.c
474 $(CC) -c $(CFLAGS) $(INCLUDE) -o exim_dbmbuild.o exim_dbmbuild.c
475
476# Utilities use special versions of some modules - typically with debugging
477# calls cut out.
478
479util-spool_in.o: $(HDRS) spool_in.c
480 $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c
481
482util-store.o: $(HDRS) store.c
483 $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c
484
485util-string.o: $(HDRS) string.c
486 $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c
487
488util-os.o: $(HDRS) os.c
489 $(CC) -c $(CFLAGS) $(INCLUDE) \
490 -DCOMPILE_UTILITY \
491 -DOS_LOAD_AVERAGE \
492 -DFIND_RUNNING_INTERFACES \
493 -o util-os.o os.c
494
495# The local scan module depends only on its own special header, and is compiled
496# from a source whose location is set by configuration.
497
498local_scan.o: Makefile local_scan.h ../$(LOCAL_SCAN_SOURCE)
499 $(CC) -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE)
500
501# Dependencies for the "ordinary" exim modules
502
503acl.o: $(HDRS) acl.c
504child.o: $(HDRS) child.c
505crypt16.o: $(HDRS) crypt16.c
506daemon.o: $(HDRS) daemon.c
507dbfn.o: $(HDRS) dbfn.c
508debug.o: $(HDRS) debug.c
509deliver.o: $(HDRS) deliver.c
510directory.o: $(HDRS) directory.c
511dns.o: $(HDRS) dns.c
512enq.o: $(HDRS) enq.c
513exim.o: $(HDRS) exim.c
514expand.o: $(HDRS) expand.c
515filter.o: $(HDRS) filter.c
516filtertest.o: $(HDRS) filtertest.c
517globals.o: $(HDRS) globals.c
518header.o: $(HDRS) header.c
519host.o: $(HDRS) host.c
520ip.o: $(HDRS) ip.c
521log.o: $(HDRS) log.c
522lss.o: $(HDRS) lss.c
523match.o: $(HDRS) match.c
524moan.o: $(HDRS) moan.c
525os.o: $(HDRS) os.c
526parse.o: $(HDRS) parse.c
527queue.o: $(HDRS) queue.c
528rda.o: $(HDRS) rda.c
529readconf.o: $(HDRS) readconf.c
530receive.o: $(HDRS) receive.c
531retry.o: $(HDRS) retry.c
532rewrite.o: $(HDRS) rewrite.c
533rfc2047.o: $(HDRS) rfc2047.c
534route.o: $(HDRS) route.c
535search.o: $(HDRS) search.c
536sieve.o: $(HDRS) sieve.c
537smtp_in.o: $(HDRS) smtp_in.c
538smtp_out.o: $(HDRS) smtp_out.c
539spool_in.o: $(HDRS) spool_in.c
540spool_out.o: $(HDRS) spool_out.c
541store.o: $(HDRS) store.c
542string.o: $(HDRS) string.c
543tls.o: $(HDRS) tls.c tls-gnu.c tls-openssl.c
544tod.o: $(HDRS) tod.c
545transport.o: $(HDRS) transport.c
546tree.o: $(HDRS) tree.c
547verify.o: $(HDRS) verify.c
548
549# The module containing tables of available lookups, routers, auths, and
550# transports must be rebuilt if any of them are. However, because the makefiles
551# for the drivers are always run, we don't actually put the dependencies here,
552# because if we do, some version of "make" (e.g. IRIX) insist on rebuilding
553# drtables.o even though the .a files haven't in fact been updated. Instead
554# it is arranged that the lower-level makefiles remove drtables.o when they
555# rebuild the .a files.
556
557drtables.o: $(HDRS) drtables.c
558
559
560# The exim monitor's private modules - the sources live in a private
561# subdirectory. The final binary combines the private modules with some
562# modules from the main exim binary.
563
564em_StripChart.o: ../exim_monitor/em_StripChart.c
565em_TextPop.o: ../exim_monitor/em_TextPop.c
566em_globals.o: ../exim_monitor/em_globals.c ../exim_monitor/em_hdr.h
567em_init.o: ../exim_monitor/em_init.c ../exim_monitor/em_hdr.h
568em_log.o: ../exim_monitor/em_log.c ../exim_monitor/em_hdr.h
569em_main.o: ../exim_monitor/em_main.c ../exim_monitor/em_hdr.h
570em_menu.o: ../exim_monitor/em_menu.c ../exim_monitor/em_hdr.h
571em_queue.o: ../exim_monitor/em_queue.c ../exim_monitor/em_hdr.h
572em_strip.o: ../exim_monitor/em_strip.c ../exim_monitor/em_hdr.h
573em_text.o: ../exim_monitor/em_text.c ../exim_monitor/em_hdr.h
574em_xs.o: ../exim_monitor/em_xs.c ../exim_monitor/em_hdr.h
575em_version.o: ../exim_monitor/em_version.c ../exim_monitor/em_hdr.h
576$(MONBIN): $(HDRS)
577 $(CC) -o $@ -c $(CFLAGS) -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \
578 ../exim_monitor/`echo $@ | sed 's/o$$/c/'`
579
580
581# Targets for the various libraries that Exim uses. This coding is tedious,
582# because different versions of "make" behave in different ways with regard
583# to rebuilding. If these target names are of the form pcre/libpcre.a, for
584# example, then a forcing mechanism is required to get them obeyed each time.
585# That's fine on Solaris and other systems; the rebuilding of the exim target
586# happens only if the libraries are actually rebuilt. However, on IRIX, if
587# the target is forced, the exim target gets unnecessarily rebuilt even if
588# the .a file is not. Contrariwise, if we use dummy names, they don't interact
589# with the building of exim (and eximon.bin), but for libpcre Exim doesn't get
590# rebuilt when it should. (For the others it does, because they remove
591# drtables.o when they rebuild.) To get round this, we forcibly remove the
592# binary when it needs to be rebuilt.
593
594# The PCRE regex library. Move the pcretest program to the util directory. Some
595# "clever" versions of make notice that there are two successive shell
596# commands, and they run them in the same shell. This means that we have to
597# take care to encapsulate change of directory in parentheses, so that it
598# reverts when it should.
599
600buildpcre:
601 @(cd pcre; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" \
602 CFLAGS="$(CFLAGS) $(PCRE_CFLAGS)" \
603 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
604 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)")
605 @if $(SHELL) $(SCRIPTS)/newer pcre/libpcre.a exim; then \
606 rm -f exim eximon.bin; fi
607
608# The lookups library.
609
610buildlookups:
611 @cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
612 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
613 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \
614 echo " "
615
616# The routers library.
617
618buildrouters:
619 @cd routers; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
620 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
621 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
622 echo " "
623
624# The transports library.
625
626buildtransports:
627 @cd transports; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
628 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
629 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
630 echo " "
631
632# The library of authorization modules
633
634buildauths:
635 @cd auths; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
636 RANLIB="$(RANLIB)" HDRS="$(PHDRS)" \
637 INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
638 echo " "
639
640# The "clean", "install", and "makefile" targets just pass themselves back to
641# the main Exim makefile. These targets will be obeyed only if "make" is obeyed
642# for them in the build directory.
643
644clean install makefile:; cd ..; $(MAKE) $(MFLAGS) build=$(build) $@
645
646# Targets for building stand-alone testing programs for basic testing of
647# some of the building blocks. These are not integrated with the makefile-
648# building targets. If you change something that is going to cause the
649# makefile to be rebuilt, you must run "make makefile" before running one
650# of these.
651
652# The testing programs use different versions of some modules - usually
653# with bits cut out that are not relevant to the test in hand. For those
654# that are used by several tests, we use a different name.
655
656sa-globals.o: $(HDRS) globals.c
657 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -o sa-globals.o globals.c
658
659sa-os.o: $(HDRS) os.c
660 $(CC) -c $(CFLAGS) $(INCLUDE) \
661 -DFIND_RUNNING_INTERFACES \
662 -o sa-os.o os.c
663
664# These are the test targets themselves
665
666test_dbfn: config.h dbfn.c dummies.o sa-globals.o sa-os.o store.o \
667 string.o tod.o version.o
668 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c
669 $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \
670 dummies.o sa-globals.o sa-os.o store.o string.o \
671 tod.o version.o $(LIBS) $(DBMLIB)
672 rm -f dbfn.o
673
674test_host: config.h host.c dns.c dummies.o sa-globals.o sa-os.o store.o \
675 string.o tod.o tree.o
676 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST host.c
677 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dns.c
678 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST dummies.c
679 $(LNCC) -o test_host $(LFLAGS) \
680 host.o dns.o dummies.o sa-globals.o os.o store.o string.o tod.o tree.o \
681 $(LIBS) $(LIBRESOLV)
682 rm -f dummies.o host.o dns.o
683
684test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o
685 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE os.c
686 $(LNCC) -o test_os $(LFLAGS) os.o dummies.o \
687 sa-globals.o store.o string.o tod.o $(LIBS)
688 rm -f os.o
689
690test_parse: config.h parse.c dummies.o sa-globals.o \
691 store.o string.o tod.o version.o
692 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE parse.c
693 $(LNCC) -o test_parse $(LFLAGS) parse.o \
694 dummies.o sa-globals.o store.o string.o tod.o version.o
695 rm -f parse.o
696
697test_string: config.h string.c dummies.o sa-globals.o store.o tod.o
698 $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE string.c
699 $(LNCC) -o test_string $(LFLAGS) -DSTAND_ALONE string.o \
700 dummies.o sa-globals.o store.o tod.o $(LIBS)
701 rm -f string.o
702
703# End