2017-10-19 03:11:57 +00:00
|
|
|
# USAGE:
|
|
|
|
#
|
2018-11-16 11:39:59 +00:00
|
|
|
# - define 'OSMO_GSM_MANUALS_DIR' to point at the osmo-gsm-manuals shared files
|
|
|
|
# installation path as returned by "pkg-config osmo-gsm-manuals --variable=osmogsmmanualsdir"
|
|
|
|
# (project specific repos set this with configure.ac),
|
2017-10-19 03:11:57 +00:00
|
|
|
# - 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.
|
|
|
|
#
|
2018-11-14 09:47:01 +00:00
|
|
|
# OSMO_GSM_MANUALS_DIR = ..
|
2017-10-19 03:11:57 +00:00
|
|
|
# ASCIIDOC = osmo_yada.adoc osmo_moo.adoc
|
2018-11-14 14:27:01 +00:00
|
|
|
# ASCIIDOC_DEPS = $(srcdir)/for_all/*.adoc
|
2018-11-14 09:47:01 +00:00
|
|
|
# include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.inc
|
2017-10-19 03:11:57 +00:00
|
|
|
# osmo_yada.pdf: yada/*.adoc yada/*.msc
|
|
|
|
|
2018-11-14 09:47:01 +00:00
|
|
|
BUILDDIR = $(OSMO_GSM_MANUALS_DIR)/build
|
2019-07-19 14:35:25 +00:00
|
|
|
COMMONDIR = $(OSMO_GSM_MANUALS_DIR)/common
|
2016-02-20 09:56:10 +00:00
|
|
|
|
2016-02-20 17:06:45 +00:00
|
|
|
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
|
2018-11-14 09:47:01 +00:00
|
|
|
GIT_DATE := $(shell $(OSMO_GSM_MANUALS_DIR)/build/unix-time-to-fmt.py `git log -n 1 "--pretty=%at" ../.`)
|
2016-02-20 17:06:45 +00:00
|
|
|
|
2016-02-20 09:56:10 +00:00
|
|
|
# prepend the document name with the version numbe suffix
|
2017-10-19 03:11:57 +00:00
|
|
|
#DOCS_VER = $(foreach P, $(ASCIIDOC_NAME), $(P)-v$(shell xmllint --recover --xpath "//revnumber[position()=last()]/text()" $(P)-docinfo.xml 2>/dev/null))
|
2016-02-20 09:56:10 +00:00
|
|
|
#PDFS = $(DOCS_VER:%=%.pdf)
|
|
|
|
|
|
|
|
# generate list of PDFs that we're supposed to render
|
2017-10-19 03:11:57 +00:00
|
|
|
ASCIIDOC_NAME = $(patsubst %.adoc,%,$(ASCIIDOC))
|
|
|
|
ASCIIDOC_PDF = $(ASCIIDOC_NAME:%=%.pdf)
|
|
|
|
ASCIIDOC_CHECKS = $(ASCIIDOC_NAME:%=%.check)
|
2016-02-20 09:56:10 +00:00
|
|
|
|
|
|
|
ASCIIDOCSTYLE ?= $(BUILDDIR)/custom-dblatex.sty
|
|
|
|
|
2017-10-19 03:11:57 +00:00
|
|
|
CLEAN_FILES += $(ASCIIDOC_NAME:%=%__*.png) $(ASCIIDOC_NAME:%=%__*.svg) $(ASCIIDOC_CHECKS)
|
2018-11-12 09:54:25 +00:00
|
|
|
CLEAN_FILES += $(ASCIIDOC_PDF) $(ASCIIDOC_NAME:%=%.html)
|
2017-10-19 03:11:57 +00:00
|
|
|
UPLOAD_FILES += $(ASCIIDOC_PDF)
|
2016-02-20 09:56:10 +00:00
|
|
|
|
2020-02-10 11:22:48 +00:00
|
|
|
ABS_SRCDIR := $(or $(abs_srcdir),$(shell realpath $(srcdir)))
|
|
|
|
ASCIIDOC_OPTS := -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf -f $(BUILDDIR)/docinfo-releaseinfo.conf -a srcdir='$(ABS_SRCDIR)' -a commondir='$(COMMONDIR)'
|
2017-05-14 17:50:16 +00:00
|
|
|
DBLATEX_OPTS := -s $(ASCIIDOCSTYLE) -P draft.mode=yes -P draft.watermark=0
|
2016-02-20 17:06:45 +00:00
|
|
|
|
|
|
|
ifeq (,$(BUILD_RELEASE))
|
2017-05-14 17:50:16 +00:00
|
|
|
REVNUMBER := DRAFT $(GIT_VERSION)
|
2016-02-20 17:06:45 +00:00
|
|
|
else
|
2017-05-14 17:50:16 +00:00
|
|
|
REVNUMBER := $(GIT_VERSION)
|
2016-02-20 17:06:45 +00:00
|
|
|
endif
|
|
|
|
|
2017-05-14 17:50:16 +00:00
|
|
|
A2X_OPTS := -L --asciidoc-opts="$(ASCIIDOC_OPTS)" --dblatex-opts="$(DBLATEX_OPTS)" -a docinfo -a revnumber="$(REVNUMBER)" -a revdate="$(GIT_DATE)"
|
2016-02-20 17:06:45 +00:00
|
|
|
|
|
|
|
|
2017-10-19 03:11:57 +00:00
|
|
|
all: $(ASCIIDOC_PDF)
|
2016-02-20 09:56:10 +00:00
|
|
|
|
2017-10-19 03:11:57 +00:00
|
|
|
$(ASCIIDOC_PDF): %.pdf: %.adoc %-docinfo.xml \
|
|
|
|
$(ASCIIDOC_DEPS) \
|
|
|
|
$(ASCIIDOCSTYLE) \
|
2019-07-19 14:35:25 +00:00
|
|
|
$(COMMONDIR)/*/*.adoc \
|
|
|
|
$(COMMONDIR)/images/* \
|
2018-11-13 15:33:44 +00:00
|
|
|
build common
|
Makefile.*.inc: adjust to out-of-tree building
Makefile.asciidoc.inc: create a symlink for the root adoc file, from
which a PDF gets generated, from the srcdir to the builddir. This file
may include other adoc files, which do not get symlinked. We need to do
this, because a2x (the program generating the PDF file) does not have a
parameter for the output file, and will otherwise generate the PDF in
the srcdir instead of the builddir. Do the same in the check target, so
the relative include paths work the same.
Makefile.asciidoc.inc, Makefile.docbook.inc: set the include paths for
the xstl parser, as well as the LaTeX compiler, so they can find the
files they need from both OSMO_GSM_MANUALS_DIR and builddir.
Makefile.asciidoc.inc, Makefile.docbook.inc: refer to the output file
$@ with $(notdir $@). This removes the path from the file, like
basename from coreutils. The output file will then be placed in the
builddir instead of the srcdir.
Makefile.vty-reference.inc: use $(srcdir) in references to vty/*.xml
files.
(moving manuals to project repositories 12/19)
Related: OS#3385
Change-Id: Ie6b212a6518f0fc29fae610a37ae6c533189278d
2018-11-14 14:51:07 +00:00
|
|
|
|
|
|
|
# a2x can't use a different output file. To support out-of-tree builds,
|
|
|
|
# we create a symlink at $(builddir)/srcfile.adoc pointing at
|
|
|
|
# $(srcdir)/srcfile.adoc. $< is the $(srcdir)/srcfile.adoc,
|
|
|
|
# $(notdir) is like basename from coreutils, and $(builddir) is $PWD.
|
|
|
|
if ! [ -f $(notdir $<) ]; then \
|
|
|
|
ln -s $< $(notdir $<); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
# TEXINPUTS: find LaTeX includes like \includegraphics{./common/images/sysmocom.pdf}
|
|
|
|
# in $(OSMO_GSM_MANUALS_DIR).
|
2017-05-14 17:50:23 +00:00
|
|
|
@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" \
|
|
|
|
|| true
|
Makefile.*.inc: adjust to out-of-tree building
Makefile.asciidoc.inc: create a symlink for the root adoc file, from
which a PDF gets generated, from the srcdir to the builddir. This file
may include other adoc files, which do not get symlinked. We need to do
this, because a2x (the program generating the PDF file) does not have a
parameter for the output file, and will otherwise generate the PDF in
the srcdir instead of the builddir. Do the same in the check target, so
the relative include paths work the same.
Makefile.asciidoc.inc, Makefile.docbook.inc: set the include paths for
the xstl parser, as well as the LaTeX compiler, so they can find the
files they need from both OSMO_GSM_MANUALS_DIR and builddir.
Makefile.asciidoc.inc, Makefile.docbook.inc: refer to the output file
$@ with $(notdir $@). This removes the path from the file, like
basename from coreutils. The output file will then be placed in the
builddir instead of the srcdir.
Makefile.vty-reference.inc: use $(srcdir) in references to vty/*.xml
files.
(moving manuals to project repositories 12/19)
Related: OS#3385
Change-Id: Ie6b212a6518f0fc29fae610a37ae6c533189278d
2018-11-14 14:51:07 +00:00
|
|
|
TEXINPUTS="$(OSMO_GSM_MANUALS_DIR)" \
|
2019-08-02 09:09:01 +00:00
|
|
|
a2x -vv $(A2X_OPTS) $(notdir $<)
|
2016-10-17 04:15:34 +00:00
|
|
|
|
2019-08-02 13:41:12 +00:00
|
|
|
check:
|
|
|
|
if [ -n "$$ASCIIDOC_WARNINGS_CHECK" ]; then \
|
|
|
|
$(MAKE) $(ASCIIDOC_CHECKS); \
|
|
|
|
fi
|
2016-10-17 04:15:34 +00:00
|
|
|
|
2018-11-13 15:33:44 +00:00
|
|
|
$(ASCIIDOC_CHECKS): %.check: %.adoc %-docinfo.xml \
|
|
|
|
$(ASCIIDOCSTYLE) \
|
2019-07-19 14:35:25 +00:00
|
|
|
$(COMMONDIR)/chapters/*.adoc \
|
2018-11-13 15:33:44 +00:00
|
|
|
$(ASCIIDOC_DEPS) \
|
|
|
|
build common
|
Makefile.*.inc: adjust to out-of-tree building
Makefile.asciidoc.inc: create a symlink for the root adoc file, from
which a PDF gets generated, from the srcdir to the builddir. This file
may include other adoc files, which do not get symlinked. We need to do
this, because a2x (the program generating the PDF file) does not have a
parameter for the output file, and will otherwise generate the PDF in
the srcdir instead of the builddir. Do the same in the check target, so
the relative include paths work the same.
Makefile.asciidoc.inc, Makefile.docbook.inc: set the include paths for
the xstl parser, as well as the LaTeX compiler, so they can find the
files they need from both OSMO_GSM_MANUALS_DIR and builddir.
Makefile.asciidoc.inc, Makefile.docbook.inc: refer to the output file
$@ with $(notdir $@). This removes the path from the file, like
basename from coreutils. The output file will then be placed in the
builddir instead of the srcdir.
Makefile.vty-reference.inc: use $(srcdir) in references to vty/*.xml
files.
(moving manuals to project repositories 12/19)
Related: OS#3385
Change-Id: Ie6b212a6518f0fc29fae610a37ae6c533189278d
2018-11-14 14:51:07 +00:00
|
|
|
|
|
|
|
# out-of-tree building: use a symlink to the output file like done in
|
|
|
|
# the non-check build above, so the relative include paths work the
|
|
|
|
# same.
|
|
|
|
if ! [ -f $(notdir $<) ]; then \
|
|
|
|
ln -s $< $(notdir $<); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
asciidoc -v $(ASCIIDOC_OPTS) $(notdir $<) > $(notdir $@) 2>&1
|
|
|
|
|
2016-10-17 04:15:34 +00:00
|
|
|
# Make absolutely sure that the %.check target is updated.
|
Makefile.*.inc: adjust to out-of-tree building
Makefile.asciidoc.inc: create a symlink for the root adoc file, from
which a PDF gets generated, from the srcdir to the builddir. This file
may include other adoc files, which do not get symlinked. We need to do
this, because a2x (the program generating the PDF file) does not have a
parameter for the output file, and will otherwise generate the PDF in
the srcdir instead of the builddir. Do the same in the check target, so
the relative include paths work the same.
Makefile.asciidoc.inc, Makefile.docbook.inc: set the include paths for
the xstl parser, as well as the LaTeX compiler, so they can find the
files they need from both OSMO_GSM_MANUALS_DIR and builddir.
Makefile.asciidoc.inc, Makefile.docbook.inc: refer to the output file
$@ with $(notdir $@). This removes the path from the file, like
basename from coreutils. The output file will then be placed in the
builddir instead of the srcdir.
Makefile.vty-reference.inc: use $(srcdir) in references to vty/*.xml
files.
(moving manuals to project repositories 12/19)
Related: OS#3385
Change-Id: Ie6b212a6518f0fc29fae610a37ae6c533189278d
2018-11-14 14:51:07 +00:00
|
|
|
touch $(notdir $@)
|
2016-10-17 04:15:34 +00:00
|
|
|
# Do print the WARNING output but return error if any was found
|
|
|
|
# (grep -v would omit the WARNING output from the log).
|
Makefile.*.inc: adjust to out-of-tree building
Makefile.asciidoc.inc: create a symlink for the root adoc file, from
which a PDF gets generated, from the srcdir to the builddir. This file
may include other adoc files, which do not get symlinked. We need to do
this, because a2x (the program generating the PDF file) does not have a
parameter for the output file, and will otherwise generate the PDF in
the srcdir instead of the builddir. Do the same in the check target, so
the relative include paths work the same.
Makefile.asciidoc.inc, Makefile.docbook.inc: set the include paths for
the xstl parser, as well as the LaTeX compiler, so they can find the
files they need from both OSMO_GSM_MANUALS_DIR and builddir.
Makefile.asciidoc.inc, Makefile.docbook.inc: refer to the output file
$@ with $(notdir $@). This removes the path from the file, like
basename from coreutils. The output file will then be placed in the
builddir instead of the srcdir.
Makefile.vty-reference.inc: use $(srcdir) in references to vty/*.xml
files.
(moving manuals to project repositories 12/19)
Related: OS#3385
Change-Id: Ie6b212a6518f0fc29fae610a37ae6c533189278d
2018-11-14 14:51:07 +00:00
|
|
|
@grep WARNING $(notdir $@) && exit 1 || exit 0
|