Subject: [PATCH 1/2] automake: support check-hook target

From: Mike Frysinger <[email-masked]>
Date: Sun, 20 Feb 2022 22:36:31 -0500

Related to automake bug https://bugs.gnu.org/19961.

Add hook support for the check target as requested by Shahbaz Youssefi.

* NEWS: Mention new check-hook.
* bin/automake.in: Run check-hook if defined.
* doc/automake.texi: Document new check-hook.
---
 NEWS              | 2 ++
 bin/automake.in   | 2 ++
 doc/automake.texi | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 665d8329d667..183825e8f2ed 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ New in 1.17:
   - Variables using escaped \# will trigger portability warnings, but be
     retained when appended.  GNU Make & BSD Makes are known to support it.
 
+  - The check target now supports user defined check-hook.
+
 * Obsolescent features:
 
   - py-compile no longer supports Python 0.x or 1.x versions.  Python 2.0,
diff --git a/bin/automake.in b/bin/automake.in
index 6d55884023cd..1a47865474f9 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -4670,6 +4670,8 @@ sub do_check_merge_target ()
   # Include user-defined local form of target.
   push @check_tests, 'check-local'
     if user_phony_rule 'check-local';
+  push @check_tests, 'check-hook'
+    if user_phony_rule 'check-hook';
 
   # The check target must depend on the local equivalent of
   # 'all', to ensure all the primary targets are built.  Then it
diff --git a/doc/automake.texi b/doc/automake.texi
index b6a38dc27ce5..b13f96809ce3 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -11609,7 +11609,7 @@ In contrast, some rules also have a way to run another rule, called a
 @dfn{hook}; hooks are always executed after the main rule's work is done.
 The hook is named after the principal target, with @samp{-hook} appended.
 The targets allowing hooks are @code{install-data},
-@code{install-exec}, @code{uninstall}, @code{dist}, and
+@code{install-exec}, @code{uninstall}, @code{check}, @code{dist}, and
 @code{distcheck}.
 
 For instance, here is how to create a hard link to an installed program:
-- 
2.34.1