summaryrefslogtreecommitdiff
path: root/src/job.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2020-12-05 16:25:12 -0500
committerPaul Smith <psmith@gnu.org>2020-12-05 16:25:12 -0500
commit7044e0c93ca3d52e3e947764e538a0d1f5f2f16a (patch)
tree8e7a8994da16a16f8469f0257f05226538e827e5 /src/job.c
parent94d90776914f4086e2402a0a6a9dfa3d1a9a7d0c (diff)
downloadmake-git-7044e0c93ca3d52e3e947764e538a0d1f5f2f16a.tar.gz
[SV 59169] Add --debug=why and --debug=print options
Add debug options to print recipes even if they would otherwise be silent, and to print the reason that a target was considered out of date. Modify --trace to simply be a shorthand for --debug=print,why. * NEWS: Announce changes. * doc/make.texi (Summary of Options): Document the new options. * doc/make.1: Ditto. * src/debug.h: Add new flags DB_PRINT and DB_WHY. * src/makeint.h: Remove the trace_flag variable. * src/job.c (start_job_command): Check debug flags not trace_flag. (new_job): Ditto. * src/main.c (trace_flag): Make a static variable for switches. (decode_debug_flags): Set DB_PRINT and DB_WHY if trace_flag is set. * tests/scripts/variables/GNUMAKEFLAGS: Update known-good messages. * tests/scripts/variables/MAKEFLAGS: Ditto.
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/job.c b/src/job.c
index 28ddacff..d6e28d3a 100644
--- a/src/job.c
+++ b/src/job.c
@@ -29,7 +29,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Default shell to use. */
#ifdef WINDOWS32
# ifdef HAVE_STRINGS_H
-# include <strings.h> /* for strcasecmp, strncasecmp */
+# include <strings.h> /* for strcasecmp, strncasecmp */
# endif
# include <windows.h>
@@ -1341,7 +1341,7 @@ start_job_command (struct child *child)
#endif
/* Print the command if appropriate. */
- if (just_print_flag || trace_flag
+ if (just_print_flag || ISDB (DB_PRINT)
|| (!(flags & COMMANDS_SILENT) && !run_silent))
OS (message, 0, "%s", p);
@@ -1884,7 +1884,7 @@ new_job (struct file *file)
/* Trace the build.
Use message here so that changes to working directories are logged. */
- if (trace_flag)
+ if (ISDB (DB_WHY))
{
char *newer = allocated_variable_expand_for_file ("$?", c->file);
const char *nm;
@@ -1898,12 +1898,9 @@ new_job (struct file *file)
nm = n;
}
- if (newer[0] == '\0')
- OSS (message, 0,
- _("%s: target '%s' does not exist"), nm, c->file->name);
- else
- OSSS (message, 0,
- _("%s: update target '%s' due to: %s"), nm, c->file->name, newer);
+ OSSS (message, 0,
+ _("%s: update target '%s' due to: %s"), nm, c->file->name,
+ newer[0] == '\0' ? _("target does not exist") : newer);
free (newer);
}