[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Running a command always but only once (even if included Makefiles a
Re: Running a command always but only once (even if included Makefiles are remade)
Mon, 7 Dec 2009 10:20:09 -0500
On Mon, 2009-12-07 at 12:01 +0100, Christoph Groth wrote:
> in the Makefile of my project I would like to always run (before
> everything else) a command which updates the submodules of the project.
> I do this by having the line
> $(shell to-be-run)
> somewhere in the Makefile.
> However, when the automatically generated dependencies are re-generated,
> which happens every time some source file has been changed, the Makefile
> is re-initialized. As a consequence, `to-be-run' is executed a second
> I wonder how to tell GNU make to execute a command always, but only
> once, even if some of the included Makefiles are re-generated.
You can check the make variable MAKE_RESTARTS; if it's set then make has
been restarted (due to makefiles being regenerated). So, something like
this should do what you want: