Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: remove unnecessary in-subshell execution

The commands surrounded by ( ) are executed in a subshell, but in
most cases, we do not need to spawn an extra subshell.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

+14 -15
+2 -2
scripts/Makefile.build
··· 312 312 # 313 313 # These mirror gensymtypes_c and co above, keep them in synch. 314 314 cmd_gensymtypes_S = \ 315 - (echo "\#include <linux/kernel.h>" ; \ 315 + { echo "\#include <linux/kernel.h>" ; \ 316 316 echo "\#include <asm/asm-prototypes.h>" ; \ 317 317 $(CPP) $(a_flags) $< | \ 318 318 grep "\<___EXPORT_SYMBOL\>" | \ 319 - sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \ 319 + sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \ 320 320 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ 321 321 $(GENKSYMS) $(if $(1), -T $(2)) \ 322 322 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
+10 -11
scripts/Makefile.lib
··· 271 271 # Generate an assembly file to wrap the output of the device tree compiler 272 272 quiet_cmd_dt_S_dtb= DTB $@ 273 273 cmd_dt_S_dtb= \ 274 - ( \ 274 + { \ 275 275 echo '\#include <asm-generic/vmlinux.lds.h>'; \ 276 276 echo '.section .dtb.init.rodata,"a"'; \ 277 277 echo '.balign STRUCT_ALIGNMENT'; \ ··· 281 281 echo '__dtb_$(subst -,_,$(*F))_end:'; \ 282 282 echo '.global __dtb_$(subst -,_,$(*F))_end'; \ 283 283 echo '.balign STRUCT_ALIGNMENT'; \ 284 - ) > $@ 284 + } > $@ 285 285 286 286 $(obj)/%.dtb.S: $(obj)/%.dtb FORCE 287 287 $(call if_changed,dt_S_dtb) ··· 335 335 ) 336 336 337 337 quiet_cmd_bzip2 = BZIP2 $@ 338 - cmd_bzip2 = (cat $(real-prereqs) | bzip2 -9 && $(size_append)) > $@ 338 + cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@ 339 339 340 340 # Lzma 341 341 # --------------------------------------------------------------------------- 342 342 343 343 quiet_cmd_lzma = LZMA $@ 344 - cmd_lzma = (cat $(real-prereqs) | lzma -9 && $(size_append)) > $@ 344 + cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@ 345 345 346 346 quiet_cmd_lzo = LZO $@ 347 - cmd_lzo = (cat $(real-prereqs) | lzop -9 && $(size_append)) > $@ 347 + cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@ 348 348 349 349 quiet_cmd_lz4 = LZ4 $@ 350 - cmd_lz4 = (cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ 351 - $(size_append)) > $@ 350 + cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ 351 + $(size_append); } > $@ 352 352 353 353 # U-Boot mkimage 354 354 # --------------------------------------------------------------------------- ··· 390 390 # big dictionary would increase the memory usage too much in the multi-call 391 391 # decompression mode. A BCJ filter isn't used either. 392 392 quiet_cmd_xzkern = XZKERN $@ 393 - cmd_xzkern = (cat $(real-prereqs) | \ 394 - sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ 393 + cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \ 394 + $(size_append); } > $@ 395 395 396 396 quiet_cmd_xzmisc = XZMISC $@ 397 - cmd_xzmisc = (cat $(real-prereqs) | \ 398 - xz --check=crc32 --lzma2=dict=1MiB) > $@ 397 + cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@ 399 398 400 399 # ASM offsets 401 400 # ---------------------------------------------------------------------------
+2 -2
scripts/mkcompile_h
··· 62 62 63 63 # Generate a temporary compile.h 64 64 65 - ( echo /\* This file is auto generated, version $VERSION \*/ 65 + { echo /\* This file is auto generated, version $VERSION \*/ 66 66 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi 67 67 68 68 echo \#define UTS_MACHINE \"$ARCH\" ··· 73 73 echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" 74 74 75 75 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" 76 - ) > .tmpcompile 76 + } > .tmpcompile 77 77 78 78 # Only replace the real compile.h if the new one is different, 79 79 # in order to preserve the timestamp and avoid unnecessary