Skip to content

Commit ad77408

Browse files
committed
kbuild: change filechk to surround the given command with { }
filechk_* rules often consist of multiple 'echo' lines. They must be surrounded with { } or ( ) to work correctly. Otherwise, only the string from the last 'echo' would be written into the target. Let's take care of that in the 'filechk' in scripts/Kbuild.include to clean up filechk_* rules. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 172caf1 commit ad77408

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

Kbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ timeconst-file := include/generated/timeconst.h
2727
targets += $(timeconst-file)
2828

2929
define filechk_gentimeconst
30-
(echo $(CONFIG_HZ) | bc -q $< )
30+
echo $(CONFIG_HZ) | bc -q $<
3131
endef
3232

3333
$(timeconst-file): kernel/time/timeconst.bc FORCE

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,13 +1127,13 @@ define filechk_utsrelease.h
11271127
echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
11281128
exit 1; \
11291129
fi; \
1130-
(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
1130+
echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"
11311131
endef
11321132

11331133
define filechk_version.h
1134-
(echo \#define LINUX_VERSION_CODE $(shell \
1134+
echo \#define LINUX_VERSION_CODE $(shell \
11351135
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
1136-
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
1136+
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
11371137
endef
11381138

11391139
$(version_h): FORCE

arch/s390/tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ define filechk_facility-defs.h
2525
endef
2626

2727
define filechk_dis-defs.h
28-
( $(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt )
28+
$(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt
2929
endef
3030

3131
$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE

firmware/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long)
1313
ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
1414
PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
1515

16-
filechk_fwbin = { \
16+
filechk_fwbin = \
1717
echo "/* Generated by $(src)/Makefile */" ;\
1818
echo " .section .rodata" ;\
1919
echo " .p2align $(ASM_ALIGN)" ;\
@@ -28,8 +28,7 @@ filechk_fwbin = { \
2828
echo " .p2align $(ASM_ALIGN)" ;\
2929
echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\
3030
echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\
31-
echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin" ;\
32-
}
31+
echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin"
3332

3433
$(obj)/%.gen.S: FORCE
3534
$(call filechk,fwbin)

kernel/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ targets += config_data.gz
122122
$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
123123
$(call if_changed,gzip)
124124

125-
filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;")
125+
filechk_ikconfiggz = \
126+
echo "static const char kernel_config_data[] __used = MAGIC_START"; \
127+
cat $< | scripts/bin2c; \
128+
echo "MAGIC_END;"
129+
126130
targets += config_data.h
127131
$(obj)/config_data.h: $(obj)/config_data.gz FORCE
128132
$(call filechk,ikconfiggz)

scripts/Kbuild.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
5656
define filechk
5757
$(Q)set -e; \
5858
mkdir -p $(dir $@); \
59-
$(filechk_$(1)) > [email protected]; \
59+
{ $(filechk_$(1)); } > [email protected]; \
6060
if [ -r $@ ] && cmp -s $@ [email protected]; then \
6161
6262
else \

scripts/Makefile.lib

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ endef
417417
# Use filechk to avoid rebuilds when a header changes, but the resulting file
418418
# does not
419419
define filechk_offsets
420-
( \
421420
echo "#ifndef $2"; \
422421
echo "#define $2"; \
423422
echo "/*"; \
@@ -428,5 +427,5 @@ define filechk_offsets
428427
echo ""; \
429428
sed -ne $(sed-offsets) < $<; \
430429
echo ""; \
431-
echo "#endif" )
430+
echo "#endif"
432431
endef

0 commit comments

Comments
 (0)