Skip to content

Fix parallel make.

Tim Rühsen requested to merge (removed):fix-parallel-make into master

Ensure gengetopt is only run once to avoid build errors with make -j.

===More info===

  • Normal rule
all: 1.z 2.z 3.z

1.z 2.z 3.z: x.c
        foo

-> runs foo 3 times (once for each target; in non-parallel make run2 and run3 may be skipped if run1 already brought all 3 targets up-to-date)

  • Pattern rule
all: 1.z 2.z 3.z

1.% 2.% 3.%: x.c
        foo

-> runs foo once and expects all 3 targets to be built

So in our case, idn2_cmd.{c,h} get (over)written simultaneously by gengetopt-process1+perl-p1 and ggo-p2+perl-p2. Then, when eg *-p1 are finished, the requirements are fulfilled and compiling libidn2_cmd.la begins while the *-p2 might still be running and deleting/overwriting/editing the files.

Sources:

https://www.gnu.org/software/make/manual/html_node/Pattern-Examples.html

https://stackoverflow.com/questions/3046117/gnu-makefile-multiple-outputs-from-single-rule-preventing-intermediate-files/3113546#3113546

Merge request reports