From 2e0c6ca308f522bba4c7efa7db9362a1b07a356c Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 13 Jan 2022 18:18:24 +0100 Subject: [PATCH] btrfs-progs: docs: add remaining targets for sphinx build Update sphinx build so that by default it now builds the manual pages, in quiet mode. 'make html' builds the html, other sphinx targets are available, see 'make help'. Installation now works as well. Note: sphinx is still conditional and must be selected by ASCIIDOOC_TOOL=sphinx ./configure Signed-off-by: David Sterba --- Documentation/Makefile.in | 63 ++++++++++++++++++++++++++++++++------- Documentation/conf.py | 2 +- configure.ac | 2 ++ 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Documentation/Makefile.in b/Documentation/Makefile.in index 22c41289..54026e41 100644 --- a/Documentation/Makefile.in +++ b/Documentation/Makefile.in @@ -1,26 +1,69 @@ ifeq (@ASCIIDOC_TOOL@,sphinx) -$(info "sphinx build, rst") -# Minimal makefile for Sphinx documentation -# +# Source files for manual pages are listed in conf.py in variable man_pages -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= +# You can set these variables from the command line, and also from the +# environment for the first two. +SPHINXOPTS ?= -N SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build -# Put it first so that "make" without argument is like "make help". +INSTALL = @INSTALL@ +RM = @RM@ +RMDIR = @RMDIR@ +LN_S = @LN_S@ +MV = @MV@ +SED = @SED@ +BTRFS_VERSION = $(shell $(SED) -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p' ../config.h) + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_RM = @ + QUIET_SPHINX = @echo " [SPHINX] $@"; + SPHINXOPTS += -q +endif +endif + +mandir ?= $(prefix)/share/man +man3dir = $(mandir)/man3 +man5dir = $(mandir)/man5 +man8dir = $(mandir)/man8 + +.PHONY: all man help + +# Build manual pages by default + +all: man + +man: + $(QUIET_SPHINX)$(SPHINXBUILD) -M man "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile Makefile.in +install: man + $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) + $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir) + $(INSTALL) -m 644 $(BUILDDIR)/man/*.5 $(DESTDIR)$(man5dir) + # the source file name of btrfs.5 clashes with section 8 page, but we + # want to keep the code generic + $(MV) $(DESTDIR)$(man5dir)/btrfs-man5.5 $(DESTDIR)$(man5dir)/btrfs.5 + $(INSTALL) -m 644 $(BUILDDIR)/man/*.8 $(DESTDIR)$(man8dir) + $(INSTALL) -m 644 btrfsck.8 $(DESTDIR)$(man8dir) + +uninstall: + cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8 $(MAN8) + $(RMDIR) -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir) + +clean: + $(QUIET_RM)$(RM) -rf $(BUILDDIR)/* + $(QUIET_RM)$(RMDIR) -- $(BUILDDIR) # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile Makefile.in - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +%: + $(QUIET_SPHINX)$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) else diff --git a/Documentation/conf.py b/Documentation/conf.py index 085de3b0..6e38f7ab 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -69,5 +69,5 @@ man_pages = [ ('btrfs-map-logical', 'btrfs-map-logical', 'map btrfs logical extent to physical extent', '', 8), ('btrfs', 'btrfs', 'a toolbox to manage btrfs filesystems', '', 8), ('mkfs.btrfs', 'mkfs.btrfs', 'create a btrfs filesystem', '', 8), - ('btrfs-man5', 'btrfs-man5', 'topics about the BTRFS filesystem (mount options, supported file attributes and other)', '', 8), + ('btrfs-man5', 'btrfs-man5', 'topics about the BTRFS filesystem (mount options, supported file attributes and other)', '', 5), ] diff --git a/configure.ac b/configure.ac index ac07e51e..35568605 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,8 @@ dnl Use as: $ ASCIIDOC_TOOL ./configure if test "x$ASCIIDOC_TOOL" = "xsphinx"; then ASCIIDOC_TOOL='sphinx' AC_PATH_PROG([SPHINX], [sphinx-build]) + AC_PATH_PROG([MV], [mv], [mv]) + AC_PROG_SED else dnl detect tools to build documentation