refactor Makefile build rules, don't use the FORCE

The initial goal was to make sure we don't have overall FORCE rules causing
unnecessary rebuilds -- annoying while writing documentation. As I looked
through possible dependencies, I finally understood what's going on here.

Remove code dup and nicely sort which belongs where in build/Makefile.*.inc. In
each, describe in a top comment how to use it, and also unify how they are
used:

- Rename Makefile.inc to Makefile.docbook.inc and refactor
- Add Makefile.vty-reference.inc
- Add Makefile.common.inc

Make sure that we accurately pick up all dependencies.

Drop use of the macro called 'command', that silenced the actual command lines
invoked and replaced them with short strings: it obscures what is actually
going on and makes the Makefiles hard to read and understand.

Each manual's makefile is greatly reduced to few definitions and a Makefile
include, e.g. one for asciidoc, one for VTY reference.

Move common/bsc_vty_additions.xml to OsmoBSC/vty/libbsc_vty_additions.xml, link
from OsmoNITB. It applies only to OsmoBSC and OsmoNITB.

Add a script that combines a VTY reference file with *all* additions files
found in a manual's vty/ dir. Call this from Makefile.vty-reference.inc.

Change-Id: I9758e04162a480e28c7dc83475b514cf7fd25ec0
This commit is contained in:
Neels Hofmeyr 2017-10-19 05:11:57 +02:00
parent 644bcae369
commit 68a9801c88
19 changed files with 206 additions and 443 deletions

View File

@ -1,54 +1,11 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-bsc-vty-docbook
topdir = .
bsc_reference = $(topdir)/osmobsc-vty-reference.xml
manuals = $(bsc_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmobsc-usermanual osmux-reference aoip-mgw-options
TOPDIR = ..
ASCIIDOC = osmobsc-usermanual.adoc osmux-reference.adoc aoip-mgw-options.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmobsc-usermanual.pdf: chapters/*.adoc
osmux-reference.pdf: osmux-reference.adoc
aoip-mgw-options.pdf: aoip-mgw-options.adoc
aoip-mgw-options.pdf: aoip-mgw-options.adoc mgw/*.msc
clean:
-rm -rf $(cleanfiles)
-rm osmobsc-usermanual__*.png
-rm osmobsc-usermanual__*.svg
-rm osmobsc-usermanual*.check
-rm osmux-reference*.check
-rm aoip-mgw-options*.png
-rm aoip-mgw-options*.svg
-rm aoip-mgw-options*.check
-rm osmux-reference__*.svg
-rm osmux-reference__*.png
-rm osmux-reference__*.check
VTY_REFERENCE = osmobsc-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
gen-bsc-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/bsc_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/bsc_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common BSC VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/bsc_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging BSC VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting BSC VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,50 +1,12 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-bts-vty-docbook
topdir = .
bts_reference = $(topdir)/osmobts-vty-reference.xml
manuals = $(bts_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmobts-usermanual osmobts-abis rtp-amr
TOPDIR = ..
ASCIIDOC = osmobts-usermanual.adoc osmobts-abis.adoc rtp-amr.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmobts-abis.pdf: abis/*.adoc abis/*.msc
osmobts-usermanual.pdf: chapters/*.adoc
osmobts-abis.pdf: abis/*.adoc abis/*.msc
rtp-amr.pdf: dtx.dot
clean:
-rm -rf $(cleanfiles)
-rm osmobts-abis__*.png
-rm osmobts-abis__*.svg
-rm rtp-amr__*.png
-rm rtp-amr__*.svg
-rm osmobts-usermanual__*.png
-rm osmobts-usermanual__*.svg
-rm osmobts-abis*.check
-rm osmobts-usermanual*.check
VTY_REFERENCE = osmobts-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
gen-bts-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/bts_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/ns_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common NS VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/bts_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging BTS VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting BTS VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,39 +1,10 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-ggsn-vty-docbook
topdir = .
ggsn_reference = $(topdir)/osmoggsn-vty-reference.xml
manuals = $(ggsn_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmoggsn-usermanual
TOPDIR = ..
ASCIIDOC = osmoggsn-usermanual.adoc
ASCIIDOC_DEPS = chapters/*.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmoggsn-usermanual.pdf: chapters/*.adoc
VTY_REFERENCE = osmoggsn-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
clean:
-rm -rf $(cleanfiles)
-rm osmoggsn-usermanual__*.svg osmoggsn-usermanual__*.png
-rm osmoggsn-usermanual.check
gen-ggsn-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/ggsn_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/vty/ggsn_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging GGSN VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined2.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting GGSN VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,12 +1,7 @@
TOPDIR := ..
ASCIIDOCS := osmo-gsm-tester-manual
TOPDIR = ..
ASCIIDOC = osmo-gsm-tester-manual.adoc
ASCIIDOC_DEPS = chapters/*.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmo-gsm-tester-manual.pdf: chapters/*.adoc
clean:
-rm -rf $(cleanfiles)
-rm osmo-gsm-tester-manual__*.svg
-rm osmo-gsm-tester-manual__*.png
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,42 +1,10 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
topdir = .
hlr_reference = $(topdir)/osmohlr-vty-reference.xml
manuals = $(hlr_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmohlr-usermanual
TOPDIR = ..
ASCIIDOC = osmohlr-usermanual.adoc
ASCIIDOC_DEPS = chapters/*.adoc *.vty *.ctrl
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmohlr-usermanual.pdf: chapters/*.adoc generated/docbook_vty.xml
VTY_REFERENCE = osmohlr-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
clean:
-rm -rf $(cleanfiles)
-rm osmohlr-usermanual__*.svg
-rm osmohlr-usermanual__*.png
-rm osmohlr-usermanual.check
generated/docbook_vty.xml: osmohlr-vty-reference.xml vty/*xml ../common/vty_additions.xml ../vty_reference.xsl
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/hlr_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/bsc_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common BSC VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/hlr_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging HLR VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting HLR VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,31 +1,6 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
TOPDIR = ..
EXTRA_DEPS = gen-mgcp-vty-docbook
VTY_REFERENCE = osmomgcp-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
topdir = .
mgcp_reference = $(topdir)/osmomgcp-vty-reference.xml
manuals = $(mgcp_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
include ../build/Makefile.inc
clean:
-rm -rf $(cleanfiles)
gen-mgcp-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/mgcp_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/vty/mgcp_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging MGCP VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined2.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting MGCP VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,42 +1,10 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
topdir = .
msc_reference = $(topdir)/osmomsc-vty-reference.xml
manuals = $(msc_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmomsc-usermanual
TOPDIR = ..
ASCIIDOC = osmomsc-usermanual.adoc
ASCIIDOC_DEPS = chapters/*.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmomsc-usermanual.pdf: chapters/*.adoc generated/docbook_vty.xml
VTY_REFERENCE = osmomsc-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
clean:
-rm -rf $(cleanfiles)
-rm osmomsc-usermanual__*.svg
-rm osmomsc-usermanual__*.png
-rm osmomsc-usermanual.check
generated/docbook_vty.xml: osmomsc-vty-reference.xml vty/*xml ../common/vty_additions.xml ../vty_reference.xsl
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/msc_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/bsc_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common BSC VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/msc_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging MSC VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting MSC VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,31 +1,6 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
TOPDIR = ..
EXTRA_DEPS = gen-nat-vty-docbook
VTY_REFERENCE = osmonat-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
topdir = .
nat_reference = $(topdir)/osmonat-vty-reference.xml
manuals = $(nat_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
include ../build/Makefile.inc
clean:
-rm -rf $(cleanfiles)
gen-nat-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/nat_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/vty/nat_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging NAT VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined2.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting NAT VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,44 +1,10 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-nitb-vty-docbook
topdir = .
nitb_reference = $(topdir)/osmonitb-vty-reference.xml
manuals = $(nitb_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmonitb-usermanual
TOPDIR = ..
ASCIIDOC = osmonitb-usermanual.adoc
ASCIIDOC_DEPS = chapters/*.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmonitb-usermanual.pdf: chapters/*.adoc
VTY_REFERENCE = osmonitb-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
clean:
-rm -rf $(cleanfiles)
-rm osmonitb-usermanual__*.svg
-rm osmonitb-usermanual__*.png
-rm osmonitb-usermanual.check
gen-nitb-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/nitb_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/bsc_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common BSC VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/nitb_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging NITB VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting NITB VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -0,0 +1 @@
../../OsmoBSC/vty/bsc_vty_additions.xml

View File

@ -1,45 +1,11 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-vty-docbook
topdir = .
pcu_reference = $(topdir)/osmopcu-vty-reference.xml
manuals = $(bts_manual) $(pcu_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmopcu-usermanual osmopcu-gb
TOPDIR = ..
ASCIIDOC = osmopcu-usermanual.adoc osmopcu-gb.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmopcu-gb.pdf: gb/*.adoc gb/*.msc
osmopcu-usermanual.pdf: chapters/*.adoc
clean:
-rm -rf $(cleanfiles)
-rm -rf gen-vty-docbook
-rm osmopcu-usermanual__*.png
-rm osmopcu-usermanual__*.svg
-rm osmopcu-usermanual.check
gen-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/osmo-pcu_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/vty/osmo-pcu_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging PCU VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined2.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting PCU VTY to DocBook)
VTY_REFERENCE = osmopcu-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,43 +1,10 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
EXTRA_DEPS = gen-sgsn-vty-docbook
topdir = .
sgsn_reference = $(topdir)/osmosgsn-vty-reference.xml
manuals = $(sgsn_reference)
# types = pdf txt rtf ps xhtml html man tex texi dvi
# types = pdf txt
types = $(docbooktotypes)
docbooktotypes = pdf
# htmlcssfile =
# htmlcss =
TOPDIR := ..
ASCIIDOCS := osmosgsn-usermanual
TOPDIR = ..
ASCIIDOC = osmosgsn-usermanual.adoc
ASCIIDOC_DEPS = chapters/*.adoc
include $(TOPDIR)/build/Makefile.asciidoc.inc
include $(TOPDIR)/build/Makefile.inc
osmosgsn-usermanual.pdf: chapters/*.adoc
VTY_REFERENCE = osmosgsn-vty-reference.xml
include $(TOPDIR)/build/Makefile.vty-reference.inc
clean:
-rm -rf $(cleanfiles)
-rm osmosgsn-usermanual__*.svg osmosgsn-usermanual__*.png
-rm osmosgsn-usermanual.check
gen-sgsn-vty-docbook: FORCE
$(call command,xsltproc -o generated/combined1.xml \
--stringparam with $(PWD)/../common/vty_additions.xml \
$(MERGE_DOC) vty/sgsn_vty_reference.xml, \
XSLTPROC,Merging Common VTY)
$(call command,xsltproc -o generated/combined2.xml \
--stringparam with $(PWD)/../common/ns_vty_additions.xml \
$(MERGE_DOC) generated/combined1.xml, \
XSLTPROC,Merging Common NS VTY)
$(call command,xsltproc -o generated/combined3.xml \
--stringparam with $(PWD)/vty/sgsn_vty_additions.xml \
$(MERGE_DOC) generated/combined2.xml, \
XSLTPROC,Merging SGSN VTY)
$(call command,xsltproc ../vty_reference.xsl generated/combined3.xml > generated/docbook_vty.xml, \
XSLTPROC,Converting SGSN VTY to DocBook)
include $(TOPDIR)/build/Makefile.common.inc

View File

@ -1,19 +1,38 @@
# USAGE:
#
# - define 'TOPDIR' to point at the git root,
# - define in 'ASCIIDOC' all root .adoc files,
# - optionally define in 'ASCIIDOC_DEPS' all dependencies common to all .adocs,
# - include this file,
# - optionally define further dependencies for individual .pdf targets.
#
# e.g.
#
# TOPDIR = ..
# ASCIIDOC = osmo_yada.adoc osmo_moo.adoc
# ASCIIDOC_DEPS = for_all/*.adoc
# include $(TOPDIR)/build/Makefile.asciidoc.inc
# osmo_yada.pdf: yada/*.adoc yada/*.msc
BUILDDIR = $(TOPDIR)/build
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
GIT_DATE := $(shell $(TOPDIR)/build/unix-time-to-fmt.py `git log -n 1 "--pretty=%at" ../.`)
# prepend the document name with the version numbe suffix
#DOCS_VER = $(foreach P, $(ASCIIDOCS), $(P)-v$(shell xmllint --recover --xpath "//revnumber[position()=last()]/text()" $(P)-docinfo.xml 2>/dev/null))
#DOCS_VER = $(foreach P, $(ASCIIDOC_NAME), $(P)-v$(shell xmllint --recover --xpath "//revnumber[position()=last()]/text()" $(P)-docinfo.xml 2>/dev/null))
#PDFS = $(DOCS_VER:%=%.pdf)
# generate list of PDFs that we're supposed to render
ASCIIDOCPDFS = $(ASCIIDOCS:%=%.pdf)
ASCIIDOC_CHECKS = $(ASCIIDOCS:%=%.check)
ASCIIDOC_NAME = $(patsubst %.adoc,%,$(ASCIIDOC))
ASCIIDOC_PDF = $(ASCIIDOC_NAME:%=%.pdf)
ASCIIDOC_CHECKS = $(ASCIIDOC_NAME:%=%.check)
ASCIIDOCSTYLE ?= $(BUILDDIR)/custom-dblatex.sty
cleanfiles += $(ASCIIDOCPDFS)
CLEAN_FILES += $(ASCIIDOC_NAME:%=%__*.png) $(ASCIIDOC_NAME:%=%__*.svg) $(ASCIIDOC_CHECKS)
CLEAN_FILES += $(ASCIIDOC_PDF)
UPLOAD_FILES += $(ASCIIDOC_PDF)
ASCIIDOC_OPTS := -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf -f $(BUILDDIR)/docinfo-releaseinfo.conf -f $(BUILDDIR)/python2-filter.conf
DBLATEX_OPTS := -s $(ASCIIDOCSTYLE) -P draft.mode=yes -P draft.watermark=0
@ -27,9 +46,13 @@ endif
A2X_OPTS := -L --asciidoc-opts="$(ASCIIDOC_OPTS)" --dblatex-opts="$(DBLATEX_OPTS)" -a docinfo -a revnumber="$(REVNUMBER)" -a revdate="$(GIT_DATE)"
all: $(ASCIIDOCPDFS)
all: $(ASCIIDOC_PDF)
$(ASCIIDOCPDFS): %.pdf: %.adoc %-docinfo.xml $(ASCIIDOCSTYLE) $(TOPDIR)/common/chapters/*.adoc
$(ASCIIDOC_PDF): %.pdf: %.adoc %-docinfo.xml \
$(ASCIIDOC_DEPS) \
$(ASCIIDOCSTYLE) \
$(TOPDIR)/common/*/*.adoc \
$(TOPDIR)/common/images/*
@test -n "$(BUILD_RELEASE)" && echo -e "\n\n\
NOTE: TO REMOVE DRAFT MODE, YOU NEED TO EDIT build/custom-dblatex.sty\n\
and remove three lines starting with '% \"DRAFT\" on first page'\n" \

14
build/Makefile.common.inc Normal file
View File

@ -0,0 +1,14 @@
# Usage:
#
# Other makefiles like Makefile.asciidoc.inc and Makefile.vty-reference.inc add
# entries to UPLOAD_FILES and CLEAN_FILES.
#
# Include this file at the end to have 'upload' and 'clean' targets.
UPLOAD_PATH ?= generic@sysmocom-downloads:documents
upload: $(UPLOAD_FILES)
rsync -avz $(UPLOAD_FILES) $(UPLOAD_PATH)/
clean:
-rm -rf $(CLEAN_FILES)

View File

@ -0,0 +1,35 @@
# USAGE:
#
# - define 'TOPDIR' to point at the git root,
# - define in 'DOCBOOKS' all root .xml files,
# - optionally define in 'DOCBOOKS_DEPS' all dependencies common to all .xmls,
# - include this file,
# - optionally define further dependencies for individual .pdf targets.
#
# e.g.
#
# TOPDIR = ..
# DOCBOOKS = osmo_yada.xml osmo_moo.xml
# ASCIIDOC_DEPS = for_all/*.xml
# include $(TOPDIR)/build/Makefile.docbook.inc
# osmo_yada.pdf: yada/*.xml
#
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals, edited.
DOCBOOKS_PDF = $(patsubst %.xml,%.pdf,$(DOCBOOKS))
lint = $(patsubst %.xml,%.lint,$(DOCBOOKS))
CLEAN_FILES += $(DOCBOOKS_PDF) $(lint)
UPLOAD_FILES += $(DOCBOOKS_PDF)
all: $(DOCBOOKS_PDF)
# Lint the file
%.xml-lint: %.xml
xmllint --xinclude --postvalid --noout $<
# Create a PDF file and lint it before
%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS)
dblatex $(dblatex_quiet) -P draft.mode=no $<

View File

@ -1,47 +0,0 @@
# XSL stylesheets downloaded from http://docbook.sourceforge.net/release/xsl/current/html/
# Makefile from BitBake/OpenEmbedded manuals
LIBOSMO_DIR ?= ~/source/gsm/libosmocore
MERGE_DOC := $(LIBOSMO_DIR)/doc/vty/merge_doc.xsl
UPLOAD_PATH ?= generic@sysmocom-downloads:documents
pdfs = $(patsubst %.xml,%.pdf,$(manuals))
lint = $(patsubst %.xml,%.xml-lint,$(manuals))
#cleanfiles = $(foreach i,$(types),$(topdir)/$(i))
cleanfiles += $(pdfs) $(lint)
ifdef DEBUG
dblatex_quiet =
define command
$(1)
endef
else
dblatex_quiet = -q
define command
@echo $(2) $(3)
@$(1)
endef
endif
all: $(types)
$(types): FORCE
pdf: $(pdfs) $(manuals)
# Lint the file
%.xml-lint: %.xml FORCE
$(call command,xmllint --xinclude --postvalid --noout $<,XMLLINT,$<)
# Create a PDF file and lint it before
%.pdf: %.xml %.xml-lint $(EXTRA_DEPS) FORCE
$(call command,dblatex $(dblatex_quiet) -P draft.mode=no $<,DBLATEX,$<)
upload: $(pdfs) $(ASCIIDOCPDFS)
rsync -avz $(pdfs) $(ASCIIDOCPDFS) $(UPLOAD_PATH)/
FORCE:

View File

@ -0,0 +1,42 @@
# Usage:
# Have files:
# - osmoyada-vty-reference.xml
# A docbook root XML including a &chapter-vty; reference.
# - vty/*additions*.xml
# Manual additions to specific VTY nodes, any number of files.
# - vty/*_reference.xml
# Export from VTY 'show online-help', exactly one file.
#
# In your Makefile,
# - define 'TOPDIR' to point at the git root,
# - define the (single) name of the vty-reference source in VTY_REFERENCE,
# - include this file.
#
# e.g.
#
# TOPDIR = ..
# VTY_REFERENCE = osmofoo-vty-reference
# include $(TOPDIR)/build/Makefile.vty-reference.inc
#
# This uses the Makefile.docbook.inc, you should not mix uses of
# Makefile.vty-reference.inc and Makefile.docbook.inc.
DOCBOOKS = $(VTY_REFERENCE)
DOCBOOKS_DEPS = generated/docbook_vty.xml
include $(TOPDIR)/build/Makefile.docbook.inc
LIBOSMO_DIR ?= ~/source/gsm/libosmocore
MERGE_DOC = $(LIBOSMO_DIR)/doc/vty/merge_doc.xsl
CLEAN_FILES += generated
generated/docbook_vty.xml: \
vty/*xml \
$(TOPDIR)/common/vty_additions.xml \
$(TOPDIR)/common/chapters/vty.xml \
$(TOPDIR)/vty_reference.xsl
$(TOPDIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \
$(TOPDIR)/common/vty_additions.xml \
vty/*additions*.xml
xsltproc $(TOPDIR)/vty_reference.xsl generated/combined.xml \
> generated/docbook_vty.xml

25
build/vty_reference_combine.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
# the first argument should point at libosmocore/doc/vty/merge_doc.xsl
MERGE_DOC="$1"
shift
combined="generated/combined.xml"
combine_src="generated/combine_src.xml"
reference="vty/*reference.xml"
test "$(ls -1 $reference | wc -l)" = "1"
set -x
mkdir -p generated
cp $reference "$combined"
while [ -n "$1" ]; do
addition="$(realpath "$1")"
shift
mv "$combined" "$combine_src"
xsltproc -o "$combined" \
--stringparam with "$addition" \
"$MERGE_DOC" "$combine_src"
done