fix srcdir to reflect $abs_srcdir

When building .adoc files, we pass a srcdir variable to allow including files
that are only in the source tree, but not in the build tree.

However, so far {srcdir} is a relative path, and when an .adoc file includes an
.adoc file in a subdir, then the directive
  include::{srcdir}
is evaluated relative to the .adoc file in the subdir, not in the original make
CWD. Hence the path ends up pointing at the wrong place.

Fix this by passing an absolute path as srcdir instead.

I discovered this here:

osmo-hlr/doc/manuals/osmohlr-usermanual.adoc:
  include::{srcdir}/chapters/proxy_cache.adoc[]

osmo-hlr/doc/manuals/chapters/proxy_cache.adoc:
  ["mscgen"]
  ----
  include::{srcdir}/chapters/proxy_cache_attach.msc[]
  ----

(Note that I could have just removed "{srcdir}/chapters/" since .adoc and .msc
are in the same dir, but the point of this patch is to make {srcdir} generally
useful in all levels of included .adoc files.)

The above resulted in:

  asciidoc: include: /n/s/dev/src/osmo-hlr/doc/manuals/chapters/proxy_cache.adoc
  asciidoc: osmohlr-usermanual.adoc: line 29: reading: /n/s/dev/src/osmo-hlr/doc/manuals/chapters/proxy_cache.adoc
  asciidoc: WARNING: proxy_cache.adoc: line 263: include file not found: /n/s/dev/src/src/osmo-hlr/doc/manuals/chapters/proxy_cache_attach.msc

Note that /n/s/dev/src/src/osmo-hlr should only have one 'src' element.
With $abs_srcdir this becomes:

  asciidoc: include: /n/s/dev/make/osmo-hlr/../../src/osmo-hlr/doc/manuals/chapters/proxy_cache.adoc
  asciidoc: osmohlr-usermanual.adoc: line 29: reading: /n/s/dev/make/osmo-hlr/../../src/osmo-hlr/doc/manuals/chapters/proxy_cache.adoc
  asciidoc: include: /n/s/dev/make/osmo-hlr/../../src/osmo-hlr/doc/manuals/chapters/proxy_cache_attach.msc
  asciidoc: proxy_cache.adoc: line 263: reading: /n/s/dev/make/osmo-hlr/../../src/osmo-hlr/doc/manuals/chapters/proxy_cache_attach.msc

I have not investigated whether/why all the other 'include::' all over the
place seem to be working -- maybe we never include .adoc in subdirectories that
in turn use {srcdir}? Or we have lots of missing images we didn't notice yet?

Todo: the missing include should have fatally broken the build, but it just
builds the PDF with missing images. a) the mscgen plugin finding empty content
and b) the missing .png files should have caused the build to abort?

Change-Id: If847f16eab3ddba6009f67ed641b48805467eb1b
This commit is contained in:
Neels Hofmeyr 2020-01-24 05:00:32 +01:00
parent 2dc172cff6
commit c8c77af77f
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ CLEAN_FILES += $(ASCIIDOC_NAME:%=%__*.png) $(ASCIIDOC_NAME:%=%__*.svg) $(ASCIIDO
CLEAN_FILES += $(ASCIIDOC_PDF) $(ASCIIDOC_NAME:%=%.html)
UPLOAD_FILES += $(ASCIIDOC_PDF)
ASCIIDOC_OPTS := -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf -f $(BUILDDIR)/docinfo-releaseinfo.conf -a srcdir='$(srcdir)' -a commondir='$(COMMONDIR)'
ASCIIDOC_OPTS := -f $(BUILDDIR)/mscgen-filter.conf -f $(BUILDDIR)/diag-filter.conf -f $(BUILDDIR)/docinfo-releaseinfo.conf -a srcdir='$(abs_srcdir)' -a commondir='$(COMMONDIR)'
DBLATEX_OPTS := -s $(ASCIIDOCSTYLE) -P draft.mode=yes -P draft.watermark=0
ifeq (,$(BUILD_RELEASE))