diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-12-14 07:49:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-12-14 07:49:54 +0200 |
commit | 87a8357fe797fd2e2a07c8bfa22353d63b3f8b6c (patch) | |
tree | 3611089cf72b71c21168c5c28ffbda9d43542697 | |
parent | 9d860f46631c1567c62336fcb25cf7b8090855a4 (diff) |
Clean .t file in ad hoc recipe
-rw-r--r-- | libbuild2/adhoc-rule-buildscript.cxx | 21 | ||||
-rw-r--r-- | libbuild2/adhoc-rule-buildscript.hxx | 3 |
2 files changed, 21 insertions, 3 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx index dce82dc..e0e69dc 100644 --- a/libbuild2/adhoc-rule-buildscript.cxx +++ b/libbuild2/adhoc-rule-buildscript.cxx @@ -336,7 +336,7 @@ namespace build2 // See if we are providing the standard clean as a fallback. // if (me.fallback) - return &perform_clean_depdb; + return &perform_clean_file; // See if this is not update or not on a file-based target. // @@ -926,8 +926,8 @@ namespace build2 if (f.relative ()) { if (!byp.cwd) - fail (il) << "relative path " << f << " in make dependency " - << "declaration" << + fail (il) << "relative path '" << f << "' in make dependency" + << " declaration" << info << "consider using --cwd to specify relative path " << "base"; @@ -1387,6 +1387,21 @@ namespace build2 } target_state adhoc_buildscript_rule:: + perform_clean_file (action a, const target& t) + { + // Besides .d (depdb) also clean .t which is customarily used as a + // temporary file, such as make dependency output in depdb-dyndep. In + // fact, initially the plan was to only clean it if we have dyndep but + // there is no reason it cannot be used for something else. + // + // Note that the main advantage of using this file over something in the + // temporary directory ($~) is that it's next to other output which makes + // it easier to examine during recipe troubleshooting. + // + return perform_clean_extra (a, t.as<file> (), {".d", ".t"}); + } + + target_state adhoc_buildscript_rule:: default_action (action a, const target& t, const optional<timestamp>& deadline) const diff --git a/libbuild2/adhoc-rule-buildscript.hxx b/libbuild2/adhoc-rule-buildscript.hxx index c39a0c0..4c36bf8 100644 --- a/libbuild2/adhoc-rule-buildscript.hxx +++ b/libbuild2/adhoc-rule-buildscript.hxx @@ -55,6 +55,9 @@ namespace build2 build::script::default_runner&, bool deferred_failure = false) const; + static target_state + perform_clean_file (action, const target&); + target_state default_action (action, const target&, const optional<timestamp>&) const; |