aboutsummaryrefslogtreecommitdiff
path: root/build2/bin
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-04-11 14:44:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-04-30 16:56:08 +0200
commita14b9bc18431c6aed8441261d28b6ff20bd25935 (patch)
treeae1f07caef838b5b03fa3f82a2cfccbb62b24ed3 /build2/bin
parentca0f9c71be279aee845bf5328ac0af8c02c8849e (diff)
Initial take on header unit and include translation support
Diffstat (limited to 'build2/bin')
-rw-r--r--build2/bin/init.cxx8
-rw-r--r--build2/bin/rule.hxx2
-rw-r--r--build2/bin/target.cxx69
-rw-r--r--build2/bin/target.hxx58
4 files changed, 133 insertions, 4 deletions
diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx
index f334769..26364b4 100644
--- a/build2/bin/init.cxx
+++ b/build2/bin/init.cxx
@@ -434,6 +434,11 @@ namespace build2
t.insert<bmia> ();
t.insert<bmis> ();
+ t.insert<hbmi> ();
+ t.insert<hbmie> ();
+ t.insert<hbmia> ();
+ t.insert<hbmis> ();
+
t.insert<libu> ();
t.insert<libul> ();
t.insert<libue> ();
@@ -508,6 +513,9 @@ namespace build2
r.insert<bmi> (perform_update_id, "bin.bmi", fail_);
r.insert<bmi> (perform_clean_id, "bin.bmi", fail_);
+ r.insert<hbmi> (perform_update_id, "bin.hbmi", fail_);
+ r.insert<hbmi> (perform_clean_id, "bin.hbmi", fail_);
+
r.insert<libu> (perform_update_id, "bin.libu", fail_);
r.insert<libu> (perform_clean_id, "bin.libu", fail_);
diff --git a/build2/bin/rule.hxx b/build2/bin/rule.hxx
index 471c901..19902c9 100644
--- a/build2/bin/rule.hxx
+++ b/build2/bin/rule.hxx
@@ -14,7 +14,7 @@ namespace build2
{
namespace bin
{
- // "Fail rule" for obj{}, bmi{}, and libu{} that issues diagnostics if
+ // "Fail rule" for obj{}, [h]bmi{}, and libu{} that issues diagnostics if
// someone tries to build any of these groups directly.
//
class fail_rule: public rule
diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx
index 8ff2f97..c602f3b 100644
--- a/build2/bin/target.cxx
+++ b/build2/bin/target.cxx
@@ -38,6 +38,19 @@ namespace build2
false
};
+ const target_type hbmix::static_type
+ {
+ "hbmix",
+ &bmix::static_type,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ &target_search,
+ false
+ };
+
const target_type libx::static_type
{
"libx",
@@ -71,7 +84,7 @@ namespace build2
// running serial. For the members it is also safe to set the group during
// creation.
- // obj*{} and bmi*{} member factory.
+ // obj*{} and [h]bmi*{} member factory.
//
template <typename M, typename G>
static target*
@@ -111,6 +124,19 @@ namespace build2
false
};
+ const target_type hbmie::static_type
+ {
+ "hbmie",
+ &hbmix::static_type,
+ &m_factory<hbmie, hbmi>,
+ nullptr, /* fixed_extension */
+ &target_extension_var<var_extension, nullptr>,
+ &target_pattern_var<var_extension, nullptr>,
+ nullptr,
+ &target_search, // Note: not _file(); don't look for an existing file.
+ false
+ };
+
const target_type obja::static_type
{
"obja",
@@ -137,6 +163,19 @@ namespace build2
false
};
+ const target_type hbmia::static_type
+ {
+ "hbmia",
+ &hbmix::static_type,
+ &m_factory<hbmia, hbmi>,
+ nullptr, /* fixed_extension */
+ &target_extension_var<var_extension, nullptr>,
+ &target_pattern_var<var_extension, nullptr>,
+ nullptr,
+ &target_search, // Note: not _file(); don't look for an existing file.
+ false
+ };
+
const target_type objs::static_type
{
"objs",
@@ -163,6 +202,19 @@ namespace build2
false
};
+ const target_type hbmis::static_type
+ {
+ "hbmis",
+ &hbmix::static_type,
+ &m_factory<hbmis, hbmi>,
+ nullptr, /* fixed_extension */
+ &target_extension_var<var_extension, nullptr>,
+ &target_pattern_var<var_extension, nullptr>,
+ nullptr,
+ &target_search, // Note: not _file(); don't look for an existing file.
+ false
+ };
+
// libu*{} member factory.
//
template <typename M>
@@ -224,7 +276,7 @@ namespace build2
false
};
- // obj{}, bmi{}, and libu{} group factory.
+ // obj{}, [h]bmi{}, and libu{} group factory.
//
template <typename G, typename E, typename A, typename S>
static target*
@@ -277,6 +329,19 @@ namespace build2
false
};
+ const target_type hbmi::static_type
+ {
+ "hbmi",
+ &target::static_type,
+ &g_factory<hbmi, hbmie, hbmia, hbmis>,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ &target_search,
+ false
+ };
+
// The same as g_factory() but without E.
//
static target*
diff --git a/build2/bin/target.hxx b/build2/bin/target.hxx
index 42295d0..1430477 100644
--- a/build2/bin/target.hxx
+++ b/build2/bin/target.hxx
@@ -65,7 +65,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- // Binary module interface.
+ // Binary module interface (BMI).
//
// While currently there are only C++ modules, if things pan out, chances
// are we will have C (or Obj-C) modules. And in that case it is plausible
@@ -86,6 +86,12 @@ namespace build2
// organization. So, at least for now, we produce the two at the same time
// and make obj*{} an ad hoc member of bmi*{}.
//
+ // There are also header units for which we define a parallel hbmi*{}
+ // hierarchy. Note that hbmix{} is-a bmix{} (we think of header BMIs as a
+ // more specialized kind of BMI) so where you need to distinguish between
+ // header and module BMIs, you should check for headers first. Note also
+ // that in case of a header unit there may be no obj*{}.
+ //
class bmix: public file // Common base of all bmiX{} interface files.
{
public:
@@ -95,6 +101,15 @@ namespace build2
static const target_type static_type;
};
+ class hbmix: public bmix // Common base of all hbmiX{} interface files.
+ {
+ public:
+ using bmix::bmix;
+
+ public:
+ static const target_type static_type;
+ };
+
class bmie: public bmix
{
public:
@@ -105,6 +120,16 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
+ class hbmie: public hbmix
+ {
+ public:
+ using hbmix::hbmix;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
+
class bmia: public bmix
{
public:
@@ -115,6 +140,16 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
+ class hbmia: public hbmix
+ {
+ public:
+ using hbmix::hbmix;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
+
class bmis: public bmix
{
public:
@@ -125,6 +160,16 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
+ class hbmis: public hbmix
+ {
+ public:
+ using hbmix::hbmix;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
+
class bmi: public target
{
public:
@@ -135,6 +180,17 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
+ class hbmi: public target
+ {
+ public:
+ using target::target;
+
+ public:
+ static const target_type static_type;
+ virtual const target_type& dynamic_type () const {return static_type;}
+ };
+
+
// Common base for lib{} and libul{}/libu{} groups.
//
// We use mtime_target as a base for the "trust me it exists" functionality