From 05c98795249f5ed6cff0a158873643743b4c79d9 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 23 Jul 2021 23:06:26 +0300 Subject: [PATCH] Makefile: detect rst2man On some distros, rst2man has a .py extension and there is no rst2man. Fix build on such systems by detecting what is available. Signed-off-by: Stijn Tintel --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6dcbc06..f8b0216 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,18 @@ else INITRAMFS_DIR=/etc/initramfs-tools endif +var := $(shell rst2man 2>/dev/null) +ifeq ($(.SHELLSTATUS),0) + RST2MAN=rst2man +endif + +var := $(shell rst2man.py 2>/dev/null) +ifeq ($(.SHELLSTATUS),0) + RST2MAN=rst2man.py +endif + +undefine var + .PHONY: all all: bcachefs bcachefs.5 @@ -95,7 +107,7 @@ DOCDEPS := $(addprefix ./doc/,$(DOCSRC)) bcachefs.5: $(DOCDEPS) libbcachefs/opts.h $(CC) doc/opts_macro.h -I libbcachefs -I include -E 2>/dev/null \ | doc/macro2rst.py - rst2man doc/bcachefs.5.rst bcachefs.5 + $(RST2MAN) doc/bcachefs.5.rst bcachefs.5 SRCS=$(shell find . -type f -iname '*.c') DEPS=$(SRCS:.c=.d) -- 2.39.2