From a14b9bc18431c6aed8441261d28b6ff20bd25935 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Apr 2019 14:44:32 +0200 Subject: Initial take on header unit and include translation support --- build2/bin/init.cxx | 8 ++++++ build2/bin/rule.hxx | 2 +- build2/bin/target.cxx | 69 +++++++++++++++++++++++++++++++++++++++++++++++++-- build2/bin/target.hxx | 58 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 133 insertions(+), 4 deletions(-) (limited to 'build2/bin') 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 (); t.insert (); + t.insert (); + t.insert (); + t.insert (); + t.insert (); + t.insert (); t.insert (); t.insert (); @@ -508,6 +513,9 @@ namespace build2 r.insert (perform_update_id, "bin.bmi", fail_); r.insert (perform_clean_id, "bin.bmi", fail_); + r.insert (perform_update_id, "bin.hbmi", fail_); + r.insert (perform_clean_id, "bin.hbmi", fail_); + r.insert (perform_update_id, "bin.libu", fail_); r.insert (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 static target* @@ -111,6 +124,19 @@ namespace build2 false }; + const target_type hbmie::static_type + { + "hbmie", + &hbmix::static_type, + &m_factory, + nullptr, /* fixed_extension */ + &target_extension_var, + &target_pattern_var, + 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, + nullptr, /* fixed_extension */ + &target_extension_var, + &target_pattern_var, + 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, + nullptr, /* fixed_extension */ + &target_extension_var, + &target_pattern_var, + nullptr, + &target_search, // Note: not _file(); don't look for an existing file. + false + }; + // libu*{} member factory. // template @@ -224,7 +276,7 @@ namespace build2 false }; - // obj{}, bmi{}, and libu{} group factory. + // obj{}, [h]bmi{}, and libu{} group factory. // template static target* @@ -277,6 +329,19 @@ namespace build2 false }; + const target_type hbmi::static_type + { + "hbmi", + &target::static_type, + &g_factory, + 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 -- cgit v1.1