Makefiles: run something before and after a target

Ala Qumsieh <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization SBC http://yahoo.sbc.com
Message-ID <[email protected]>
Hi,

I have a huge Makefile with dozens of targets. I would like to be able to
run something (a script, shell command, another target) before *and* after
each target, that will gather basic data like when the target was started,
when it finished, how long it took, and other things. Now, of course I can
go in the Makefile, and modify each target to do what I want, but I'm
hoping there is an easier way.

It turns out that using MAKELEVEL allows me to run a something before each
toplevel target. Something like:

ifeq (0,$(MAKELEVEL))
  $(shell echo '*** pre make' 1>&2)
endif

is there something similar to run a shell command at the end of each target?

Thanks,
--Ala
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.