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