From 8d1735e04faadaa6765c71b12a96188e6d56c9fa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 14 Feb 2018 12:27:11 +0200 Subject: Don't ignore objX{} and bmiX{} prerequisites in cc::link_rule --- build2/bin/target.cxx | 38 ++++++++++++++++++++++++++++++++------ build2/bin/target.hxx | 38 ++++++++++++++++++++++++++++---------- build2/cc/compile-rule.cxx | 6 ++---- build2/cc/link-rule.cxx | 30 ++++++++++++++---------------- build2/cc/pkgconfig.cxx | 5 +---- 5 files changed, 77 insertions(+), 40 deletions(-) diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx index 2bcb8bc..06b3211 100644 --- a/build2/bin/target.cxx +++ b/build2/bin/target.cxx @@ -12,6 +12,32 @@ namespace build2 { namespace bin { + const target_type objx::static_type + { + "objx", + &file::static_type, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + &target_search, + false + }; + + const target_type bmix::static_type + { + "bmix", + &file::static_type, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + &target_search, + false + }; + const target_type libx::static_type { "libx", @@ -62,7 +88,7 @@ namespace build2 const target_type obje::static_type { "obje", - &file::static_type, + &objx::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, @@ -75,7 +101,7 @@ namespace build2 const target_type bmie::static_type { "bmie", - &file::static_type, + &bmix::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, @@ -101,7 +127,7 @@ namespace build2 const target_type obja::static_type { "obja", - &file::static_type, + &objx::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, @@ -114,7 +140,7 @@ namespace build2 const target_type bmia::static_type { "bmia", - &file::static_type, + &bmix::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, @@ -140,7 +166,7 @@ namespace build2 const target_type objs::static_type { "objs", - &file::static_type, + &objx::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, @@ -153,7 +179,7 @@ namespace build2 const target_type bmis::static_type { "bmis", - &file::static_type, + &bmix::static_type, &m_factory, nullptr, /* fixed_extension */ &target_extension_var, diff --git a/build2/bin/target.hxx b/build2/bin/target.hxx index 329b4a9..f052f22 100644 --- a/build2/bin/target.hxx +++ b/build2/bin/target.hxx @@ -16,30 +16,39 @@ namespace build2 { // The obj{} target group. // - class obje: public file + class objx: public file // Common base of all objX{} object files. { public: using file::file; public: static const target_type static_type; + }; + + class obje: public objx + { + public: + using objx::objx; + + public: + static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; - class obja: public file + class obja: public objx { public: - using file::file; + using objx::objx; public: static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; - class objs: public file + class objs: public objx { public: - using file::file; + using objx::objx; public: static const target_type static_type; @@ -77,30 +86,39 @@ 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*{}. // - class bmie: public file + class bmix: public file // Common base of all bmiX{} interface files. { public: using file::file; public: static const target_type static_type; + }; + + class bmie: public bmix + { + public: + using bmix::bmix; + + public: + static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; - class bmia: public file + class bmia: public bmix { public: - using file::file; + using bmix::bmix; public: static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; - class bmis: public file + class bmis: public bmix { public: - using file::file; + using bmix::bmix; public: static const target_type static_type; diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index 1e1d45d..a6d2d48 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -221,7 +221,7 @@ namespace build2 { tracer trace (x, "compile_rule::match"); - bool mod (t.is_a () || t.is_a () || t.is_a ()); + bool mod (t.is_a ()); // Link-up to our group (this is the obj/bmi{} target group protocol // which means this can be done whether we match or not). @@ -3481,9 +3481,7 @@ namespace build2 // @@ UTL: we need to (recursively) see through libux{} (and // also in pkgconfig_save()). // - if (bt->is_a () || - bt->is_a () || - bt->is_a ()) + if (bt->is_a ()) { const string& n (cast (bt->vars[c_module_name])); diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index cd355c6..c59597a 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -630,12 +630,15 @@ namespace build2 // else { - // @@ Temporary hack until we get the default outer operation for - // update. This allows operations like test and install to skip - // such tacked on stuff. - // - if (current_outer_oif != nullptr) - continue; + if (!p.is_a () && !p.is_a ()) + { + // @@ Temporary hack until we get the default outer operation + // for update. This allows operations like test and install to + // skip such tacked on stuff. + // + if (current_outer_oif != nullptr) + continue; + } pt = &p.search (t); } @@ -792,8 +795,7 @@ namespace build2 if (p1.is_a () || p1.is_a () || p1.is_a () || p1.is_a () || p1.is_a () || - p1.is_a () || - p1.is_a () || p1.is_a () || p1.is_a () || + p1.is_a () || p1.is_a () || (p.is_a (mod ? *x_mod : x_src) && x_header (p1)) || (p.is_a () && p1.is_a ())) continue; @@ -1555,16 +1557,14 @@ namespace build2 // if (modules) { - if (pt->is_a () || pt->is_a () || pt->is_a ()) + if (pt->is_a ()) pt = pt->member; } const file* f; bool la (false), ls (false); - if ((f = pt->is_a ()) || - (f = pt->is_a ()) || - (f = pt->is_a ()) || + if ((f = pt->is_a ()) || (!lt.static_library () && // @@ UTL: TODO libua to liba link. ((la = (f = pt->is_a ())) || (la = (f = pt->is_a ())) || @@ -1841,16 +1841,14 @@ namespace build2 if (modules) { - if (pt->is_a () || pt->is_a () || pt->is_a ()) + if (pt->is_a ()) pt = pt->member; } const file* f; bool la (false), ls (false); - if ((f = pt->is_a ()) || - (f = pt->is_a ()) || - (f = pt->is_a ()) || + if ((f = pt->is_a ()) || (!lt.static_library () && // @@ UTL: TODO libua to liba link. ((la = (f = pt->is_a ())) || (la = (f = pt->is_a ())) || diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index 697a60e..9d52db9 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -1345,10 +1345,7 @@ namespace build2 // @@ UTL: we need to (recursively) see through libux{} (and // also in search_modules()). // - if (pt != nullptr && - (pt->is_a () || - pt->is_a () || - pt->is_a ())) + if (pt != nullptr && pt->is_a ()) { // What we have is a binary module interface. What we need is // a module interface source it was built from. We assume it's -- cgit v1.1