[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)
Wed, 16 Dec 2009 13:26:44 +0000
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:126.96.36.199pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Thunderbird/3.0b4
On 07/12/09 11:01, 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
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
It sounds like you've got a two-pass system: the first pass generates
the dependencies, the second pass builds it.
A better way is to generate the dependencies while compiling (-MD gcc
option, other compilers have a similar option), so that make completes
in one pass. When there are no dependencies everything gets built, when
there are dependencies generated by the previous build it only rebuilds
what has changed since the previous build.