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 > time. > > 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: ifndef MAKE_RESTARTS $(shell to-b-run) endif (untested) _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
