btrfs-progs/Documentation/Makefile.in

67 lines
1.8 KiB
Makefile
Raw Normal View History

# 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 ?= -N
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
INSTALL = @INSTALL@
RM = @RM@
RMDIR = @RMDIR@
LN_S = @LN_S@
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
btrfs-progs: docs: fix build due to phony contents.rst [BUG] Since commit 8049446bb0ba ("btrfs-progs: docs: placeholder for contents.rst file on older sphinx version"), on systems with much newer sphinx-build, "make" would not work for Documentation directory: $ make clean-all && ./autogen.sh && ./configure --prefix=/usr/ && make -j12 $ ls -alh Documentation/_build ls: cannot access 'Documentation/_build': No such file or directory The sphinx-build has a much newer version: $ sphinx-build --version sphinx-build 7.2.6 [CAUSE] On systems which don't need the workaround, the phony target of contents.rst seems to cause a dependency loop: GNU Make 4.4.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Reading makefile 'Makefile'... Updating makefiles.... Considering target file 'Makefile'. Looking for an implicit rule for 'Makefile'. Trying pattern rule '%:' with stem 'Makefile'. Found implicit rule '%:' for 'Makefile'. Finished prerequisites of target file 'Makefile'. No need to remake target 'Makefile'. Updating goal targets.... Considering target file 'contents.rst'. File 'contents.rst' does not exist. Finished prerequisites of target file 'contents.rst'. Must remake target 'contents.rst'. Makefile:35: update target 'contents.rst' due to: target is .PHONY if [ "$(sphinx-build --version | cut -d' ' -f2)" \< "1.7.7" ]; then \ touch contents.rst; \ fi Putting child 0x64ee81960130 (contents.rst) PID 66833 on the chain. Live child 0x64ee81960130 (contents.rst) PID 66833 Reaping winning child 0x64ee81960130 PID 66833 Removing child 0x64ee81960130 PID 66833 from chain. Successfully remade target file 'contents.rst'. All the default make doing is just try to generate contents.rst, but since we have much newer version, we won't generate the file at all. [FIX] Instead of a phony target, just move the contents.rst generation into man page target so that we won't cause loop target on contents.rst. Fixes: 8049446bb0ba ("btrfs-progs: docs: placeholder for contents.rst file on older sphinx version") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
2024-04-26 01:00:22 +02:00
# Build manual pages by default
all: man
# Workaround for old sphinx that requires the contents.rst file
btrfs-progs: docs: fix build due to phony contents.rst [BUG] Since commit 8049446bb0ba ("btrfs-progs: docs: placeholder for contents.rst file on older sphinx version"), on systems with much newer sphinx-build, "make" would not work for Documentation directory: $ make clean-all && ./autogen.sh && ./configure --prefix=/usr/ && make -j12 $ ls -alh Documentation/_build ls: cannot access 'Documentation/_build': No such file or directory The sphinx-build has a much newer version: $ sphinx-build --version sphinx-build 7.2.6 [CAUSE] On systems which don't need the workaround, the phony target of contents.rst seems to cause a dependency loop: GNU Make 4.4.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Reading makefile 'Makefile'... Updating makefiles.... Considering target file 'Makefile'. Looking for an implicit rule for 'Makefile'. Trying pattern rule '%:' with stem 'Makefile'. Found implicit rule '%:' for 'Makefile'. Finished prerequisites of target file 'Makefile'. No need to remake target 'Makefile'. Updating goal targets.... Considering target file 'contents.rst'. File 'contents.rst' does not exist. Finished prerequisites of target file 'contents.rst'. Must remake target 'contents.rst'. Makefile:35: update target 'contents.rst' due to: target is .PHONY if [ "$(sphinx-build --version | cut -d' ' -f2)" \< "1.7.7" ]; then \ touch contents.rst; \ fi Putting child 0x64ee81960130 (contents.rst) PID 66833 on the chain. Live child 0x64ee81960130 (contents.rst) PID 66833 Reaping winning child 0x64ee81960130 PID 66833 Removing child 0x64ee81960130 PID 66833 from chain. Successfully remade target file 'contents.rst'. All the default make doing is just try to generate contents.rst, but since we have much newer version, we won't generate the file at all. [FIX] Instead of a phony target, just move the contents.rst generation into man page target so that we won't cause loop target on contents.rst. Fixes: 8049446bb0ba ("btrfs-progs: docs: placeholder for contents.rst file on older sphinx version") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
2024-04-26 01:00:22 +02:00
man:
@if [ "$$(sphinx-build --version | cut -d' ' -f2)" \< "1.7.7" ]; then \
touch contents.rst; \
fi
$(QUIET_SPHINX)$(SPHINXBUILD) -M man "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
install: man
$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
$(INSTALL) -m 644 $(BUILDDIR)/man/*.5 $(DESTDIR)$(man5dir)
$(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)$(RM) -df -- $(BUILDDIR)
$(QUIET_RM)$(RM) -f contents.rst
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
$(QUIET_SPHINX)$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)