summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-12-02 13:58:32 +0100
committerOliver Smith <osmith@sysmocom.de>2019-12-03 11:44:57 +0100
commita05e5940f1a1aafb4709633b8eaf391da4033cba (patch)
tree4b9bfd5fa7de84208dd77a93d820406076a4872e
parent6ddd200cdaf2f1b1355ed61bf7630526b7a1120a (diff)
Support multiple VTY reference manuals
Adjust vty_reference_combine.sh, so we can change the output dir from "generated" to a subdir inside "generated" when building anything but the first VTY reference. Add a generic pattern to Makefile.vty-reference for additional VTY references, that uses slightly different paths compared to the first VTY reference, in order to avoid collisions. Related: OS#4292 Change-Id: I4dea3e07b88175b2a88e577129360af7ec5f87e1
-rw-r--r--build/Makefile.vty-reference.inc36
-rwxr-xr-xbuild/vty_reference_combine.sh10
2 files changed, 43 insertions, 3 deletions
diff --git a/build/Makefile.vty-reference.inc b/build/Makefile.vty-reference.inc
index 0129a5c..b2daf8a 100644
--- a/build/Makefile.vty-reference.inc
+++ b/build/Makefile.vty-reference.inc
@@ -22,15 +22,37 @@
#
# This uses the Makefile.docbook.inc, you should not mix uses of
# Makefile.vty-reference.inc and Makefile.docbook.inc.
+#
+# In order to add more than one VTY reference, do this for each additional one:
+# - Extend VTY_REFERENCE with the new entry, make sure it ends in "-vty-reference.xml":
+# VTY_REFERENCE = osmofoo-vty-reference.xml osmobar-vty-reference.xml
+# - Create a new osmobar-vty-reference.xml file, just like osmofoo-vty-reference.xml, but with
+# "generated/docbook_osmobar-vty-reference.xml" as sections-vty path instead of
+# "generated/docbook_vty.xml".
+# - Create vty-osmobar/*_additions.xml and vty-osmobar/*_reference.xml. Pay attention to the
+# directory name, it must start with vty-* instead of "vty" and it must match the prefix of
+# your new VTY_REFERENCE entry ("vty-osmobar" in this example).
+# - Add osmobar-vty-reference.xml and vty-osmobar to EXTRA_DIST in Makefile.am.
+# - Full example: osmo-sgsn.git I24c3ca2fc2446673edceefb797c7d800c3a1a5d2
DOCBOOKS = $(VTY_REFERENCE)
+
+# First VTY reference
DOCBOOKS_DEPS = generated/docbook_vty.xml
+
+# Additional VTY references: prepend "generated/docbook_"
+# For example:
+# VTY_REFERENCE = osmosgsn-vty-reference.xml osmogbproxy-vty-reference.xml
+# DOCBOOK_DEPS = generated/docbook_vty.xml generated/docbook_osmogbproxy-vty-reference.xml
+DOCBOOKS_DEPS += $(patsubst %,generated/docbook_%,$(filter-out $(firstword $(VTY_REFERENCE)),$(VTY_REFERENCE)))
+
include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.docbook.inc
MERGE_DOC = $(shell realpath $(OSMO_GSM_MANUALS_DIR)/merge_doc.xsl)
CLEAN_FILES += generated
+# First VTY reference
generated/docbook_vty.xml: \
$(srcdir)/vty/*xml \
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
@@ -42,3 +64,17 @@ generated/docbook_vty.xml: \
$(srcdir)/vty/*additions*.xml
xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl generated/combined.xml \
> generated/docbook_vty.xml
+
+# Additional VTY references
+generated/docbook_%-vty-reference.xml: \
+ $(srcdir)/vty-%/*xml \
+ $(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
+ $(OSMO_GSM_MANUALS_DIR)/common/chapters/vty.xml \
+ $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl
+ export VTYDIR="$(srcdir)/vty-$(patsubst generated/docbook_%-vty-reference.xml,%,$@)" && \
+ export VTYGEN="$@_combine" && \
+ $(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \
+ $$VTYDIR/*reference.xml \
+ $(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
+ $$VTYDIR/*additions*.xml && \
+ xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl $$VTYGEN/combined.xml > "$@"
diff --git a/build/vty_reference_combine.sh b/build/vty_reference_combine.sh
index 449b227..6ab279e 100755
--- a/build/vty_reference_combine.sh
+++ b/build/vty_reference_combine.sh
@@ -3,6 +3,10 @@
# see Makefile.vty-reference.inc
set -e
+# Allow overriding the "generated" output dir, so we don't have collisions when building multiple VTY references in one
+# Osmocom project (OS#4292)
+VTYGEN=${VTYGEN:-generated}
+
# first argument: merge_doc.xsl
MERGE_DOC="$1"
shift
@@ -12,11 +16,11 @@ reference="$1"
test "$(ls -1 $reference | wc -l)" = "1"
shift
-combined="generated/combined.xml"
-combine_src="generated/combine_src.xml"
+combined="$VTYGEN/combined.xml"
+combine_src="$VTYGEN/combine_src.xml"
set -x
-mkdir -p generated
+mkdir -p "$VTYGEN"
cp $reference "$combined"
while [ -n "$1" ]; do