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 '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.
|
|
|
|
#
|
2018-11-14 09:47:01 +00:00
|
|
|
# OSMO_GSM_MANUALS_DIR = ..
|
2017-10-19 03:11:57 +00:00
|
|
|
# DOCBOOKS = osmo_yada.xml osmo_moo.xml
|
2020-10-28 15:03:54 +00:00
|
|
|
# DOCBOOKS_DEPS = $(srcdir)/for_all/*.xml
|
2018-11-14 09:47:01 +00:00
|
|
|
# include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.docbook.inc
|
2017-10-19 03:11:57 +00:00
|
|
|
# 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)
|
|
|
|
|
2020-10-29 00:06:25 +00:00
|
|
|
# Allow the users to re-define the include directory
|
2023-05-16 09:42:44 +00:00
|
|
|
INC_DIR ?= $(shell pwd)/generated
|
2020-10-29 00:06:25 +00:00
|
|
|
|
2017-10-19 03:11:57 +00:00
|
|
|
# Lint the file
|
|
|
|
%.xml-lint: %.xml
|
|
|
|
xmllint --xinclude --postvalid --noout $<
|
|
|
|
|
2023-05-11 13:36:43 +00:00
|
|
|
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
|
|
|
|
GIT_DATE := $(shell $(OSMO_GSM_MANUALS_DIR)/build/unix-time-to-fmt.py `git log -n 1 "--pretty=%at" ../.`)
|
|
|
|
ifeq (,$(BUILD_RELEASE))
|
|
|
|
REVNUMBER := DRAFT $(GIT_VERSION)
|
|
|
|
else
|
|
|
|
REVNUMBER := $(GIT_VERSION)
|
|
|
|
endif
|
|
|
|
|
2017-10-19 03:11:57 +00:00
|
|
|
# Create a PDF file and lint it before
|
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
|
|
|
# xslt path: find includes in both $(OSMO_GSM_MANUALS_DIR)/common/chapters and $(builddir)/generated
|
2018-11-13 15:33:44 +00:00
|
|
|
%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS) build common
|
2023-05-11 13:36:43 +00:00
|
|
|
set -x && \
|
|
|
|
export GIT_DATE="$(GIT_DATE)" && \
|
|
|
|
export REVNUMBER="$(REVNUMBER)" && \
|
|
|
|
export TEMPFILE="$(INC_DIR)/_temp_$(notdir $<)" && \
|
|
|
|
$(OSMO_GSM_MANUALS_DIR)/build/docbook-set-revhistory.py "$<" && \
|
2023-08-04 09:33:02 +00:00
|
|
|
dblatex \
|
|
|
|
--config $(OSMO_GSM_MANUALS_DIR)/build/dblatex_config.xml \
|
|
|
|
--xslt-opts="--path $(realpath $(OSMO_GSM_MANUALS_DIR))/common/chapters:$(INC_DIR)" \
|
|
|
|
$(dblatex_quiet) \
|
|
|
|
-P draft.mode=no \
|
|
|
|
-o $@ \
|
|
|
|
"$$TEMPFILE" && \
|
2023-05-11 13:36:43 +00:00
|
|
|
rm $$TEMPFILE
|