On Sat, Mar 01, 2025 at 10:51:44AM +0000, Gavin Smith wrote: > I came across a section in the Automake manual describing problems with > Makefile rules with multiple outputs. > > https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html > > We have such rules in several places for building texi2any. For example, > in tta/C/Makefile.am: > > $(srcdir)/main/command_data.c $(srcdir)/main/command_ids.h > $(srcdir)/main/global_multi_commands_case.c > $(srcdir)/main/global_unique_commands_case.c > $(srcdir)/main/global_commands_types.h: ../data/command_data.txt > main/command_data.awk > $(GAWK) -v srcdir=$(srcdir)/main -f $(srcdir)/main/command_data.awk \ > $(srcdir)/../data/command_data.txt > > The problem is supposed to be with parallel builds, in that the rule could > run multiple times at the same time.
> ... > The node in the Automake manual does not offer a clear solution that > is correct. It shows various solutions, some much more complicated than > others. It's not clear that these solutions actually work and some of them > seem like ideas or proposals rather a recommended solution ("One could > imagine something along the following lines."). > > Have we had this problem? Could we get away with just ignoring it as > the proposed solutions are all atrociously complicated? Maybe it is harmless > to have multiple processes writing to the generated files at the same > time? I implemented one of the solutions from the automake manual (using a separate stamp file, but not accounting for signals or multiple produced files being deleted without the stamp file being also deleted).