From 06d1805c5b0aee5f9a26094ceb0b43aa2dbaa386 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 13 Nov 2018 16:33:44 +0100 Subject: *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 --- .gitignore | 4 ++++ build/Makefile.asciidoc.inc | 9 +++++++-- build/Makefile.common.inc | 7 ++++++- build/Makefile.docbook.inc | 2 +- build/custom-dblatex.sty | 5 +++-- build/mscgen-filter.conf | 3 ++- build/python2-filter.conf | 3 ++- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 30bc93e..b174bb9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ m4/*.m4 *.pc Makefile.in Makefile + +# symlinks to shared dirs (needed for out-of-tree builds) +*/common +*/build diff --git a/build/Makefile.asciidoc.inc b/build/Makefile.asciidoc.inc index 18cfa88..6b57c7d 100644 --- a/build/Makefile.asciidoc.inc +++ b/build/Makefile.asciidoc.inc @@ -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 $@ diff --git a/build/Makefile.common.inc b/build/Makefile.common.inc index 6a210bc..efd56f6 100644 --- a/build/Makefile.common.inc +++ b/build/Makefile.common.inc @@ -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)/ diff --git a/build/Makefile.docbook.inc b/build/Makefile.docbook.inc index b69fcea..4d015a7 100644 --- a/build/Makefile.docbook.inc +++ b/build/Makefile.docbook.inc @@ -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 $< diff --git a/build/custom-dblatex.sty b/build/custom-dblatex.sty index 606b9ab..16931ad 100644 --- a/build/custom-dblatex.sty +++ b/build/custom-dblatex.sty @@ -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}}\\ % diff --git a/build/mscgen-filter.conf b/build/mscgen-filter.conf index ce3cb3f..fa8f03e 100644 --- a/build/mscgen-filter.conf +++ b/build/mscgen-filter.conf @@ -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] diff --git a/build/python2-filter.conf b/build/python2-filter.conf index ca2ddaf..812c7c2 100644 --- a/build/python2-filter.conf +++ b/build/python2-filter.conf @@ -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] -- cgit v1.2.3