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

Todd Zullinger tmz at pobox.com
Sat Jun 16 18:40:21 CEST 2018


Thomas Moschny wrote:
> 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).

Yeah, that's a nice solution too.  Thanks!

It's really a2x's fault for stripping the extension and
replacing it with .xml rather than just appending .xml to
the target name.  (But perhaps someone on Windows doesn't
want to see a temp file named .html.xml or something.)

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A cynic is a man who, when he smells flowers, looks around for a
coffin.
    -- H. L. Mencken



More information about the CGit mailing list