diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-21 15:51:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-21 15:51:54 +0200 |
commit | 4be404cd8b7f4c7b450364defea92cd02e9b7a62 (patch) | |
tree | f8f0aac622dfd9d30d1900b958ecea9505265502 /build/operation | |
parent | 10604d850510e46b2ee625548abe5eb9a1172a0d (diff) |
Improve nested operations support
The idea is this: we need to be able to override "conditional, inner
for outer" recipes with the "unconditional inner" ones. Here is the
concrete scenario: we have {update, test} action and the lib{} target
that is both mentioned as a prerequisite of ./ and exe{}, which is a
test. At first, we want to ignore lib{} when reached as a prerequisite
of ./. But then we get to it via exe{} (which is a test and thus should
be updated). At this point we should override the recipe for lib{} with
the one that would update it rather than ignore.
Diffstat (limited to 'build/operation')
-rw-r--r-- | build/operation | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/build/operation b/build/operation index 75d6526..6fde9fd 100644 --- a/build/operation +++ b/build/operation @@ -79,6 +79,19 @@ namespace build action_id outer_id; }; + // This is an "overrides" comparison, i.e., it returns true + // if the recipe for x overrides recipe for y. The idea is + // that for the same inner operation, action with an outer + // operation is "weaker" than the one without. + // + inline bool + operator> (action x, action y) + { + return x.inner_id != y.inner_id || + (x.outer_id != y.outer_id && y.outer_id != 0); + } + + /* inline bool operator== (action x, action y) { @@ -87,6 +100,7 @@ namespace build inline bool operator!= (action x, action y) {return !(x == y);} + */ std::ostream& operator<< (std::ostream&, action); |