Subject: Re: F'up: /etc/rc.d/sendmail weirdness: more info
To: None <fredb@NetBSD.org>
From: Andrew Brown <atatat@atatdot.net>
List: current-users
Date: 08/29/2004 23:24:14
On Sun, Aug 29, 2004 at 01:06:57PM -0500, Frederick Bruckman wrote:
>[...]
>sendmail.cf: MAIL.IMMANENT.NET.mc
> cp -p sendmail.cf sendmail.cf.old
> ${M4} ${.ALLSRC} > sendmail.cf
>
>submit.cf: SUBMIT.mc
> cp -p submit.cf submit.cf.old
> ${M4} ${.ALLSRC} > submit.cf
>
>
>Season to taste. Note, you have to add
>
>
>define(`_CF_DIR_', `/usr/share/sendmail/')
>include(`/usr/share/sendmail/m4/cf.m4')
>
>
>to the top of your MC file to permit it to build anywhere, as the
>default is to take "_CF_DIR_" as the current working directory.
no, you don't. all you have to do is specify the full path to cf.m4
(eg /usr/share/sendmail/m4/cf.m4) on the m4 line, like so:
sendmail.cf: MAIL.IMMANENT.NET.mc
cp -p sendmail.cf sendmail.cf.old
${M4} /usr/share/sendmail/m4/cf.m4 ${.ALLSRC} > sendmail.cf
and the m4 "magic" in cf.m4 will figure out where _CF_DIR_ is. :)
as an aside (more seasoning), i'd suggest using install ("install -B"
actually) instead of cp there. then you get backups made each time
you rebuild instead of just the one in .old. eg:
M4?= m4
RM?= rm -f
CFDIR?= /usr/share/sendmail
CHMOD?= chmod
ROMODE?= 444
DATE!= date +%Y%m%d
.SUFFIXES: .cf .mc
.mc.cf:
[ ! -f $@ ] || ${INSTALL} -m${ROMODE} -cB.%02d $@ $@.${DATE}
${RM} $@
${M4} ${CFDIR}/m4/cf.m4 ${.CURDIR}/${@:R}.mc > $@
${CHMOD} ${ROMODE} $@
.PHONY: all
all:
that gives me this:
# cd /etc/mail
# for i in 1 2 3; do sleep 1; touch foo.mc; make foo.cf; done
[output elided]
# ls foo.cf*
foo.cf foo.cf.20040829.00
foo.cf.20040829 foo.cf.20040829.01
adding implicit dependencies on the other files under ${CFDIR}
shouldn't be too hard either, and would be a good idea, since after
you update you probably want to rebuild your cf.
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
werdna@squooshy.com * "information is power -- share the wealth."