From 91495e646c688eade6b46f21bb40e3da8b8d6f1a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Jan 2017 08:21:53 +0200 Subject: Implement automatic loading of directory buildfiles Now instead of explicitly writing: d = foo/ bar/ ./: $d include $d We can (usually) just write: ./: foo/ bar/ --- build2/target | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'build2/target') diff --git a/build2/target b/build2/target index a41c5b9..3bc9d5c 100644 --- a/build2/target +++ b/build2/target @@ -378,8 +378,7 @@ namespace build2 value& assign (string name) {return vars.assign (move (name)).first.get ();} - // Return a value suitable for appending. See class scope for - // details. + // Return a value suitable for appending. See class scope for details. // value& append (const variable&); @@ -390,6 +389,15 @@ namespace build2 return append (var_pool[name]); } + // A target that is not (yet) entered as part of a real dependency + // declaration (for example, that is entered as part of a target-specific + // variable assignment) is called implied. + // + public: + bool implied; + + // Target state. + // public: target_state raw_state = target_state::unknown; @@ -498,11 +506,12 @@ namespace build2 } } + // Recipe. + // public: - action_type action; // Action this recipe is for. + using recipe_type = build2::recipe; - public: - typedef build2::recipe recipe_type; + action_type action; // Action this recipe is for. const recipe_type& recipe (action_type a) const {return a > action ? empty_recipe : recipe_;} @@ -510,6 +519,9 @@ namespace build2 void recipe (action_type, recipe_type); + private: + recipe_type recipe_; + // Target type info. // public: @@ -547,13 +559,8 @@ namespace build2 // The only way to create a target should be via the targets set below. // public: - friend class target_set; - target (dir_path d, dir_path o, string n, optional e) : dir (move (d)), out (move (o)), name (move (n)), ext (move (e)) {} - - private: - recipe_type recipe_; }; // All targets are from the targets set below. @@ -1010,6 +1017,7 @@ namespace build2 dir_path out, string name, optional ext, + bool implied, tracer&); template @@ -1022,7 +1030,13 @@ namespace build2 tracer& t) { return static_cast ( - insert (tt, move (dir), move (out), move (name), move (ext), t).first); + insert (tt, + move (dir), + move (out), + move (name), + move (ext), + false, // Always real (not implied). + t).first); } template @@ -1034,7 +1048,7 @@ namespace build2 tracer& t) { return static_cast ( - insert (T::static_type, dir, out, name, ext, t).first); + insert (T::static_type, dir, out, name, ext, false, t).first); } template @@ -1045,7 +1059,7 @@ namespace build2 tracer& t) { return static_cast ( - insert (T::static_type, dir, out, name, nullopt, t).first); + insert (T::static_type, dir, out, name, nullopt, false, t).first); } void -- cgit v1.1