tools: bpftool: exit doc Makefile early if rst2man is not available

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/92426820f7616caebdf6ba665f749102a670b3d4
Commit:     92426820f7616caebdf6ba665f749102a670b3d4
Parent:     0badd331491097cc3702d05a6dd0264a434712b2
Refname:    refs/heads/master
Author:     Quentin Monnet <[email protected]>
AuthorDate: Wed Feb 7 20:27:14 2018 -0800
Committer:  Daniel Borkmann <[email protected]>
CommitDate: Thu Feb 8 11:59:50 2018 +0100

    tools: bpftool: exit doc Makefile early if rst2man is not available
    
    If rst2man is not available on the system, running `make doc` from the
    bpftool directory fails with an error message. However, it creates empty
    manual pages (.8 files in this case). A subsequent call to `make
    doc-install` would then succeed and install those empty man pages on the
    system.
    
    To prevent this, raise a Makefile error and exit immediately if rst2man
    is not available before generating the pages from the rst documentation.
    
    Fixes: ff69c21a85a4 ("tools: bpftool: add documentation")
    Reported-by: Jason van Aaardt <[email protected]>
    Signed-off-by: Quentin Monnet <[email protected]>
    Reviewed-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
---
 tools/bpf/bpftool/Documentation/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/bpf/bpftool/Documentation/Makefile b/tools/bpf/bpftool/Documentation/Makefile
index c462a928e03d..a9d47c1558bb 100644
--- a/tools/bpf/bpftool/Documentation/Makefile
+++ b/tools/bpf/bpftool/Documentation/Makefile
@@ -23,7 +23,12 @@ DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
 man: man8
 man8: $(DOC_MAN8)
 
+RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
+
 $(OUTPUT)%.8: %.rst
+ifndef RST2MAN_DEP
+	$(error "rst2man not found, but required to generate man pages")
+endif
 	$(QUIET_GEN)rst2man $< > $@
 
 clean:
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.