Skip to content

Commit b79c6aa

Browse files
committed
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>
1 parent afa974b commit b79c6aa

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

scripts/Makefile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,11 @@ $(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
312312
#
313313
# These mirror gensymtypes_c and co above, keep them in synch.
314314
cmd_gensymtypes_S = \
315-
(echo "\#include <linux/kernel.h>" ; \
315+
{ echo "\#include <linux/kernel.h>" ; \
316316
echo "\#include <asm/asm-prototypes.h>" ; \
317317
$(CPP) $(a_flags) $< | \
318318
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);/' ; } | \
320320
$(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
321321
$(GENKSYMS) $(if $(1), -T $(2)) \
322322
$(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \

scripts/Makefile.lib

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
271271
# Generate an assembly file to wrap the output of the device tree compiler
272272
quiet_cmd_dt_S_dtb= DTB $@
273273
cmd_dt_S_dtb= \
274-
( \
274+
{ \
275275
echo '\#include <asm-generic/vmlinux.lds.h>'; \
276276
echo '.section .dtb.init.rodata,"a"'; \
277277
echo '.balign STRUCT_ALIGNMENT'; \
@@ -281,7 +281,7 @@ cmd_dt_S_dtb= \
281281
echo '__dtb_$(subst -,_,$(*F))_end:'; \
282282
echo '.global __dtb_$(subst -,_,$(*F))_end'; \
283283
echo '.balign STRUCT_ALIGNMENT'; \
284-
) > $@
284+
} > $@
285285

286286
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
287287
$(call if_changed,dt_S_dtb)
@@ -335,20 +335,20 @@ printf "%08x\n" $$dec_size | \
335335
)
336336

337337
quiet_cmd_bzip2 = BZIP2 $@
338-
cmd_bzip2 = (cat $(real-prereqs) | bzip2 -9 && $(size_append)) > $@
338+
cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@
339339

340340
# Lzma
341341
# ---------------------------------------------------------------------------
342342

343343
quiet_cmd_lzma = LZMA $@
344-
cmd_lzma = (cat $(real-prereqs) | lzma -9 && $(size_append)) > $@
344+
cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@
345345

346346
quiet_cmd_lzo = LZO $@
347-
cmd_lzo = (cat $(real-prereqs) | lzop -9 && $(size_append)) > $@
347+
cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@
348348

349349
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); } > $@
352352

353353
# U-Boot mkimage
354354
# ---------------------------------------------------------------------------
@@ -390,12 +390,11 @@ quiet_cmd_uimage = UIMAGE $@
390390
# big dictionary would increase the memory usage too much in the multi-call
391391
# decompression mode. A BCJ filter isn't used either.
392392
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); } > $@
395395

396396
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 > $@
399398

400399
# ASM offsets
401400
# ---------------------------------------------------------------------------

scripts/mkcompile_h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
6262

6363
# Generate a temporary compile.h
6464

65-
( echo /\* This file is auto generated, version $VERSION \*/
65+
{ echo /\* This file is auto generated, version $VERSION \*/
6666
if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
6767

6868
echo \#define UTS_MACHINE \"$ARCH\"
@@ -73,7 +73,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
7373
echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
7474

7575
echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\"
76-
) > .tmpcompile
76+
} > .tmpcompile
7777

7878
# Only replace the real compile.h if the new one is different,
7979
# in order to preserve the timestamp and avoid unnecessary

0 commit comments

Comments
 (0)