]> granicus.if.org Git - graphviz/commitdiff
gv: fixed possible races during docs build
authorJaroslav Škarvada <jskarvad@redhat.com>
Tue, 8 Jun 2021 20:43:53 +0000 (22:43 +0200)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 15 Jun 2021 00:11:01 +0000 (17:11 -0700)
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>
tclpkg/gv/Makefile.am

index 476b0fcfca3a5c7b1602875ca69d1367ea25d08c..14d7221f690f5b95b9f8761959f278893a8f040d 100644 (file)
@@ -433,7 +433,10 @@ else
 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