btrfs-progs/Documentation/Makefile.in
A. Wilcox 2a064d77a7 btrfs-progs: docs: Don't erase XMLTO_EXTRA contents, fix docbook5 build
XMLTO_EXTRA is defined above, and then appended to if `asciidoctor` is
used to generate the manual pages.  The second definition was clearing
the value of this variable, which caused builds with asciidoctor to
fail with:

```
    [XMLTO]  btrfs-ioctl.3
xmlto: /usr/src/packages/user/btrfs-progs/src/btrfs-progs-v5.4/Documentation/btrfs-ioctl.xml does not validate (status 3)
xmlto: Fix document syntax or use --skip-validation option
validity error : no DTD found!
Document /usr/src/packages/user/btrfs-progs/src/btrfs-progs-v5.4/Documentation/btrfs-ioctl.xml does not validate
make[1]: *** [Makefile:114: btrfs-ioctl.3] Error 13
```

Fixes: 669f56177 ("btrfs-progs: docs: use docbook5 backend for asciidoctor")
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-01-09 14:28:52 +01:00

133 lines
3.5 KiB
Makefile

# Guard against environment variables
MAN8_TXT =
# Top level commands
MAN8_TXT += btrfs.asciidoc
MAN8_TXT += btrfs-convert.asciidoc
MAN8_TXT += btrfs-find-root.asciidoc
MAN8_TXT += btrfs-image.asciidoc
MAN8_TXT += btrfs-map-logical.asciidoc
MAN8_TXT += btrfs-select-super.asciidoc
MAN8_TXT += btrfstune.asciidoc
MAN8_TXT += fsck.btrfs.asciidoc
MAN8_TXT += mkfs.btrfs.asciidoc
# Sub commands for btrfs
MAN8_TXT += btrfs-subvolume.asciidoc
MAN8_TXT += btrfs-filesystem.asciidoc
MAN8_TXT += btrfs-balance.asciidoc
MAN8_TXT += btrfs-device.asciidoc
MAN8_TXT += btrfs-scrub.asciidoc
MAN8_TXT += btrfs-check.asciidoc
MAN8_TXT += btrfs-rescue.asciidoc
MAN8_TXT += btrfs-inspect-internal.asciidoc
MAN8_TXT += btrfs-send.asciidoc
MAN8_TXT += btrfs-receive.asciidoc
MAN8_TXT += btrfs-quota.asciidoc
MAN8_TXT += btrfs-qgroup.asciidoc
MAN8_TXT += btrfs-replace.asciidoc
MAN8_TXT += btrfs-restore.asciidoc
MAN8_TXT += btrfs-property.asciidoc
# Category 5 manual page
MAN5_TXT += btrfs-man5.asciidoc
MAN3_TXT += btrfs-ioctl.asciidoc
MAN_TXT = $(MAN3_TXT) $(MAN8_TXT) $(MAN5_TXT)
MAN_XML = $(patsubst %.asciidoc,%.xml,$(MAN_TXT))
MAN_HTML = $(patsubst %.asciidoc,%.html,$(MAN_TXT))
MAN3 = $(patsubst %.asciidoc,%.3,$(MAN3_TXT))
MAN5 = $(patsubst %.asciidoc,%.5,$(MAN5_TXT))
MAN8 = $(patsubst %.asciidoc,%.8,$(MAN8_TXT))
mandir ?= $(prefix)/share/man
man3dir = $(mandir)/man3
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
XMLTO = @XMLTO@
XMLTO_EXTRA = -m manpage-bold-literal.xsl
ifeq (@ASCIIDOC_TOOL@,asciidoc)
ASCIIDOC = @ASCIIDOC@
ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION) -f asciidoc.conf
ASCIIDOC_HTML = html
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_DEPS = asciidoc.conf
endif
ifeq (@ASCIIDOC_TOOL@,asciidoctor)
ASCIIDOC = @ASCIIDOCTOR@
ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION)
ASCIIDOC_HTML = xhtml5
ASCIIDOC_DOCBOOK = docbook5
XMLTO_EXTRA += --skip-validation
ASCIIDOC_DEPS =
endif
MANPAGE_XSL = manpage-normal.xsl
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_ASCIIDOC = @echo " [ASCII] $@";
QUIET_XMLTO = @echo " [XMLTO] $@";
endif
endif
all: man
man: man3 man5 man8
man3: $(MAN3)
man5: $(MAN5)
man8: $(MAN8)
html: $(MAN_HTML)
install: install-man
install-man: man
$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
$(INSTALL) -m 644 $(MAN5) $(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 $(MAN8) $(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) -f $(MAN_XML) *.xml+ $(MAN3) $(MAN5) $(MAN8) $(MAN_HTML)
%.3 : %.xml
$(QUIET_XMLTO)$(RM) -f $@ && \
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.5 : %.xml
$(QUIET_XMLTO)$(RM) -f $@ && \
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.8 : %.xml
$(QUIET_XMLTO)$(RM) -f $@ && \
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.asciidoc $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \
$(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_DOCBOOK) -d manpage -o $@+ $< && \
$(MV) $@+ $@
%.html : %.asciidoc $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \
$(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_HTML) -d article -o $@+ $< && \
$(MV) $@+ $@