diff options
Diffstat (limited to 'build/target')
-rw-r--r-- | build/target | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/build/target b/build/target index dd62ec8..5495061 100644 --- a/build/target +++ b/build/target @@ -20,6 +20,7 @@ #include <build/map-key> // map_iterator_adapter #include <build/timestamp> #include <build/name> +#include <build/variable> #include <build/operation> #include <build/prerequisite> #include <build/utility> // compare_*, extension_pool @@ -93,12 +94,13 @@ namespace build ~target () = default; target (dir_path d, std::string n, const std::string* e) - : dir (std::move (d)), name (std::move (n)), ext (e) {} + : dir (std::move (d)), name (std::move (n)), ext (e), + variables (nullptr) {} const dir_path dir; // Absolute and normalized. const std::string name; - const std::string* ext; // Extension, NULL means unspecified. - + const std::string* ext; // Extension, NULL means unspecified, + // empty means no extension. public: // Most qualified scope that contains this target. // @@ -112,6 +114,8 @@ namespace build scope* root_scope () const; + // Prerequisites. + // public: typedef std::vector<std::reference_wrapper<prerequisite>> @@ -119,6 +123,25 @@ namespace build prerequisites_type prerequisites; + // Target-specific variables. + // + public: + variable_map variables; + + const variable_map& + ro_variables () const {return variables;} + + // Variable lookup in this target and all its outer scopes. + // + value_proxy + operator[] (const variable&); + + value_proxy + operator[] (const std::string& name) + { + return operator[] (variable_pool.find (name)); + } + public: target_state state; @@ -328,6 +351,14 @@ namespace build void path (path_type p) {assert (path_.empty ()); path_ = std::move (p);} + // Return a path derived from target's dir, name, and, if specified, + // ext. If ext is not specified, then use default_ext. If name_prefix + // if not NULL, add it before the name part. + // + path_type + derived_path (const char* default_ext = nullptr, + const char* name_prefix = nullptr); + protected: virtual timestamp load_mtime () const; |