On Mon, 13 Sep 2021 16:42:21 +0200 Christian Weisgerber <na...@mips.inka.de> wrote:
> gllib libgnu_sc.a : force > rm -f libgnu_sc.a > mkdir -p gllib > test -f gllib/Makefile || sh config.status gllib/Makefile depfiles > cd gllib; \ > $(MAKE) [...] ; \ > $(LN) libgnu.a ../libgnu_sc.a > > It defines two targets that are prerequisites for other targets. > gmake executes the recipe separately for each target. In parallel > mode, the commands end up being run more than once in parallel and > step on each other. GNU make 4.3 added the &: operator for "a recipe that generates multiple files from a single invocation" (info 'GNU make', 4.10 Multiple Targets in a Rule). The &: operator is specific to GNU make; a plain : would work in OpenBSD make. I changed 3 of your patches to use &: and completed make MAKE_JOBS=4 on amd64. To show what I mean, here are the 3 patches, but I forgot to edit the patch comment. --George --- /dev/null Tue Sep 14 12:07:14 2021 +++ patches/patch-modules_regexp_Makefile_in Tue Sep 14 11:57:58 2021 @@ -0,0 +1,17 @@ +$OpenBSD$ + +Fix parallel make: reach target by a single name so the build recipe +is not run multiple times in parallel. + +Index: modules/regexp/Makefile.in +--- modules/regexp/Makefile.in.orig ++++ modules/regexp/Makefile.in +@@ -44,7 +44,7 @@ preload.lisp : $(srcdir)/preload.lisp + am--refresh : + + # regexp relies on src/gllib, so we must also include files in the build dir +-gllib libgnu_rx.a : force ++gllib libgnu_rx.a &: force + rm -f libgnu_rx.a + mkdir -p gllib + test -f gllib/Makefile || sh config.status gllib/Makefile depfiles --- /dev/null Tue Sep 14 12:07:23 2021 +++ patches/patch-modules_syscalls_Makefile_in Tue Sep 14 11:57:58 2021 @@ -0,0 +1,17 @@ +$OpenBSD$ + +Fix parallel make: reach target by a single name so the build recipe +is not run multiple times in parallel. + +Index: modules/syscalls/Makefile.in +--- modules/syscalls/Makefile.in.orig ++++ modules/syscalls/Makefile.in +@@ -47,7 +47,7 @@ preload.lisp : $(srcdir)/preload.lisp + am--refresh : + + # syscalls relies on src/gllib, so we must also include files in the build dir +-gllib libgnu_sc.a : force ++gllib libgnu_sc.a &: force + rm -f libgnu_sc.a + mkdir -p gllib + test -f gllib/Makefile || sh config.status gllib/Makefile depfiles --- /dev/null Tue Sep 14 12:07:29 2021 +++ patches/patch-modules_wildcard_Makefile_in Tue Sep 14 11:57:58 2021 @@ -0,0 +1,17 @@ +$OpenBSD$ + +Fix parallel make: reach target by a single name so the build recipe +is not run multiple times in parallel. + +Index: modules/wildcard/Makefile.in +--- modules/wildcard/Makefile.in.orig ++++ modules/wildcard/Makefile.in +@@ -34,7 +34,7 @@ wildcard.o : wildcard.c config.h gllib + am--refresh : + + # wildcard relies on src/gllib, so we must also include files in the build dir +-gllib libgnu_wc.a : force ++gllib libgnu_wc.a &: force + rm -f libgnu_wc.a + mkdir -p gllib + test -f gllib/Makefile || sh config.status gllib/Makefile depfiles