From 6acf6ed76d91dc027e1fc2f2e24238c5ef860e33 Mon Sep 17 00:00:00 2001 From: Benjamin Block Date: Mon, 29 Nov 2021 18:27:02 +0100 Subject: [PATCH] chreipl-fcp-mpath: fix directory dependencies for parallel make install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `make install` is called with parallel execution enabled (e.g.: `-j2`), the dependencies for the necessary directories are not correct. The `install` target depends on `install_dirs`, which creates the necessary directories, and needs to run before any of the `chreipl-fcp-mpath-install*` targets that have prerequisites on these directories; but the `chreipl-fcp-mpath-install*` targets have indirectly the same "hierarchy level" as `install_dirs`, and no direct dependency on it. Simplified it looks like this: install: install_dirs chreipl-fcp-mpath-install chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-udev-rules ... This works fine with only one job, as `install_dirs` will be satisfied first, before recursing into any other branch of the dependency tree. But if we have more than one job, there is nothing in the rules that prevents Make from working on both branches - `install_dirs` and `chreipl-fcp-mpath-install` - at the same time, and so `chreipl-fcp-mpath-install-udev-rules` might run before `install_dirs`, and end up with a unsatisfied dependency: make[2]: *** No rule to make target '/usr/lib/udev/rules.d', needed by 'chreipl-fcp-mpath-install-udev-rules'. Stop. Fix this by adding direct dependencies on `install_dirs` for all the directory prerequisites of `chreipl-fcp-mpath-install*` targets. This way Make will need to satisfy `install_dirs` before it can work on any of the other targets, and so the necessary directories will be created in the correct order. Reported-by: Alexander Egorenkov Reviewed-by: Steffen Maier Tested-by: Alexander Egorenkov Signed-off-by: Benjamin Block Signed-off-by: Jan Höppner --- chreipl-fcp-mpath/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chreipl-fcp-mpath/Makefile b/chreipl-fcp-mpath/Makefile index 9b4aae03..6cf65a3f 100644 --- a/chreipl-fcp-mpath/Makefile +++ b/chreipl-fcp-mpath/Makefile @@ -131,6 +131,7 @@ install: chreipl-fcp-mpath-install # install udev rules INSTDIRS += $(UDEVRULESDIR) +$(DESTDIR)$(UDEVRULESDIR): install_dirs .PHONY: chreipl-fcp-mpath-install-udev-rules chreipl-fcp-mpath-install-udev-rules: | $(DESTDIR)$(UDEVRULESDIR) @@ -142,6 +143,7 @@ chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-udev-rules # install udev helper programs INSTDIRS += $(UDEVDIR) +$(DESTDIR)$(UDEVDIR): install_dirs .PHONY: chreipl-fcp-mpath-install-udev-helper chreipl-fcp-mpath-install-udev-helper: | $(DESTDIR)$(UDEVDIR) @@ -152,6 +154,7 @@ chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-udev-helper # install common library files INSTDIRS += $(CHREIPLZFCPMPDIR) +$(DESTDIR)$(CHREIPLZFCPMPDIR): install_dirs .PHONY: chreipl-fcp-mpath-install-libfiles chreipl-fcp-mpath-install-libfiles: | $(DESTDIR)$(CHREIPLZFCPMPDIR) @@ -165,6 +168,7 @@ ifeq ($(HAVE_DRACUT),1) # install dracut config files INSTDIRS += $(DRACUTCONFDIR) +$(DESTDIR)$(DRACUTCONFDIR): install_dirs .PHONY: chreipl-fcp-mpath-install-dracut-config chreipl-fcp-mpath-install-dracut-config: | $(DESTDIR)$(DRACUTCONFDIR) @@ -180,6 +184,7 @@ ifeq ($(ENABLE_DOC),1) # chreipl-fcp-mpath: install man page INSTDIRS += $(MANDIR) +$(DESTDIR)$(MANDIR)/man7: install_dirs .PHONY: chreipl-fcp-mpath-install-man-page chreipl-fcp-mpath-install-man-page: | $(DESTDIR)$(MANDIR)/man7