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