]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 64571] Add --print-targets option
authorPaul Smith <psmith@gnu.org>
Tue, 9 Jan 2024 04:14:57 +0000 (23:14 -0500)
committerPaul Smith <psmith@gnu.org>
Tue, 9 Jan 2024 04:31:58 +0000 (23:31 -0500)
commit31036e648f4a92ae0cce215eb3d60a1311a09c60
treeeccb7f4a4f5ed7f495bb8d78b2dcbce8c6d78cc1
parent1ff728bff4285df8924cfcba024cea58c3350f77
[SV 64571] Add --print-targets option

Add an option to print a list of targets defined in the makefiles.
Don't print targets of implicit rules, or special targets.  To
support this remember which files are deemed suffix rule targets.

Add a missing warning for single-suffix targets with prerequisites.

Suggested by many.  Sample implementation by Tim <tdhutt@gmail.com>.

* NEWS: Announce the new option and single-suffix warning.
* doc/make.1: Add --print-targets to the man page.
* doc/make.texi: Add --print-targets to the documentation.  Clean up
the text around the definition of suffix rules.
* src/main.c (print_targets_flag): New variable for --print-targets.
(switches): Add a new long option --print-targets.
(main): If the option was provided call print_targets() and exit.
* src/filedef.h (struct file): Add a "suffix" boolean value.  Remove
print_prereqs() since it's static.  Add new print_targets().
* src/file.c (rehash_file): Merge the new suffix value.
(print_prereqs): Used only locally: change to static.
(print_target): Print targets which are not suffix rule targets and
are not special targets.
(print_targets): Call print_target() on each file.
* src/rule.c (convert_to_pattern): Make maxsuffix local; it doesn't
need to be static.  Emit ignoring prerequisites for single-suffix
rules as well as double-suffix rules.  Remember which files are
actually suffix rules.
* tests/scripts/features/suffixrules: Test single-suffix behavior.
* tests/scripts/options/print-targets: Add tests for --print-targets.
NEWS
doc/make.1
doc/make.texi
src/file.c
src/filedef.h
src/main.c
src/rule.c
tests/scripts/features/suffixrules
tests/scripts/options/print-targets [new file with mode: 0644]