From 08420d2481ffe711b91a943c5b475116a4eef278 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Mon, 11 Oct 2021 22:23:51 -0600 Subject: [PATCH] Fix errors related to rst2man warning message: - Warning message doesn't print and causes build to exit. - .SHELLSTATUS doesn't work on some versions of Make. Signed-off-by: Brett Holman --- Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 5917a4c2..9ee1ff00 100644 --- 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)