From 87a8357fe797fd2e2a07c8bfa22353d63b3f8b6c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Dec 2021 07:49:54 +0200 Subject: Clean .t file in ad hoc recipe --- libbuild2/adhoc-rule-buildscript.cxx | 21 ++++++++++++++++++--- libbuild2/adhoc-rule-buildscript.hxx | 3 +++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'libbuild2') 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 (), {".d", ".t"}); + } + + target_state adhoc_buildscript_rule:: default_action (action a, const target& t, const optional& 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&) const; -- cgit v1.1