*filter.conf/*.sty: use symlinks to build, common

$(OSMO_GSM_MANUALS_DIR) is used in most places to reference to the top
dir, which contains "build" and "common". But not in the asciidoc
mscgen filter configurations, and in the custom LaTeX style. They have
../common or ../build hardcoded, which won't work anymore when the
project specific files will be in another repository.

Update the Makefiles to create symlinks to "build" and "common" in the
dir where the build was started. Use ./common in the files that had
../common hardcoded, and do the same for ./build.

Update the Makefile.common.inc comment to refer to common targets in
general, so we don't need to list each single one there (like the new
'common' and 'build' targets).

I've also thought about using variables there, but this would only work
for the asciidoc files, not for the .sty file. We would need to
generate the latter from another file and replace the variable
dynamically. Having the symlinks instead seemed to be slightly easier.

(moving manuals to project repositories 7/19)

Related: OS#3385
Change-Id: I4cfd1a9ef482d382f10cdf060e8e2cba81852864
This commit is contained in:
Oliver Smith 2018-11-13 16:33:44 +01:00
parent 8d282762d9
commit 06d1805c5b
7 changed files with 25 additions and 8 deletions

4
.gitignore vendored
View File

@ -34,3 +34,7 @@ m4/*.m4
*.pc
Makefile.in
Makefile
# symlinks to shared dirs (needed for out-of-tree builds)
*/common
*/build

View File

@ -54,7 +54,8 @@ $(ASCIIDOC_PDF): %.pdf: %.adoc %-docinfo.xml \
$(ASCIIDOC_DEPS) \
$(ASCIIDOCSTYLE) \
$(OSMO_GSM_MANUALS_DIR)/common/*/*.adoc \
$(OSMO_GSM_MANUALS_DIR)/common/images/*
$(OSMO_GSM_MANUALS_DIR)/common/images/* \
build common
@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" \
@ -64,7 +65,11 @@ $(ASCIIDOC_PDF): %.pdf: %.adoc %-docinfo.xml \
check: $(ASCIIDOC_CHECKS)
$(ASCIIDOC_CHECKS): %.check: %.adoc %-docinfo.xml $(ASCIIDOCSTYLE) $(OSMO_GSM_MANUALS_DIR)/common/chapters/*.adoc $(ASCIIDOC_DEPS)
$(ASCIIDOC_CHECKS): %.check: %.adoc %-docinfo.xml \
$(ASCIIDOCSTYLE) \
$(OSMO_GSM_MANUALS_DIR)/common/chapters/*.adoc \
$(ASCIIDOC_DEPS) \
build common
asciidoc -v $(ASCIIDOC_OPTS) $< > $@ 2>&1
# Make absolutely sure that the %.check target is updated.
touch $@

View File

@ -3,9 +3,14 @@
# 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.
# Include this file at the end to have the common targets (upload, clean etc.).
UPLOAD_PATH ?= generic@sysmocom-downloads:documents
SYMLINKS = common build
CLEAN_FILES += $(SYMLINKS)
$(SYMLINKS):
ln -s $(OSMO_GSM_MANUALS_DIR)/$@ $@
upload: $(UPLOAD_FILES)
rsync -avz $(UPLOAD_FILES) $(UPLOAD_PATH)/

View File

@ -32,6 +32,6 @@ all: $(DOCBOOKS_PDF)
xmllint --xinclude --postvalid --noout $<
# Create a PDF file and lint it before
%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS)
%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS) build common
dblatex $(dblatex_quiet) -P draft.mode=no $<

View File

@ -1,5 +1,6 @@
%%
%% This style is derived from the docbook one.
%% "${OSMO_GSM_MANUALS_DIR}/common" is symlinked to ./common when building.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{asciidoc}[2008/06/05 AsciiDoc DocBook Style]
@ -40,13 +41,13 @@
\textsf{
\vfill
\begin{center}
\includegraphics{../common/images/sysmocom.pdf}
\includegraphics{./common/images/sysmocom.pdf}
\ \\ %
\huge{\Company}
\end{center}
\vspace{2.5cm}
\begin{center}
\includegraphics{../common/images/osmocom.pdf}
\includegraphics{./common/images/osmocom.pdf}
\ \\ %
\vspace{0.5cm}
\huge{\textbf{\DBKtitle}}\\ %

View File

@ -1,9 +1,10 @@
#
# AsciiDoc mscgen filter configuration file.
# ${OSMO_GSM_MANUALS}/build is symlinked to ./build when building.
#
[mscgen-filter-style]
mscgen-style=template="mscgen-block",subs=(),posattrs=("style","target"),filter='../build/filter-wrapper.py mscgen -o "{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}" -T{format={basebackend-docbook!png}{basebackend-docbook?png}} -'
mscgen-style=template="mscgen-block",subs=(),posattrs=("style","target"),filter='./build/filter-wrapper.py mscgen -o "{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}" -T{format={basebackend-docbook!png}{basebackend-docbook?png}} -'
[blockdef-listing]
template::[mscgen-filter-style]

View File

@ -1,9 +1,10 @@
#
# AsciiDoc mscgen filter configuration file.
# ${OSMO_GSM_MANUALS}/build is symlinked to ./build when building.
#
[python2-filter-style]
python2-style=template="python2-block",subs=(),posattrs=("style","target"),filter='../build/filter-wrapper.py python2 - --output="{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}"'
python2-style=template="python2-block",subs=(),posattrs=("style","target"),filter='./build/filter-wrapper.py python2 - --output="{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}"'
[blockdef-listing]
template::[python2-filter-style]