[L/unstable 06/13] UBUNTU: [Packaging] simplify custom_override

Masahiro Yamada masahiro.yamada at canonical.com
Mon Dec 5 08:56:12 UTC 2022


You do not need to invoke the shell for if/else choice.

You can do it by using the $(if ...) built-in function.

  $(if $($(1)_$(2)),$($(1)_$(2)),$($(1)))

GNU Make >= 3.81 supports $(or ...), so the code can be even simpler:

  $(or $($(1)_$(2)),$($(1)))

No functional change is intended.

Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
---
 debian/rules.d/0-common-vars.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index a54b83dd943b..ec9c5680493b 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -278,8 +278,7 @@ LN = ln -sf
 
 # Checks if a var is overriden by the custom rules. Called with var and
 # flavour as arguments.
-custom_override = \
- $(shell if [ -n "$($(1)_$(2))" ]; then echo "$($(1)_$(2))"; else echo "$($(1))"; fi)
+custom_override = $(or $($(1)_$(2)),$($(1)))
 
 # selftests that Ubuntu cares about
 ubuntu_selftests = breakpoints cpu-hotplug efivarfs memfd memory-hotplug mount net ptrace seccomp timers powerpc user ftrace
-- 
2.34.1




More information about the kernel-team mailing list