From 628e1ab2b3af4e9a0d4f8331e20c970db5eba150 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 22 Dec 2023 07:48:54 +0000 Subject: make: proper handling of build failure with '-k' When a build command fails and the '-k' option (continue on error) is in effect, no further commands should be executed for the current target. Also, the resulting diagnostic should be reported to stderr. As should the final 'not built due to errors' diagnostic. Adds 80 bytes. (pdpmake GitHub issue 35) --- miscutils/make.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'miscutils') diff --git a/miscutils/make.c b/miscutils/make.c index 785e25f7d..841daa93e 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -2221,9 +2221,14 @@ docmds(struct name *np, struct cmd *cp) } else if (status != 0 && !signore) { if (!posix && WIFSIGNALED(status)) remove_target(); - if (errcont || doinclude) { - warning("failed to build '%s'", np->n_name); + if (errcont) { + diagnostic("failed to build '%s'", np->n_name); estat |= MAKE_FAILURE; + free(command); + free(cmd); + break; + } else if (doinclude) { + warning("failed to build '%s'", np->n_name); } else { const char *err_type = NULL; int err_value; @@ -2488,7 +2493,7 @@ make(struct name *np, int level) else if (!doinclude && level == 0 && !(estat & MAKE_DIDSOMETHING)) warning("nothing to be done for %s", np->n_name); } else if (!doinclude) { - warning("'%s' not built due to errors", np->n_name); + diagnostic("'%s' not built due to errors", np->n_name); } free(oodate); } -- cgit v1.2.3-55-g6feb