@@ -70,6 +70,19 @@ ifneq ($$(wildcard $$(MANUAL_$(2)_ASCIIDOC_CONF)),)
MANUAL_$(2)_ASCIIDOC_OPTS += -f $$(MANUAL_$(2)_ASCIIDOC_CONF)
endif
+# Handle a2x warning about --destination-dir option only applicable to HTML
+# based outputs. So:
+# - use the --destination-dir option if possible (html and split-html),
+# - otherwise copy the generated manual to the output directory
+MANUAL_$(2)_A2X_OPTS =
+ifneq ($$(filter $(3),html split-html),)
+MANUAL_$(2)_A2X_OPTS += --destination-dir="$$(@D)"
+else
+define MANUAL_$(2)_INSTALL_CMDS
+ $$(Q)cp -f $$(BUILD_DIR)/$(1)/$(1).$(4) $$(@D)
+endef
+endif
+
$$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \
$$($$(call UPPERCASE,$(1))_SOURCES) \
manual-check-dependencies \
@@ -78,9 +91,11 @@ $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt \
$$(Q)$$(call MESSAGE,"Generating $(5) $(1)...")
$$(Q)mkdir -p $$(@D)
$$(Q)a2x $(6) -f $(2) -d book -L -r $$(TOPDIR)/docs/images \
+ $$(MANUAL_$(2)_A2X_OPTS) \
--asciidoc-opts="$$(MANUAL_$(2)_ASCIIDOC_OPTS)" \
- -D $$(@D) \
$$(BUILD_DIR)/$(1)/$(1).txt
+# install the generated manual
+ $$(MANUAL_$(2)_INSTALL_CMDS)
endef
################################################################################