aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/bin/init.cxx19
-rw-r--r--libbuild2/bin/rule.cxx18
-rw-r--r--libbuild2/bin/rule.hxx23
3 files changed, 44 insertions, 16 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index 6d2d2c2..ff00e89 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -29,7 +29,8 @@ namespace build2
{
namespace bin
{
- static const fail_rule fail_;
+ static const obj_rule obj_;
+ static const libul_rule libul_;
static const lib_rule lib_;
// Default config.bin.*.lib values.
@@ -563,17 +564,17 @@ namespace build2
{
auto& r (bs.rules);
- r.insert<obj> (perform_update_id, "bin.obj", fail_);
- r.insert<obj> (perform_clean_id, "bin.obj", fail_);
+ r.insert<obj> (perform_update_id, "bin.obj", obj_);
+ r.insert<obj> (perform_clean_id, "bin.obj", obj_);
- r.insert<bmi> (perform_update_id, "bin.bmi", fail_);
- r.insert<bmi> (perform_clean_id, "bin.bmi", fail_);
+ r.insert<bmi> (perform_update_id, "bin.bmi", obj_);
+ r.insert<bmi> (perform_clean_id, "bin.bmi", obj_);
- r.insert<hbmi> (perform_update_id, "bin.hbmi", fail_);
- r.insert<hbmi> (perform_clean_id, "bin.hbmi", fail_);
+ r.insert<hbmi> (perform_update_id, "bin.hbmi", obj_);
+ r.insert<hbmi> (perform_clean_id, "bin.hbmi", obj_);
- r.insert<libul> (perform_update_id, "bin.libul", fail_);
- r.insert<libul> (perform_clean_id, "bin.libul", fail_);
+ r.insert<libul> (perform_update_id, "bin.libul", libul_);
+ r.insert<libul> (perform_clean_id, "bin.libul", libul_);
// Similar to alias.
//
diff --git a/libbuild2/bin/rule.cxx b/libbuild2/bin/rule.cxx
index 0abfcb5..021a768 100644
--- a/libbuild2/bin/rule.cxx
+++ b/libbuild2/bin/rule.cxx
@@ -17,9 +17,9 @@ namespace build2
{
namespace bin
{
- // fail_rule
+ // obj_rule
//
- bool fail_rule::
+ bool obj_rule::
match (action a, target& t, const string&) const
{
const char* n (t.dynamic_type ().name); // Ignore derived type.
@@ -29,7 +29,19 @@ namespace build2
<< n << "s{} member" << endf;
}
- recipe fail_rule::
+ recipe obj_rule::
+ apply (action, target&) const {return empty_recipe;}
+
+ // libul_rule
+ //
+ bool libul_rule::
+ match (action a, target& t, const string&) const
+ {
+ fail << diag_doing (a, t) << " target group" <<
+ info << "explicitly select libua{} or libus{} member" << endf;
+ }
+
+ recipe libul_rule::
apply (action, target&) const {return empty_recipe;}
// lib_rule
diff --git a/libbuild2/bin/rule.hxx b/libbuild2/bin/rule.hxx
index 51693a7..ffb975d 100644
--- a/libbuild2/bin/rule.hxx
+++ b/libbuild2/bin/rule.hxx
@@ -15,13 +15,28 @@ namespace build2
{
namespace bin
{
- // "Fail rule" for obj{}, [h]bmi{}, and libu{} that issues diagnostics if
- // someone tries to build any of these groups directly.
+ // "Fail rule" for obj{} and [h]bmi{} that issues diagnostics if someone
+ // tries to build these groups directly.
//
- class fail_rule: public simple_rule
+ class obj_rule: public simple_rule
{
public:
- fail_rule () {}
+ obj_rule () {}
+
+ virtual bool
+ match (action, target&, const string&) const override;
+
+ virtual recipe
+ apply (action, target&) const override;
+ };
+
+ // "Fail rule" for libul{} that issues diagnostics if someone tries to
+ // build this group directly.
+ //
+ class libul_rule: public simple_rule
+ {
+ public:
+ libul_rule () {}
virtual bool
match (action, target&, const string&) const override;