]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
share/mk/: Unify variable names for regex files
authorAlejandro Colomar <alx@kernel.org>
Wed, 10 Sep 2025 15:52:37 +0000 (17:52 +0200)
committerAlejandro Colomar <alx@kernel.org>
Sun, 14 Sep 2025 11:42:07 +0000 (13:42 +0200)
Within recipes, variables have delayed expansion, which means that we
can't use variables that we've undefined.  That's why we need to use
a filter to get the regex file name from the rule prerequisites.  This
trick was suggested by Philip.

Cc: Philip Guenther <guenther@gmail.com>
Cc: Paul Smith <psmith@gnu.org>
Cc: Martin Dorey <Martin.Dorey@hitachivantara.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
share/mk/build/catman/troff.mk
share/mk/lint/man/mandoc.mk
share/mk/lint/man/quote.mk
share/mk/lint/man/ws.mk

index eda2a5fafeb26e526ff35f3f394512546efe28e0..d175319908ce8f0c2daf6b1492cd7b190c036fc4 100644 (file)
@@ -17,6 +17,7 @@ include $(MAKEFILEDIR)/configure/xfail.mk
 
 ext := .cat.set
 xfail := $(MAKEFILEDIR)/build/catman/troff.xfail
+regexf := $(MAKEFILEDIR)/build/catman/troff.ignore.grep
 
 tgts := $(patsubst %, %$(ext), $(_NONSO))
 ifeq ($(SKIP_XFAIL),yes)
@@ -24,16 +25,13 @@ tgts := $(filter-out $(patsubst %, $(_MANDIR)/%$(ext), $(file < $(xfail))), $(tg
 endif
 
 
-troff_catman_ignore_grep := $(MAKEFILEDIR)/build/catman/troff.ignore.grep
-
-
 _CATMAN_set := $(tgts)
 
 
-$(_CATMAN_set): %$(ext): %.cat.troff $(troff_catman_ignore_grep) $(MK) | $$(@D)/
+$(_CATMAN_set): %$(ext): %.cat.troff $(regexf) $(MK) | $$(@D)/
        $(info  $(INFO_)TROFF           $@)
        ! ($(TROFF) -mandoc $(TROFFFLAGS_) $(NROFFFLAGS_) <$< 2>&1 >$@ \
-          | $(GREP) -v -f '$(troff_catman_ignore_grep)' \
+          | $(GREP) -v -f '$(filter %.grep, $^)' \
           || $(TRUE); \
        ) \
        | $(GREP) ^ >&2
@@ -45,6 +43,7 @@ build-catman-troff: $(_CATMAN_set);
 
 undefine ext
 undefine xfail
+undefine regexf
 undefine tgts
 
 
index 3a33354672736d9fe8993b6e0e3ae5cd88e7aae8..4d0436f6aed3747d60928099a90efc875818ef0d 100644 (file)
@@ -17,6 +17,7 @@ include $(MAKEFILEDIR)/configure/xfail.mk
 
 ext := .lint-man.mandoc.touch
 xfail := $(MAKEFILEDIR)/lint/man/mandoc.xfail
+regexf := $(MAKEFILEDIR)/lint/man/mandoc.ignore.grep
 
 tgts := $(patsubst %, %$(ext), $(_NONSO))
 ifeq ($(SKIP_XFAIL),yes)
@@ -24,13 +25,10 @@ tgts := $(filter-out $(patsubst %, $(_MANDIR)/%$(ext), $(file < $(xfail))), $(tg
 endif
 
 
-mandoc_man_ignore_grep := $(MAKEFILEDIR)/lint/man/mandoc.ignore.grep
-
-
-$(tgts): %$(ext): % $(mandoc_man_ignore_grep) $(MK) | $$(@D)/
+$(tgts): %$(ext): % $(regexf) $(MK) | $$(@D)/
        $(info  $(INFO_)MANDOC          $@)
        ! ($(MANDOC) $(MANDOCFLAGS_) $< 2>&1 \
-          | $(GREP) -v -f '$(mandoc_man_ignore_grep)' \
+          | $(GREP) -v -f '$(filter %.grep, $^)' \
           || $(TRUE); \
        ) \
        | $(GREP) ^ >&2
@@ -43,6 +41,7 @@ lint-man-mandoc: $(tgts);
 
 undefine ext
 undefine xfail
+undefine regexf
 undefine tgts
 
 
index 28cae6533070303b28c810b5c64cd291181d4dcb..d42bb7fc9f1dd01bed34d9408f3431b241833586 100644 (file)
@@ -15,6 +15,7 @@ include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
 
 ext := .lint-man.quote.touch
 xfail := $(MAKEFILEDIR)/lint/man/quote.xfail
+regexf := $(MAKEFILEDIR)/lint/man/quote.Pgrep
 
 tgts := $(patsubst %, %$(ext), $(_NONSO))
 ifeq ($(SKIP_XFAIL),yes)
@@ -22,15 +23,12 @@ tgts := $(filter-out $(patsubst %, $(_MANDIR)/%$(ext), $(file < $(xfail))), $(tg
 endif
 
 
-quote_Pgrep := $(MAKEFILEDIR)/lint/man/quote.Pgrep
-
-
-$(tgts): %$(ext): % $(quote_Pgrep) $(MK) | $$(@D)/
+$(tgts): %$(ext): % $(regexf) $(MK) | $$(@D)/
        $(info  $(INFO_)GREP            $@)
        $(CAT) <$< \
-       | if $(GREP) -Pf $(quote_Pgrep) >/dev/null; then \
+       | if $(GREP) -Pf $(filter %.Pgrep, $^) >/dev/null; then \
                >&2 $(ECHO) "lint-man-quote: $<: Unmatched quote:"; \
-               >&2 $(GREP) -PTnf '$(quote_Pgrep)' <$<; \
+               >&2 $(GREP) -PTnf '$(filter %.Pgrep, $^)' <$<; \
                exit 1; \
        fi;
        $(TOUCH) $@
@@ -42,6 +40,7 @@ lint-man-quote: $(tgts);
 
 undefine ext
 undefine xfail
+undefine regexf
 undefine tgts
 
 
index eb1bb6c6415218a7bea5b74e1f77ac5031b198f2..2cb36e40f4181ea84c6c72e04c6fe2a1546c0130 100644 (file)
@@ -15,6 +15,7 @@ include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
 
 ext := .lint-man.ws.touch
 xfail := $(MAKEFILEDIR)/lint/man/ws.xfail
+regexf := $(MAKEFILEDIR)/lint/man/ws.egrep
 
 tgts := $(patsubst %, %$(ext), $(_NONSO))
 ifeq ($(SKIP_XFAIL),yes)
@@ -22,15 +23,12 @@ tgts := $(filter-out $(patsubst %, $(_MANDIR)/%$(ext), $(file < $(xfail))), $(tg
 endif
 
 
-ws_egrep := $(MAKEFILEDIR)/lint/man/ws.egrep
-
-
-$(tgts): %$(ext): % $(ws_egrep) $(MK) | $$(@D)/
+$(tgts): %$(ext): % $(regexf) $(MK) | $$(@D)/
        $(info  $(INFO_)GREP            $@)
        $(CAT) <$< \
-       | if $(GREP) -Ef $(ws_egrep) >/dev/null; then \
+       | if $(GREP) -Ef $(filter %.egrep, $^) >/dev/null; then \
                >&2 $(ECHO) "lint-man-ws: $<: Spurious white space:"; \
-               >&2 $(GREP) -ETnf '$(ws_egrep)' <$<; \
+               >&2 $(GREP) -ETnf '$(filter %.egrep, $^)' <$<; \
                exit 1; \
        fi;
        $(TOUCH) $@
@@ -42,6 +40,7 @@ lint-man-ws: $(tgts);
 
 undefine ext
 undefine xfail
+undefine regexf
 undefine tgts