<div dir="ltr">Hello.
<div><br></div><div>I'm trying something I don't think is unreasonable.</div><div><br></div><div>I need to have an automatically generated file, let's say version.h</div><div><br></div><div>I have to run a custom command to generate it.</div><div><br></div><div>The contents of the file depend on some external forces, the custom command m</div><div>ay or may not change it (but it will always generate it if it is there).</div><div><br></div><div>That header is then included in bunch of other files, creating multiple </div><div>targets</div><div><br></div><div>So, I created a custom command that has declared output of version.h, and </div><div>have version.h included as sources for other (multiple) targets. This worked,</div><div>but, of course, if the version.h is already there, the command wouldn't run.</div><div><br></div><div>I couldn't find any way to force the command to run, so after reading this</div><div>SO post: <a href="https://stackoverflow.com/questions/13920072">https://stackoverflow.com/questions/13920072</a>, I added a PHONY output</div><div>to the command, and dependency to the targets. This forced the command to</div><div>run every time.</div><div><br></div><div>However, when the command runs, but doesn't change the output file, there is</div><div>some target that forces the file to be updated (the touch_nocreate). This</div><div>causes the targets to both recompile and relink for no reason.</div><div><br></div><div>Questions:</div><div>1) Can I make a custom command run every time, even if its target is present</div><div>(without creating a PHONY target)? I don't want the </div><div>2) Can I turn the touching off?</div><div><br></div><div>I don't think using TARGET based custom command is right, as it's a pre-build</div><div>target activity, and such is not supported for !VS.</div><div><br></div><div>I don't think using an ALL custom target is right, because custom target has</div><div>no output files, and target-to-target dependency wouldn't correctly determine</div><div>that I need that .h file in time.</div><div><br></div><div>I would love to know what's the point of touch_no_create, really, I can't</div><div>imagine a good reason the file is refreshed when it wasn't touched, it seems</div><div>that the point would be to "cheat" the dependency resolution that way, which</div><div>may have valid use cases, but as a forced default?</div><div><br></div><div>Thank you,</div><div>  Pawel.</div><div><br></div></div>