[RFC PATCH] Makefile: work around parallel make issues in docs

Thomas Moschny thomas.moschny at gmx.de
Sat Jun 16 08:55:49 CEST 2018

Todd Zullinger <tmz at pobox.com>:

> When make is run with multiple jobs, doc-man and doc-html fail.  The
> a2x command tries to write %.5.xml for each invocation, overwriting
> each other.
> Work around this by copying %.5 to %.5+ in doc-man.  This is a rather
> gross hack, but nothing better came to mind.  Using --asciidoc-opts to
> pass the '--out-file' did not affect the temporary .xml file at issue.

What about using a --destination-dir (-D) to a2x? It puts the
temporary .xml also into that dir. Something like this:

diff --git a/Makefile b/Makefile
index 687069f..2ccee34 100644
--- a/Makefile
+++ b/Makefile
@@ -131,7 +131,10 @@ doc-html: $(DOC_HTML)
 doc-pdf: $(DOC_PDF)
 %.5 : %.5.txt
-       a2x -f manpage $<
+       mkdir $@.dir
+       a2x -f manpage -D $@.dir $<
+       mv $@.dir/$@ .
+       rmdir $@.dir
 $(DOC_HTML): %.html : %.txt
        a2x -f xhtml --stylesheet=cgit-doc.css --xsltproc-opts="--param generate.consistent.ids 1" $<

One might want to additionally clean up the directory somewhere (as it
is not removed in case something goes wrong with the a2x call).

- Thomas

More information about the CGit mailing list