mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-11-03 13:43:18 +00:00
Unfortunately, we cannot re-use the existing Makefile rules from: $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc because they do not allow to generate the list of $(DOCBOOKS) from a template, and require the project to store everything in separate folders with specific names. Also, those rules expect that the target PDFs contain only a single word in their names (for example, 'osmoapp-vty-reference', not 'osmo-app-vty-reference'), while in a project with multiple similarly named targets this would reduce readability (imagine 'osmotrxuhd-vty-reference'). Change-Id: I798ea3b7417b8ca3e9c7d50911158c5413526237 Depends: I6aac73d998c5937894233631e654a160d5623198 Related: SYS#4937, SYS#4910
38 lines
1.6 KiB
PHP
38 lines
1.6 KiB
PHP
DOCBOOKS = $(foreach v,$(VARIANTS),vty/osmotrx-$(v)-vty-reference.xml)
|
|
DOCBOOKS_DEPS = $(DOCBOOKS) $(addsuffix .inc,$(DOCBOOKS))
|
|
INC_DIR = $(abspath $(builddir)/vty)
|
|
|
|
include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.docbook.inc
|
|
|
|
CLEAN_FILES += $(DOCBOOKS_DEPS)
|
|
CLEAN_FILES += $(addsuffix .inc.gen,$(DOCBOOKS))
|
|
CLEAN_FILES += $(addsuffix .inc.merged,$(DOCBOOKS))
|
|
|
|
$(INC_DIR):
|
|
mkdir -p $@
|
|
|
|
vty/osmotrx-%-vty-reference.xml: $(top_builddir)/Transceiver52M/osmo-trx-% $(INC_DIR)
|
|
sed -e "s|@@GENERATED@@|$@.inc|" \
|
|
-e "s|@@VARIANT@@|$(notdir $<)|" \
|
|
-e "s|@@REV_NUMBER@@|$(VERSION)|" \
|
|
-e "s|@@REV_DATE@@|$(shell date +"%dth %B %Y")|" \
|
|
-e "s|@@CR_YEAR@@|$(shell date +"%Y")|" \
|
|
$(srcdir)/vty/osmotrx-vty-reference.xml > $@
|
|
|
|
vty/osmotrx-%-vty-reference.xml.inc: $(top_builddir)/Transceiver52M/osmo-trx-% \
|
|
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
|
|
$(OSMO_GSM_MANUALS_DIR)/common/chapters/vty.xml \
|
|
$(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl \
|
|
$(srcdir)/vty/*.xml $(INC_DIR)
|
|
# a) Invoke osmo-trx-% to generate the list of commands first
|
|
$< --vty-ref-mode default --vty-ref-xml > "$@.gen"
|
|
# ... filter garbage potentially printed by libraries to stdout
|
|
sed -i '/^<vtydoc/,$$!d' "$@.gen"
|
|
# b) Merge the result of a) with global and local additions
|
|
$(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh \
|
|
$(realpath $(OSMO_GSM_MANUALS_DIR)/merge_doc.xsl) "$@.gen" \
|
|
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
|
|
$(srcdir)/vty/*additions*.xml > "$@.merged"
|
|
# c) Convert the result of b) into a valid docbook
|
|
xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl "$@.merged" > $@
|