summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-31 03:24:09 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-01-05 19:46:51 -0500
commitad774086356da92a477a87916613d96f4b36005c (patch)
tree74ef11898c40507c5705d6980e856a250a4b089a
parent172caf1993b7a6503a9f7faf589e2cf26eb1f219 (diff)
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 <yamada.masahiro@socionext.com>
-rw-r--r--Kbuild2
-rw-r--r--Makefile6
-rw-r--r--arch/s390/tools/Makefile2
-rw-r--r--firmware/Makefile5
-rw-r--r--kernel/Makefile6
-rw-r--r--scripts/Kbuild.include2
-rw-r--r--scripts/Makefile.lib3
7 files changed, 14 insertions, 12 deletions
diff --git a/Kbuild b/Kbuild
index 414ae6da1f50..06b801e12fb4 100644
--- a/Kbuild
+++ b/Kbuild
@@ -27,7 +27,7 @@ timeconst-file := include/generated/timeconst.h
27targets += $(timeconst-file) 27targets += $(timeconst-file)
28 28
29define filechk_gentimeconst 29define filechk_gentimeconst
30 (echo $(CONFIG_HZ) | bc -q $< ) 30 echo $(CONFIG_HZ) | bc -q $<
31endef 31endef
32 32
33$(timeconst-file): kernel/time/timeconst.bc FORCE 33$(timeconst-file): kernel/time/timeconst.bc FORCE
diff --git a/Makefile b/Makefile
index 04a857817f77..437d6033598c 100644
--- a/Makefile
+++ b/Makefile
@@ -1127,13 +1127,13 @@ define filechk_utsrelease.h
1127 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 1127 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
1128 exit 1; \ 1128 exit 1; \
1129 fi; \ 1129 fi; \
1130 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) 1130 echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"
1131endef 1131endef
1132 1132
1133define filechk_version.h 1133define filechk_version.h
1134 (echo \#define LINUX_VERSION_CODE $(shell \ 1134 echo \#define LINUX_VERSION_CODE $(shell \
1135 expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \ 1135 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))'
1137endef 1137endef
1138 1138
1139$(version_h): FORCE 1139$(version_h): FORCE
diff --git a/arch/s390/tools/Makefile b/arch/s390/tools/Makefile
index 48cdac1143a9..cf4846a7ee8d 100644
--- a/arch/s390/tools/Makefile
+++ b/arch/s390/tools/Makefile
@@ -25,7 +25,7 @@ define filechk_facility-defs.h
25endef 25endef
26 26
27define filechk_dis-defs.h 27define 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
29endef 29endef
30 30
31$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE 31$(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
diff --git a/firmware/Makefile b/firmware/Makefile
index e2f7dd2f30e0..37e5ae387400 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -13,7 +13,7 @@ ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long)
13ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) 13ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
14PROGBITS = $(if $(CONFIG_ARM),%,@)progbits 14PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
15 15
16filechk_fwbin = { \ 16filechk_fwbin = \
17 echo "/* Generated by $(src)/Makefile */" ;\ 17 echo "/* Generated by $(src)/Makefile */" ;\
18 echo " .section .rodata" ;\ 18 echo " .section .rodata" ;\
19 echo " .p2align $(ASM_ALIGN)" ;\ 19 echo " .p2align $(ASM_ALIGN)" ;\
@@ -28,8 +28,7 @@ filechk_fwbin = { \
28 echo " .p2align $(ASM_ALIGN)" ;\ 28 echo " .p2align $(ASM_ALIGN)" ;\
29 echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\ 29 echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\
30 echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\ 30 echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\
31 echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin" ;\ 31 echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin"
32}
33 32
34$(obj)/%.gen.S: FORCE 33$(obj)/%.gen.S: FORCE
35 $(call filechk,fwbin) 34 $(call filechk,fwbin)
diff --git a/kernel/Makefile b/kernel/Makefile
index cde93d54c571..6aa7543bcdb2 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -122,7 +122,11 @@ targets += config_data.gz
122$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE 122$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
123 $(call if_changed,gzip) 123 $(call if_changed,gzip)
124 124
125 filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") 125filechk_ikconfiggz = \
126 echo "static const char kernel_config_data[] __used = MAGIC_START"; \
127 cat $< | scripts/bin2c; \
128 echo "MAGIC_END;"
129
126targets += config_data.h 130targets += config_data.h
127$(obj)/config_data.h: $(obj)/config_data.gz FORCE 131$(obj)/config_data.h: $(obj)/config_data.gz FORCE
128 $(call filechk,ikconfiggz) 132 $(call filechk,ikconfiggz)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 46bf1a073f5d..74a3fe7ddc01 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
56define filechk 56define filechk
57 $(Q)set -e; \ 57 $(Q)set -e; \
58 mkdir -p $(dir $@); \ 58 mkdir -p $(dir $@); \
59 $(filechk_$(1)) > $@.tmp; \ 59 { $(filechk_$(1)); } > $@.tmp; \
60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \ 60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
61 rm -f $@.tmp; \ 61 rm -f $@.tmp; \
62 else \ 62 else \
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 390957f9306f..12b88d09c3a4 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -417,7 +417,6 @@ endef
417# Use filechk to avoid rebuilds when a header changes, but the resulting file 417# Use filechk to avoid rebuilds when a header changes, but the resulting file
418# does not 418# does not
419define filechk_offsets 419define filechk_offsets
420 ( \
421 echo "#ifndef $2"; \ 420 echo "#ifndef $2"; \
422 echo "#define $2"; \ 421 echo "#define $2"; \
423 echo "/*"; \ 422 echo "/*"; \
@@ -428,5 +427,5 @@ define filechk_offsets
428 echo ""; \ 427 echo ""; \
429 sed -ne $(sed-offsets) < $<; \ 428 sed -ne $(sed-offsets) < $<; \
430 echo ""; \ 429 echo ""; \
431 echo "#endif" ) 430 echo "#endif"
432endef 431endef