Recursive Makefiles: avoid race condition in the install target

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 <SUBDIR> all` and `make -C <SUBDIR> 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 <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2023-07-12 15:27:12 +00:00
committed by Jan Höppner
parent d205b47c08
commit 4d4ddbd887
4 changed files with 4 additions and 5 deletions

View File

@@ -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)"

View File

@@ -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

View File

@@ -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

View File

@@ -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 \