OT: how to get make to run a script before each build
Mel
fbsd.questions at rachie.is-a-geek.net
Wed Mar 12 00:46:16 UTC 2008
On Wednesday 12 March 2008 01:15:52 Steve Franks wrote:
> I'd like to keep track of how many times I've run make for a given
> source. I'm sure someone knows how to get make to run a script before
> doing anything else, but using the regular build rules (aka. only if a
> source file has changed). Of course typing any permutation of this
> question into google gives me 10^life of universe in microseconds
> hits.
mysource.c.o:
count=`cat /var/db/makecounter.${.IMPSRC}`
count=$$(($$count+1))
echo $$count >/var/db/makecounter.${.IMPSRC}
${CC} ${CFLAGS} -c ${.IMPSRC}
or something to that effect, key being, change/override the compilation rule
for your specific or all files.
Default single/double suffix rules are in /usr/share/mk/sys.mk.
--
Mel
Problem with today's modular software: they start with the modules
and never get to the software part.
More information about the freebsd-questions
mailing list