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