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