From 8f8ab1e8f6d85748547c0d0e9987eed4f3c3e17b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Apr 2015 15:08:05 +0200 Subject: Add support for target groups, use to handle obj/obja/objso object targets --- build/target.cxx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'build/target.cxx') diff --git a/build/target.cxx b/build/target.cxx index 5be0a8d..cb751ad 100644 --- a/build/target.cxx +++ b/build/target.cxx @@ -85,12 +85,12 @@ namespace build } static target* - search_target (prerequisite& p) + search_target (const prerequisite_key& pk) { // The default behavior is to look for an existing target in the // prerequisite's directory scope. // - return search_existing_target (p); + return search_existing_target (pk); } // target_set @@ -133,8 +133,8 @@ namespace build pair target_set:: insert (const target_type& tt, dir_path dir, - std::string name, - const std::string* ext, + string name, + const string* ext, tracer& trace) { iterator i (find (target_key {&tt, &dir, &name, &ext}, trace)); @@ -260,7 +260,7 @@ namespace build // path_target // path path_target:: - derived_path (const char* de, const char* np) + derived_path (const char* de, const char* np, const char* ns) { string n; @@ -269,6 +269,9 @@ namespace build n += name; + if (ns != nullptr) + n += ns; + if (ext != nullptr) { if (!ext->empty ()) @@ -297,22 +300,21 @@ namespace build // static target* - search_file (prerequisite& p) + search_file (const prerequisite_key& pk) { // First see if there is an existing target. // - if (target* t = search_existing_target (p)) + if (target* t = search_existing_target (pk)) return t; // Then look for an existing file in this target-type-specific // list of paths (@@ TODO: comes from the variable). // - if (p.dir.relative ()) + if (pk.tk.dir->relative ()) { dir_paths sp; - sp.push_back (src_out (p.scope.path (), p.scope)); // src_base - - return search_existing_file (p, sp); + sp.push_back (src_out (pk.scope->path (), *pk.scope)); // src_base + return search_existing_file (pk, sp); } else return nullptr; @@ -321,16 +323,16 @@ namespace build // dir target // static target* - search_alias (prerequisite& p) + search_alias (const prerequisite_key& pk) { // For an alias/action we don't want to silently create a target // since it will do nothing and it most likely not what the author // intended. // - target* t (search_existing_target (p)); + target* t (search_existing_target (pk)); if (t == nullptr) - fail << "no explicit target for prerequisite " << p; + fail << "no explicit target for prerequisite " << pk; return t; } -- cgit v1.1