]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Fix errors related to rst2man warning message:
authorBrett Holman <bholman.devel@gmail.com>
Tue, 12 Oct 2021 04:23:51 +0000 (22:23 -0600)
committerKent Overstreet <kent.overstreet@gmail.com>
Tue, 12 Oct 2021 04:37:02 +0000 (00:37 -0400)
- Warning message doesn't print and causes build to exit.
- .SHELLSTATUS doesn't work on some versions of Make.

Signed-off-by: Brett Holman <bholman.devel@gmail.com>
Makefile

index 5917a4c2d07732a9f6bd4abff53199a86db5d6df..9ee1ff00dc605871abb79b6a6c211a0a9d99e6f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -61,22 +61,16 @@ else
        INITRAMFS_DIR=/etc/initramfs-tools
 endif
 
-var := $(shell rst2man -V 2>/dev/null)
-ifeq ($(.SHELLSTATUS),0)
+STATUS:=$(shell rst2man -V 2>/dev/null; echo $$?)
+ifeq ($(STATUS),0)
        RST2MAN=rst2man
 endif
 
-var := $(shell rst2man.py -V 2>/dev/null)
-ifeq ($(.SHELLSTATUS),0)
+STATUS:=$(shell rst2man.py -V 2>/dev/null; echo $$?)
+ifeq ($(STATUS),0)
        RST2MAN=rst2man.py
 endif
 
-undefine var
-
-ifeq (,$(RST2MAN))
-       @echo "WARNING: no RST2MAN found!"
-endif
-
 .PHONY: all
 all: bcachefs bcachefs.5
 
@@ -98,9 +92,13 @@ DOCSRC := opts_macro.h bcachefs.5.rst.tmpl
 DOCGENERATED := bcachefs.5 doc/bcachefs.5.rst
 DOCDEPS := $(addprefix ./doc/,$(DOCSRC))
 bcachefs.5: $(DOCDEPS)  libbcachefs/opts.h
+ifneq (,$(RST2MAN))
        $(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \
                | doc/macro2rst.py
        $(RST2MAN) doc/bcachefs.5.rst bcachefs.5
+else
+       @echo "WARNING: no rst2man found! Man page not generated."
+endif
 
 SRCS=$(shell find . -type f -iname '*.c')
 DEPS=$(SRCS:.c=.d)