aboutsummaryrefslogtreecommitdiff
path: root/build2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-28 09:44:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-28 09:44:15 +0200
commit3cc5e3bd441fc9d18fece3d9e99fae75c78438e7 (patch)
treea9a08c453370847e0d352d47e19fbfcb7cc757ef /build2/target.hxx
parentc0f72d47fc25981dcc1f55e12dfa0fdba7b70242 (diff)
Implement support for excluded and ad hoc prerequisites
The inclusion/exclusion is controlled via the 'include' prerequisite-specific variable. Valid values are: false - exclude true - include adhoc - include but treat as an ad hoc input For example: lib{foo}: cxx{win32-utility}: include = ($cxx.targe.class == 'windows') exe{bar}: libs{plugin}: include = adhoc
Diffstat (limited to 'build2/target.hxx')
-rw-r--r--build2/target.hxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/build2/target.hxx b/build2/target.hxx
index 761cb4e..515a082 100644
--- a/build2/target.hxx
+++ b/build2/target.hxx
@@ -15,8 +15,8 @@
#include <build2/utility.hxx>
#include <build2/scope.hxx>
+#include <build2/action.hxx>
#include <build2/variable.hxx>
-#include <build2/operation.hxx>
#include <build2/target-key.hxx>
#include <build2/target-type.hxx>
#include <build2/target-state.hxx>
@@ -92,14 +92,18 @@ namespace build2
{
using target_type = build2::target;
- prerequisite_target (const target_type* t, uintptr_t d = 0)
- : target (t), data (d) {}
+ prerequisite_target (const target_type* t, bool a = false, uintptr_t d = 0)
+ : target (t), adhoc (a), data (d) {}
+
+ prerequisite_target (const target_type* t, include_type a, uintptr_t d = 0)
+ : prerequisite_target (t, a == include_type::adhoc, d) {}
operator const target_type*& () {return target;}
operator const target_type* () const {return target;}
const target_type* operator-> () const {return target;}
const target_type* target;
+ bool adhoc; // True if include=adhoc.
uintptr_t data;
};
using prerequisite_targets = vector<prerequisite_target>;
@@ -932,6 +936,12 @@ namespace build2
return os << pm.key ();
}
+ inline include_type
+ include (action a, const target& t, const prerequisite_member& pm)
+ {
+ return include (a, t, pm.prerequisite, pm.member);
+ }
+
// A "range" that presents a sequence of prerequisites (e.g., from
// group_prerequisites()) as a sequence of prerequisite_member's. For each
// group prerequisite you will "see" either the prerequisite itself or all