]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 61042] Enhance logging of implicit rule search
authorDmitry Goncharov <dgoncharov@users.sf.net>
Sun, 17 Oct 2021 22:03:04 +0000 (18:03 -0400)
committerPaul Smith <psmith@gnu.org>
Tue, 19 Oct 2021 03:00:21 +0000 (23:00 -0400)
commitf8f9d371ff58a7195ca4abc9413f435c2bf2b998
tree3508b3d47b1321ea64208be4c1c2c66d3f46f17e
parentf5af979357f10e3c2dd1fc5e483d52928c7cf6ec
[SV 61042] Enhance logging of implicit rule search

Logging of implicit rule search gives limited information as to why a
given implicit rule was rejected, and if no implicit rule is found we
get the confusing "No rule to make target" result when the real issue
is that some prerequisite of some implicit rule could not be built.

Enhance logging around implicit rule search as follows:
1. The messages which refer to a rule print a description (the targets
   and prerequisites) of the rule.
2. A new message tells when a rule is rejected, along with the reason.
3. The 'Looking for an implicit rule...' message is printed for every
   prerequisite, not just the top-level target.
4. "Trying harder" message is printed, when intermediate prerequisites
   are going to be searched.
5. The 'No rule found...' and 'Found implicit rule...' messages are
   printed for every prerequisite, not just the top-level target.
6. "Ought to exist...", "Found..." or "Not found..." message is
   printed for each prerequisite.

* src/rule.h (struct rule): Remember the definition of the rule.
* src/rule.c (get_rule_defn): Compute the definition of a rule.
(install_pattern_rule): Initialize the definition to empty.
(create_pattern_rule): Ditto.
(freerule): Free the definition.
(print_rule): Use the definition when printing rules.
* src/remake.c (update_file_1): Push debug output down into
try_implicit_rule().
* src/implicit.c (try_implicit_rule): Add debugging
(pattern_search): Show the rule definition in various debug output.
Add new debug messages for implicit rule search.

Additional changes by Paul Smith <psmith@gnu.org>:

Since we usually don't need the rule definition, defer computing it
until we do.

* bootstrap.conf: Include the mempcpy Gnulib module.
* src/makeint.h (mempcpy): Declare mempcpy if not available.
* src/misc.c (mempcpy): Define mempcpy if not available.
* src/config.h-vms.template: Don't set HAVE_MEMPCPY.
* src/config.h.W32.template: Ditto.
* src/rule.h (get_rule_defn): Return the definition of a rule.
* src/rule.c (get_rule_defn): If we don't have a definition compute
it; either way return it.
* src/implicit.c (pattern_search): Rework the handling of explicit
prerequisites to pattern rules to be more clear.  There is no change
in behavior.
bootstrap.conf
src/config.h-vms.template
src/config.h.W32.template
src/implicit.c
src/job.c
src/makeint.h
src/misc.c
src/remake.c
src/rule.c
src/rule.h