]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
share/mk/: help, help-*: Add targets to list targets, variables, and build dependencies
authorAlejandro Colomar <alx@kernel.org>
Thu, 4 Dec 2025 13:55:01 +0000 (14:55 +0100)
committerAlejandro Colomar <alx@kernel.org>
Thu, 4 Dec 2025 14:41:46 +0000 (15:41 +0100)
Suggested-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
GNUmakefile
share/mk/help/list.mk [new file with mode: 0644]

index 6ee1a8874321b11628e0616522a17aeb5a5a6a40..3f2ea50baa6649eabf9ab61ad86d48982f668f69 100644 (file)
@@ -55,32 +55,15 @@ help:
        $(info  $(INFO_)        dist                    Produce the release tarball)
        $(info  $(INFO_)        distcheck               Check the release tarball)
        $(info  $(INFO_)        help                    Print this help)
+       $(info  $(INFO_)        help-list-build-depends List build dependencies (package/program))
+       $(info  $(INFO_)        help-list-targets       List all targets)
+       $(info  $(INFO_)        help-list-variables     List configurable variables)
        $(info  $(INFO_)        install                 Install the usual stuff)
        $(info  $(INFO_)        install-all             Install everything)
        $(info  $(INFO_)        lint                    Lint the source code)
        $(info  $(INFO_)        nothing                 Do nothing; useful for debugging)
        $(info  $(INFO_)        uninstall               Uninstall everything (might leave traces))
        $(info  )
-       $(info  $(INFO_)To see the full list of targets, run:)
-       $(info  $(INFO_)        $$ make -R -p nothing \)
-       $(info  $(INFO_)        | grep '^\.PHONY:' \)
-       $(info  $(INFO_)        | tr ' ' '\n' \)
-       $(info  $(INFO_)        | grep -v '^\.PHONY:' \)
-       $(info  $(INFO_)        | sort;)
-       $(info  )
-       $(info  $(INFO_)To see a list of variables, run:)
-       $(info  $(INFO_)        $$ find GNUmakefile share/mk/configure -type f \)
-       $(info  $(INFO_)        | sort \)
-       $(info  $(INFO_)        | xargs grep '^[^[:space:]].*=' \)
-       $(info  $(INFO_)        | sed 's/=.*/=/' \)
-       $(info  $(INFO_)        | grep -v -e ':DEFAULT_.*=' -e ':MAKEFILE_.*INCLUDED :=';)
-       $(info  )
-       $(info  $(INFO_)To see a list of dependencies (package/program), run:)
-       $(info  $(INFO_)        $$ find share/mk/configure/build-depends -type f \)
-       $(info  $(INFO_)        | sed 's,share/mk/configure/build-depends/,,' \)
-       $(info  $(INFO_)        | sed 's,\.mk,,' \)
-       $(info  $(INFO_)        | sort;)
-       $(info  )
 
 
 .DELETE_ON_ERROR:
diff --git a/share/mk/help/list.mk b/share/mk/help/list.mk
new file mode 100644 (file)
index 0000000..7443d12
--- /dev/null
@@ -0,0 +1,46 @@
+# Copyright, the authors of the Linux man-pages project
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_HELP_LIST_INCLUDED
+MAKEFILE_HELP_LIST_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/sort.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/tr.mk
+include $(MAKEFILEDIR)/configure/build-depends/findutils/find.mk
+include $(MAKEFILEDIR)/configure/build-depends/findutils/xargs.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed/sed.mk
+
+
+.PHONY: help-list-targets
+help-list-targets:
+       $(MAKE) -p nothing \
+       | $(GREP) '^\.PHONY:' \
+       | $(TR) ' ' '\n' \
+       | $(GREP) -v '^\.PHONY:' \
+       | $(SORT)
+
+
+.PHONY: help-list-variables
+help-list-variables:
+       $(FIND) $(CURDIR)/GNUmakefile $(MAKEFILEDIR) -type f \
+       | $(GREP) -e '/GNUmakefile$$' -e '\.mk$$' \
+       | $(SORT) \
+       | $(XARGS) $(GREP) '^[^[:space:]].*=' \
+       | $(SED) 's,$(CURDIR)/,,' \
+       | $(SED) 's/=.*/=/' \
+       | $(GREP) -v -e ':DEFAULT_.*=' -e ':MAKEFILE_.*INCLUDED :='
+
+
+.PHONY: help-list-build-depends
+help-list-build-depends:
+       $(FIND) $(MAKEFILEDIR)/configure/build-depends -type f \
+       | $(GREP) -e '\.mk$$' -e '\.mk$$' \
+       | $(SED) 's,$(MAKEFILEDIR)/configure/build-depends/,,' \
+       | $(SED) 's,\.mk$$,,' \
+       | $(SORT)
+
+
+endif  # include guard