From 5be5350c8dadb0d87d81eb39ce7592f2926a48af Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 29 Oct 2020 01:28:25 +0700 Subject: [PATCH] Makefile.vty-reference.inc: create 'generated' in this file Ideally, 'vty_reference_combine.sh' should not create any files nor directories on its own; it should do exactly what its name suggests - combine several XML files into a single one. Let's first make the target directory ('generated') creation a task of 'Makefile.vty-reference.inc', and then make it output the results to stdout in a follow-up change. Change-Id: Iabe729af22c235cf9c4b252acda99b43ebcae20c Related: SYS#4937 --- build/Makefile.vty-reference.inc | 27 ++++++++++++++++----------- build/vty_reference_combine.sh | 1 - 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/build/Makefile.vty-reference.inc b/build/Makefile.vty-reference.inc index c1db67b..9e22925 100644 --- a/build/Makefile.vty-reference.inc +++ b/build/Makefile.vty-reference.inc @@ -49,47 +49,52 @@ DOCBOOKS = $(VTY_REFERENCE) -# First VTY reference -DOCBOOKS_DEPS = generated/docbook_vty.xml +# Directory for intermediate results +GEN_DIR = generated -# Additional VTY references: prepend "generated/docbook_" +# First VTY reference +DOCBOOKS_DEPS = $(GEN_DIR)/docbook_vty.xml + +# Additional VTY references: prepend "$(GEN_DIR)/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))) +# DOCBOOK_DEPS = $(GEN_DIR)/docbook_vty.xml $(GEN_DIR)/docbook_osmogbproxy-vty-reference.xml +DOCBOOKS_DEPS += $(patsubst %,$(GEN_DIR)/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 +CLEAN_FILES += $(GEN_DIR) CLEAN_FILES += $(BUILT_REFERENCE_XML) # First VTY reference -generated/docbook_vty.xml: \ +$(GEN_DIR)/docbook_vty.xml: \ $(srcdir)/vty/*xml \ $(BUILT_REFERENCE_XML) \ $(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \ $(OSMO_GSM_MANUALS_DIR)/common/chapters/vty.xml \ $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl + mkdir -p $(GEN_DIR) $(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \ $$($(OSMO_GSM_MANUALS_DIR)/build/find_existing_path.sh "vty/*reference.xml" $(builddir) $(srcdir)) \ $(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \ $(srcdir)/vty/*additions*.xml - xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl generated/combined.xml \ - > generated/docbook_vty.xml + xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl $(GEN_DIR)/combined.xml \ + > $(GEN_DIR)/docbook_vty.xml # Additional VTY references -generated/docbook_%-vty-reference.xml: \ +$(GEN_DIR)/docbook_%-vty-reference.xml: \ $(srcdir)/vty-%/*xml \ $(BUILT_REFERENCE_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_NAME="vty-$(patsubst generated/docbook_%-vty-reference.xml,%,$@)" && \ + export VTYDIR_NAME="vty-$(patsubst $(GEN_DIR)/docbook_%-vty-reference.xml,%,$@)" && \ export VTYDIR_SRC="$(srcdir)/$$VTYDIR_NAME" && \ export VTYDIR_BUILD="$(builddir)/$$VTYDIR_NAME" && \ export VTYGEN="$@_combine" && \ + mkdir -p $$VTYGEN && \ $(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \ $$($(OSMO_GSM_MANUALS_DIR)/build/find_existing_path.sh "*reference.xml" $$VTYDIR_BUILD $$VTYDIR_SRC) \ $(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \ diff --git a/build/vty_reference_combine.sh b/build/vty_reference_combine.sh index 6ab279e..11e84c0 100755 --- a/build/vty_reference_combine.sh +++ b/build/vty_reference_combine.sh @@ -20,7 +20,6 @@ combined="$VTYGEN/combined.xml" combine_src="$VTYGEN/combine_src.xml" set -x -mkdir -p "$VTYGEN" cp $reference "$combined" while [ -n "$1" ]; do