From f30bf2b2085a56fef436c242059900da357a3417 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Fri, 21 Aug 2026 13:05:27 +0300 Subject: [PATCH] Makefiles: Propagate recursive command failures Return the failing submake status from the top-level and Debian build loops instead of turning an early failure into success. Collect and check the statuses of the parallel iSCSI and SRP cleanup jobs as well. --- Makefile | 11 ++++++----- debian/rules | 8 ++++---- iscsi-scst/Makefile | 13 ++++++++++--- srpt/Makefile | 15 ++++++++++++--- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b8474db10..d5c482938 100644 --- a/Makefile +++ b/Makefile @@ -186,18 +186,19 @@ tags: find . -type f -name "*.[ch]" | ctags --c-kinds=+p --fields=+iaS --extra=+q -e -L- cov-build: - -for d in $(SCST_DIR) $(ISCSI_DIR) $(OLD_QLA_DIR) $(NEW_QLA_DIR) \ + for d in $(SCST_DIR) $(ISCSI_DIR) $(OLD_QLA_DIR) $(NEW_QLA_DIR) \ $(SRP_DIR) $(SCST_LOCAL_DIR) $(FCST_DIR) $(USR_DIR) \ $(SCSTADM_DIR); do \ BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y \ - CONFIG_SCSI_QLA2XXX_TARGET=y $(MAKE) -j$$(nproc) -C "$$d"; \ + CONFIG_SCSI_QLA2XXX_TARGET=y $(MAKE) -j$$(nproc) -C "$$d" || \ + exit $$?; \ done all clean extraclean install uninstall: - -if [ $@ = extraclean ]; then rm -f TAGS tags cscope.out; fi - -for d in $(SCST_DIR) $(ISCSI_DIR) $(QLA_DIR) $(SRP_DIR) \ + if [ $@ = extraclean ]; then rm -f TAGS tags cscope.out; fi + for d in $(SCST_DIR) $(ISCSI_DIR) $(QLA_DIR) $(SRP_DIR) \ $(SCST_LOCAL_DIR) $(FCST_DIR) $(USR_DIR) $(SCSTADM_DIR); do \ - $(MAKE) -j$$(nproc) -C "$$d" $@ || break; \ + $(MAKE) -j$$(nproc) -C "$$d" $@ || exit $$?; \ done scst: diff --git a/debian/rules b/debian/rules index f6864cf42..79ab0bdff 100755 --- a/debian/rules +++ b/debian/rules @@ -58,7 +58,7 @@ build: export BUILD_2X_MODULE=y && \ export CONFIG_SCSI_QLA_FC=y && \ export CONFIG_SCSI_QLA2XXX_TARGET=y && \ - for d in $(SUBDIRS); do $(MAKE) -C $$d; done + for d in $(SUBDIRS); do $(MAKE) -C $$d || exit $$?; done build-indep: build @@ -74,10 +74,10 @@ install: export CONFIG_SCSI_QLA2XXX_TARGET=y && \ for d in $(SUBDIRS); do \ if [ $$d = scst ]; then \ - { $(MAKE) -C $$d install || break; } \ + $(MAKE) -C $$d install || exit $$?; \ else \ - { INSTALL_MOD_PATH="$(DESTDIR)" $(MAKE) -C $$d install; } ||\ - break; \ + INSTALL_MOD_PATH="$(DESTDIR)" $(MAKE) -C $$d install || \ + exit $$?; \ fi; \ done && \ make $(PKG_BUILD_MODE) && \ diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 3f7cc2859..15e9d844b 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -194,11 +194,18 @@ uninstall: clean: rm -rf include/iscsi_scst_itf_ver.h rm -rf conftest/*/{build-output,result}*.txt + status=0; pids=(); \ for d in conftest/* kernel kernel/isert-scst; do \ - [ -d "$$d" ] && $(MAKE) -C $(KDIR) M=$(shell pwd)/$$d $@ & \ - rm -f $$d/result*.txt; \ + if [ -d "$$d" ]; then \ + $(MAKE) -C $(KDIR) M=$(shell pwd)/$$d $@ & \ + pids+=("$$!"); \ + fi; \ + rm -f $$d/result*.txt || status=$$?; \ done; \ - wait + for pid in "$${pids[@]}"; do \ + wait "$$pid" || status=$$?; \ + done; \ + exit $$status $(MAKE) -C usr $@ extraclean: clean diff --git a/srpt/Makefile b/srpt/Makefile index 86ba92f53..979be611e 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -6,6 +6,8 @@ ifndef PREFIX PREFIX=/usr/local endif +SHELL=/bin/bash + SCST_DIR := $(shell echo "$$PWD")/../scst/src ifeq ($(KVER),) @@ -158,11 +160,18 @@ check: clean: rm -rf conftest/pre_cflags conftest/kcflags rm -rf conftest/*/{build-output,result}*.txt + status=0; pids=(); \ for d in conftest/* src; do \ - [ -d "$$d" ] && $(MAKE) -C $(KDIR) M=$(shell pwd)/$$d $@ & \ - rm -f $$d/result*.txt; \ + if [ -d "$$d" ]; then \ + $(MAKE) -C $(KDIR) M=$(shell pwd)/$$d $@ & \ + pids+=("$$!"); \ + fi; \ + rm -f $$d/result*.txt || status=$$?; \ done; \ - wait + for pid in "$${pids[@]}"; do \ + wait "$$pid" || status=$$?; \ + done; \ + exit $$status extraclean: clean rm -f *.orig *.rej