|
From: | Maxim Yegorushkin |
Subject: | Re: Running a command always but only once (even if included Makefiles are remade) |
Date: | Wed, 16 Dec 2009 13:26:44 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Thunderbird/3.0b4 |
On 07/12/09 11:01, Christoph Groth wrote:
Hello, 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.
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.
-- Max
[Prev in Thread] | Current Thread | [Next in Thread] |