From cd75e06a87aa74aa6968113107afa53d401d20bc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Mar 2015 14:48:36 +0200 Subject: Configure/disfigure src_root saving/removing support; fsdir{} injection We can now build out-of-tree. --- build/context | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'build/context') diff --git a/build/context b/build/context index 2e3209a..ac6e29c 100644 --- a/build/context +++ b/build/context @@ -11,10 +11,12 @@ #include #include #include +#include namespace build { class scope; + class file; extern path work; extern path home; @@ -24,6 +26,41 @@ namespace build extern execution_mode current_mode; extern const target_rule_map* current_rules; + // Reset the dependency state. In particular, this removes all the + // targets, scopes, and variable names. + // + void + reset (); + + // Create the directory and print the standard diagnostics. Note that + // this implementation is not suitable if it is expected that the + // directory will exist in the majority of case and performance is + // important. See the fsdir{} rule for details. + // + mkdir_status + mkdir (const path&); + + // Remove the file and print the standard diagnostics. The second + // argument is only used in diagnostics, to print the target name. + // Passing the path for target will result in the relative path + // being printed. + // + template + rmfile_status + rmfile (const path&, const T& target); + + inline rmfile_status + rmfile (const path& f) {return rmfile (f, f);} + + // Similar to rmfile() but for directories. + // + template + rmdir_status + rmdir (const path&, const T& target); + + inline rmdir_status + rmdir (const path& d) {return rmdir (d, d);} + // Return the src/out directory corresponding to the given out/src. The // passed directory should be a sub-directory of out/src_root. // @@ -46,4 +83,6 @@ namespace build relative_work (const path&); } +#include + #endif // BUILD_CONTEXT -- cgit v1.1