From ee0456ed4a5f3f6686fbb0a433161d1f9d8535fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 4 Jul 2019 07:30:23 +0200 Subject: Remove libu{} target group The semantics provided by libu{} is rarely required and as result was not yet documented. However, if you are using it, the new way to achieve the same result is to use both libue{} and libul{} explicitly, for example: exe{foo}: libue{foo} lib{foo}: libul{foo} {libue libul}{foo}: cxx{*} --- build2/bin/init.cxx | 5 ++--- build2/bin/target.cxx | 32 ++++++-------------------------- build2/bin/target.hxx | 27 ++++++++++++++++++--------- 3 files changed, 26 insertions(+), 38 deletions(-) (limited to 'build2/bin') diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 37fad6b..5932b29 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -439,7 +439,9 @@ namespace build2 t.insert (); t.insert (); +#if 0 t.insert (); +#endif t.insert (); t.insert (); t.insert (); @@ -516,9 +518,6 @@ namespace build2 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_); - r.insert (perform_update_id, "bin.libul", fail_); r.insert (perform_clean_id, "bin.libul", fail_); diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx index 46f19bd..7c16506 100644 --- a/build2/bin/target.cxx +++ b/build2/bin/target.cxx @@ -215,33 +215,11 @@ namespace build2 false }; - // libu*{} member factory. - // - template - static target* - libux_factory (const target_type&, dir_path dir, dir_path out, string n) - { - const target* g (targets.find (dir, out, n)); - - if (const target* g2 = targets.find (dir, out, n)) - { - if (g != 0) - fail << "both " << *g << " and " << *g2 << " targets declared"; - - g = g2; - } - - M* m (new M (move (dir), move (out), move (n))); - m->group = g; - - return m; - } - const target_type libue::static_type { "libue", &libux::static_type, - &libux_factory, + &target_factory, nullptr, /* fixed_extension */ &target_extension_var, &target_pattern_var, @@ -254,7 +232,7 @@ namespace build2 { "libua", &libux::static_type, - &libux_factory, + &m_factory, nullptr, /* fixed_extension */ &target_extension_var, &target_pattern_var, @@ -267,7 +245,7 @@ namespace build2 { "libus", &libux::static_type, - &libux_factory, + &m_factory, nullptr, /* fixed_extension */ &target_extension_var, &target_pattern_var, @@ -375,11 +353,12 @@ namespace build2 false }; +#if 0 const target_type libu::static_type { "libu", &libx::static_type, - &g_factory, + &target_factory, nullptr, nullptr, nullptr, @@ -387,6 +366,7 @@ namespace build2 &target_search, false }; +#endif // What extensions should we use? At the outset, this is platform- // dependent. And if we consider cross-compilation, is it build or diff --git a/build2/bin/target.hxx b/build2/bin/target.hxx index a56c636..12065bf 100644 --- a/build2/bin/target.hxx +++ b/build2/bin/target.hxx @@ -191,7 +191,7 @@ namespace build2 }; - // Common base for lib{} and libul{}/libu{} groups. + // Common base for lib{} and libul{} groups. // // We use mtime_target as a base for the "trust me it exists" functionality // which we use, for example, to have installed lib{} prerequisites that @@ -206,20 +206,27 @@ namespace build2 static const target_type static_type; }; - // The libul{}/libu{} target groups (utility library). + // The libue{} target, libul{} group and libua{} and libus{} members + // (utility library). // - // All the members are static libraries that differ based on the kind of - // object files they contains. Note that the group is more like obj{} - // rather than lib{} in that one does not build the group directly rather - // picking a suitable member. + // Utility libraries are static libraries that differ based on the kind of + // object files they contains. Note that the libul{} group is more like + // obj{} rather than lib{} in that one does not build the group directly + // rather picking a suitable member. // // libul{} is a "library utility library" in that the choice of members is // libua{} or libus{}, even when linking an executable (normally a unit // test). // - // libu{} is a general utility library with all three types of members. It - // would normally be used when you want to build both a library from - // libua{}/libus{} and an executable from libue{}. + // Note that there is no "general utility library" with all three types of + // members (that would cause member uplink ambiguity). If you need to + // build both a library from libua{}/libus{} and an executable from + // libue{} then you will need to arrange this explicitly, for example: + // + // exe{foo}: libue{foo} + // lib{foo}: libul{foo} + // + // {libue libul}{foo}: cxx{*} // class libux: public file // Common base of all libuX{} static libraries. { @@ -270,6 +277,7 @@ namespace build2 virtual const target_type& dynamic_type () const {return static_type;} }; +#if 0 class libu: public libx { public: @@ -279,6 +287,7 @@ namespace build2 static const target_type static_type; virtual const target_type& dynamic_type () const {return static_type;} }; +#endif // The lib{} target group. // -- cgit v1.1