From: Masahiro Yamada Date: Sun, 14 Mar 2021 06:15:50 +0000 (+0900) Subject: kbuild: replace sed with $(subst ) or $(patsubst ) X-Git-Tag: accepted/tizen/unified/20230118.172025~7334^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e0839fda3f8598b164a7f23f3eec039e2db5fbc;p=platform%2Fkernel%2Flinux-rpi.git kbuild: replace sed with $(subst ) or $(patsubst ) For simple text replacement, it is better to use a built-in function instead of sed if possible. You can save one process forking. I do not mean to replace all sed invocations because GNU Make itself does not support regular expression (unless you use guile). I just replaced simple ones. Signed-off-by: Masahiro Yamada --- diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index 780e561..ac446c6 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -48,7 +48,7 @@ define rule_chkdt $(call cmd,mk_schema) endef -DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||') +DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_cmd))) override DTC_FLAGS := \ -Wno-avoid_unnecessary_addr_size \ diff --git a/Makefile b/Makefile index 5cb4459..cc5b7e3 100644 --- a/Makefile +++ b/Makefile @@ -574,7 +574,7 @@ endif # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. # CC_VERSION_TEXT is referenced from Kconfig (so it needs export), # and from include/config/auto.conf.cmd to detect the compiler upgrade. -CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g') +CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1)) ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) ifneq ($(CROSS_COMPILE),)