In tclpkg/gv, the gv_doc_writer.tcl is run multiple times during
the build. It is ineffective, but it shouldn't cause any troubles
with the serial build. Unfortunately, this is not the case with
the parallel builds where multiple parallel runs of the
gv_doc_writer.tcl can cause races leading to empty corresponding
ps and pdf files.
The correct solution would be to use the Rules with Grouped Targets [1],
unfortunately this GNU make feature has been introduced quite
recently which would break backward compatibility.
The proposed hack should cause the gv_doc_writer.tcl to be run
only once during the build process and it should work also with
the older 'make'. It is inspired by [2].
[1] https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html#Multiple-Targets
[2] https://stackoverflow.com/questions/
2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
pdf =
endif
-$(man): gv.i gv_doc_writer.tcl gv_doc_template.tcl gv_doc_langs.tcl
+$(man): gv_doc_writer.intermediate ;
+
+.INTERMEDIATE: gv_doc_writer.intermediate
+gv_doc_writer.intermediate: gv.i gv_doc_writer.tcl gv_doc_template.tcl gv_doc_langs.tcl
$(TCLSH) $(srcdir)/gv_doc_writer.tcl "$(srcdir)"
if ENABLE_MAN_PDFS