[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New feature: Post-requisites
Alejandro Colomar (man-pages)
Re: New feature: Post-requisites
Sun, 31 Jul 2022 11:45:38 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1
On 7/30/22 19:01, Paul Smith wrote:
On Mon, 2022-07-25 at 09:06 +0000, Edward Welbourne wrote:
On 7/22/22 16:20, Paul Smith wrote:
So, after all the "normal" goal targets were completed make would
proceed to run any "extra" goal targets that were added as part
of the processing of the "normal" goal targets. Then after the
those "extra" goal targets were complete, make would proceed to
run any "new extra" goal targets that were added as part of THAT
How would any new targets be added ? Surely make's dependency graph
would ensure that you know what you'll be building before you start,
regardless of whether it's a prerequisite or a postrequisite.
I think I wasn't clear. I wasn't suggesting that "post-requisites"
would be represented in the dependency graph in any way at all.
When make runs it basically does this: it first generates the DAG.
Then it has a list of one or more goal targets (either the default
target or one or more targets from the command line) and make starts
walking the DAG using each of these goal targets in turn as the
starting node. This behavior is already well-understood.
What I'm suggesting is that "post-requisites" simply be added to the
end of the list of goal targets, as they are encountered while walking
So if you ran "make foo" and some target that was processed during the
walk of the DAG to build "foo" had a post-requisite of "bar", then
after "foo" was built make would try to build "bar". It would be
essentially exactly the same as if the user had invoked "make foo bar".
If some new post-requisite "baz" was found while building either "foo"
or "bar", it would be built after those and be as if the user had
invoked "make foo bar baz".
What if one runs `make -j foo foo2` and both foo and foo2 have a
post-requisite of bar? `make -j foo foo2 bar` doesn't guarantee that
bar will be started after foo2 ends, but this feature would need such a
Etc. If a target was not encountered during the walk, then of course
its post-requisites would not be added to the set of goal targets.
Indeed - for example, if a target is specified *both* as a
prerequisite of some target that does get built *and* as a
postrequisite of some rule we do exercise, it has to be built both
before and after, which violates the "only build once" rule above.
No. It would be built before as a prerequisite, then when it was
attempted to be built after it would be skipped because it was already
Makes sense for now. It would be rare to make a post-requisite target
be also a pre-requisite. I'm not sure I can think of a use case for that.
That is _exactly_ the kind situation I was referring to by my statement
about "only build things once".
In other words, a target "foo" with a post-requisite "bar" does NOT say
that make will guarantee that "bar" is always built after "foo". What
it ensures is that if "foo" is built, then "bar" will also be tried
It's possible that make could be taught to detect a situation like
foo: bar <post> baz
and give an error. But I'd have to play with it to determine how much
work it would be to catch that.
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/
Re: New feature: Post-requisites, Edward Welbourne, 2022/07/25
- New feature: Post-requisites, (continued)