Commit ad774086 authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 172caf19
...@@ -27,7 +27,7 @@ timeconst-file := include/generated/timeconst.h ...@@ -27,7 +27,7 @@ timeconst-file := include/generated/timeconst.h
targets += $(timeconst-file) targets += $(timeconst-file)
define filechk_gentimeconst define filechk_gentimeconst
(echo $(CONFIG_HZ) | bc -q $< ) echo $(CONFIG_HZ) | bc -q $<
endef endef
$(timeconst-file): kernel/time/timeconst.bc FORCE $(timeconst-file): kernel/time/timeconst.bc FORCE
......
...@@ -1127,13 +1127,13 @@ define filechk_utsrelease.h ...@@ -1127,13 +1127,13 @@ define filechk_utsrelease.h
echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
exit 1; \ exit 1; \
fi; \ fi; \
(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"
endef endef
define filechk_version.h define filechk_version.h
(echo \#define LINUX_VERSION_CODE $(shell \ echo \#define LINUX_VERSION_CODE $(shell \
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \ expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
endef endef
$(version_h): FORCE $(version_h): FORCE
......
...@@ -25,7 +25,7 @@ define filechk_facility-defs.h ...@@ -25,7 +25,7 @@ define filechk_facility-defs.h
endef endef
define filechk_dis-defs.h define filechk_dis-defs.h
( $(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt ) $(obj)/gen_opcode_table < $(srctree)/arch/$(ARCH)/tools/opcodes.txt
endef endef
$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE $(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
......
...@@ -13,7 +13,7 @@ ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long) ...@@ -13,7 +13,7 @@ ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long)
ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
PROGBITS = $(if $(CONFIG_ARM),%,@)progbits PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
filechk_fwbin = { \ filechk_fwbin = \
echo "/* Generated by $(src)/Makefile */" ;\ echo "/* Generated by $(src)/Makefile */" ;\
echo " .section .rodata" ;\ echo " .section .rodata" ;\
echo " .p2align $(ASM_ALIGN)" ;\ echo " .p2align $(ASM_ALIGN)" ;\
...@@ -28,8 +28,7 @@ filechk_fwbin = { \ ...@@ -28,8 +28,7 @@ filechk_fwbin = { \
echo " .p2align $(ASM_ALIGN)" ;\ echo " .p2align $(ASM_ALIGN)" ;\
echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\ echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\
echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\ echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\
echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin" ;\ echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin"
}
$(obj)/%.gen.S: FORCE $(obj)/%.gen.S: FORCE
$(call filechk,fwbin) $(call filechk,fwbin)
......
...@@ -122,7 +122,11 @@ targets += config_data.gz ...@@ -122,7 +122,11 @@ targets += config_data.gz
$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") filechk_ikconfiggz = \
echo "static const char kernel_config_data[] __used = MAGIC_START"; \
cat $< | scripts/bin2c; \
echo "MAGIC_END;"
targets += config_data.h targets += config_data.h
$(obj)/config_data.h: $(obj)/config_data.gz FORCE $(obj)/config_data.h: $(obj)/config_data.gz FORCE
$(call filechk,ikconfiggz) $(call filechk,ikconfiggz)
...@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho) ...@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
define filechk define filechk
$(Q)set -e; \ $(Q)set -e; \
mkdir -p $(dir $@); \ mkdir -p $(dir $@); \
$(filechk_$(1)) > $@.tmp; \ { $(filechk_$(1)); } > $@.tmp; \
if [ -r $@ ] && cmp -s $@ $@.tmp; then \ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
rm -f $@.tmp; \ rm -f $@.tmp; \
else \ else \
......
...@@ -417,7 +417,6 @@ endef ...@@ -417,7 +417,6 @@ endef
# Use filechk to avoid rebuilds when a header changes, but the resulting file # Use filechk to avoid rebuilds when a header changes, but the resulting file
# does not # does not
define filechk_offsets define filechk_offsets
( \
echo "#ifndef $2"; \ echo "#ifndef $2"; \
echo "#define $2"; \ echo "#define $2"; \
echo "/*"; \ echo "/*"; \
...@@ -428,5 +427,5 @@ define filechk_offsets ...@@ -428,5 +427,5 @@ define filechk_offsets
echo ""; \ echo ""; \
sed -ne $(sed-offsets) < $<; \ sed -ne $(sed-offsets) < $<; \
echo ""; \ echo ""; \
echo "#endif" ) echo "#endif"
endef endef
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment