From 4d4ddbd887e8a4cb201535fb0711db7cb85fe424 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 12 Jul 2023 15:27:12 +0000 Subject: [PATCH] Recursive Makefiles: avoid race condition in the `install` target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `install` Makefile target of the top Makefile has `all` and `install-recursive` as prerequisites. This leads to the two recursive Makefile calls `make -C all` and `make -C install`. The problem is these two targets try to build the same object files and this leads to a race condition between these two targets in case of a parallel build. Fix this problem by removing the `all` prerequisite from the `install` target, as it is not needed since all the `install` targets in the sub-Makefiles already have proper prerequisites. Reviewed-by: Jan Höppner Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- genprotimg/Makefile | 2 +- iucvterm/Makefile | 3 +-- pvattest/Makefile | 2 +- zkey/Makefile | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/genprotimg/Makefile b/genprotimg/Makefile index f8b69ac7..8c9f7048 100644 --- a/genprotimg/Makefile +++ b/genprotimg/Makefile @@ -10,7 +10,7 @@ RECURSIVE_TARGETS := all-recursive install-recursive clean-recursive all: all-recursive -install: all install-recursive +install: install-recursive $(INSTALL) -d -m 755 "$(PKGDATADIR)" $(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 samples/check_hostkeydoc "$(PKGDATADIR)" diff --git a/iucvterm/Makefile b/iucvterm/Makefile index 4c57644e..9201737a 100644 --- a/iucvterm/Makefile +++ b/iucvterm/Makefile @@ -13,8 +13,7 @@ RECURSIVE_TARGETS = all-recursive install-recursive clean-recursive \ all: all-recursive -check: check-recursive -install: all install-recursive +install: install-recursive clean: clean-recursive diff --git a/pvattest/Makefile b/pvattest/Makefile index b61a8052..beb58339 100644 --- a/pvattest/Makefile +++ b/pvattest/Makefile @@ -9,7 +9,7 @@ RECURSIVE_TARGETS := all-recursive clean-recursive install-recursive all: all-recursive -install: all install-recursive +install: install-recursive clean: clean-recursive diff --git a/zkey/Makefile b/zkey/Makefile index 41f8760f..501c5ebf 100644 --- a/zkey/Makefile +++ b/zkey/Makefile @@ -117,7 +117,7 @@ install-zkey-cryptsetup: zkey-cryptsetup $(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zkey-cryptsetup $(DESTDIR)$(USRBINDIR) $(INSTALL) -m 644 -c zkey-cryptsetup.1 $(DESTDIR)$(MANDIR)/man1 -install: all install-common $(INSTALL_TARGETS) $(SUB_DIRS) +install: install-common $(INSTALL_TARGETS) $(SUB_DIRS) clean: $(SUB_DIRS) rm -f *.o zkey zkey-cryptsetup detect-libcryptsetup.dep \