Balaji Manigandan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83887?usp=email )
Change subject: Fix no-op for empty argument in Makefile for Bash compatibility ......................................................................
Fix no-op for empty argument in Makefile for Bash compatibility
This change addresses an issue encountered in Ubuntu 24.04 with GNU Bash version 5.2.21, where the Makefile would fail with the error:
/bin/bash: -c: option requires an argument make: *** [Makefile.mk:1440: build/coreboot.pre] Error 2
The error was triggered by an empty third argument `$(3)` in a conditional `$(if ...)` statement. The original line did not specify an explicit no-op for the case when `$(3)` is empty, which led to the execution of an incomplete command.
By adding a colon `:` as a no-op command in the else-part of the `$(if ...)`, we ensure that a harmless command is executed when `$(3)` is empty, preventing the Makefile from failing due to a missing argument.
This fix ensures compatibility with the newer Bash version and prevents the Makefile from breaking under the specified conditions.
Change-Id: I276e89792779832edf325d4f781aa8df101e9091 Signed-off-by: Manigandan, Balaji balaji.manigandan@intel.com --- M Makefile.mk 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/83887/1
diff --git a/Makefile.mk b/Makefile.mk index 901d6b2..0853c66 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -992,7 +992,7 @@ # non-empty if file removal requested) define cbfs-add-cmd printf " CBFS $(call extract_nth,2,$(1))\n" - $(if $(3),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null) + $(if $(3),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null,:) $(call cbfs-add-cmd-for-region,$(1),$(2)) endef