kbuild: remove sed command from cmd_ar_builtin
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 14 Jun 2022 05:51:49 +0000 (14:51 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 27 Jul 2022 12:17:59 +0000 (21:17 +0900)
Replace a pipeline of echo and sed with printf to decrease process forks.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/Makefile.build

index cac070a..784f46d 100644 (file)
@@ -358,9 +358,8 @@ $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
 
 quiet_cmd_ar_builtin = AR      $@
       cmd_ar_builtin = rm -f $@; \
-               echo $(patsubst $(obj)/%,%,$(real-prereqs)) | \
-               sed -E 's:([^ ]+):$(obj)/\1:g' | \
-               xargs $(AR) cDPrST $@
+       $(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
+       $(AR) cDPrST $@
 
 $(obj)/built-in.a: $(real-obj-y) FORCE
        $(call if_changed,ar_builtin)