On Sat, Mar 01, 2025 at 10:51:44AM +0000, Gavin Smith wrote: > I had an idea that "locking" could be done in a separate helper program. > The "make" rule would become something like: > > LOCK_ONCE=build_aux/lock-once.sh > > $(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 > $(LOCK_ONCE) $(GAWK) -v srcdir=$(srcdir)/main -f > $(srcdir)/main/command_data.awk \ > $(srcdir)/../data/command_data.txt > > > Then all the complexity of checking for signals, clean-up etc. could > go in the separate program. >
A simpler solution could be to use the GNU make .NOTPARALLEL feature: diff --git a/tta/C/Makefile.am b/tta/C/Makefile.am index a93ead7b70..8409916b43 100644 --- a/tta/C/Makefile.am +++ b/tta/C/Makefile.am @@ -246,16 +246,21 @@ MAINTAINERCLEANFILES += main/element_types.c main/element_types.h TXI_MODULES_ENV = srcdir="$(srcdir)"; export srcdir; -$(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 +command_data_products = $(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 + +$(command_data_products): ../data/command_data.txt main/command_data.awk $(GAWK) -v srcdir=$(srcdir)/main -f $(srcdir)/main/command_data.awk \ $(srcdir)/../data/command_data.txt +.NOTPARALLEL: $(command_data_products) MAINTAINERCLEANFILES += main/command_data.c main/command_ids.h MAINTAINERCLEANFILES += main/global_multi_commands_case.c \ main/global_unique_commands_case.c MAINTAINERCLEANFILES += main/global_commands_types.h On GNU make, the parallel build is supposed to be disabled for the dependencies of the .NOTPARALLEL target only. The behaviour differs with other make programs.