kbuild: change filechk to surround the given command with { }
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 31 Dec 2018 08:24:09 +0000 (17:24 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 6 Jan 2019 00:46:51 +0000 (09:46 +0900)
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>
Kbuild
Makefile
arch/s390/tools/Makefile
firmware/Makefile
kernel/Makefile
scripts/Kbuild.include
scripts/Makefile.lib

diff --git a/Kbuild b/Kbuild
index 414ae6da1f50dea68fd044ca2d09d682c308fab4..06b801e12fb45bbee2256e5c7717c3750695de27 100644 (file)
--- a/Kbuild
+++ b/Kbuild
@@ -27,7 +27,7 @@ timeconst-file := include/generated/timeconst.h
 targets += $(timeconst-file)
 
 define filechk_gentimeconst
-       (echo $(CONFIG_HZ) | bc -q $< )
+       echo $(CONFIG_HZ) | bc -q $<
 endef
 
 $(timeconst-file): kernel/time/timeconst.bc FORCE
index 04a857817f77cf02fa8100444a99b3fb15019438..437d6033598c2eedde0ed656dc78556daf3b678b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1127,13 +1127,13 @@ define filechk_utsrelease.h
          echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2;    \
          exit 1;                                                         \
        fi;                                                               \
-       (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
+       echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"
 endef
 
 define filechk_version.h
-       (echo \#define LINUX_VERSION_CODE $(shell                         \
+       echo \#define LINUX_VERSION_CODE $(shell                         \
        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
 
 $(version_h): FORCE
index 48cdac1143a9f4c99f784535c13e41f5a6056da9..cf4846a7ee8d90aa970d9b3f41570724014cedb1 100644 (file)
@@ -25,7 +25,7 @@ define filechk_facility-defs.h
 endef
 
 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
 
 $(kapi)/facility-defs.h: $(obj)/gen_facilities FORCE
index e2f7dd2f30e0dcc4b592ccafe960127f78f94818..37e5ae387400abbf984a90d67b72ee246460c32b 100644 (file)
@@ -13,7 +13,7 @@ ASM_WORD  = $(if $(CONFIG_64BIT),.quad,.long)
 ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
 PROGBITS  = $(if $(CONFIG_ARM),%,@)progbits
 
-filechk_fwbin = \
+filechk_fwbin = \
        echo "/* Generated by $(src)/Makefile */"               ;\
        echo "    .section .rodata"                             ;\
        echo "    .p2align $(ASM_ALIGN)"                        ;\
@@ -28,8 +28,7 @@ filechk_fwbin = { \
        echo "    .p2align $(ASM_ALIGN)"                        ;\
        echo "    $(ASM_WORD) _fw_$(FWSTR)_name"                ;\
        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
        $(call filechk,fwbin)
index cde93d54c5711806764a6935994cb1fc9ca4b7fb..6aa7543bcdb2de45deb45743ebafda220343bd48 100644 (file)
@@ -122,7 +122,11 @@ targets += config_data.gz
 $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
        $(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
 $(obj)/config_data.h: $(obj)/config_data.gz FORCE
        $(call filechk,ikconfiggz)
index 46bf1a073f5dd44acb1c227fb55c86928ee21f43..74a3fe7ddc01822edf000f2b7cf2c48d112c667e 100644 (file)
@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
 define filechk
        $(Q)set -e;                             \
        mkdir -p $(dir $@);                     \
-       $(filechk_$(1)) > $@.tmp;               \
+       { $(filechk_$(1)); } > $@.tmp;          \
        if [ -r $@ ] && cmp -s $@ $@.tmp; then  \
                rm -f $@.tmp;                   \
        else                                    \
index 390957f9306f3e89ca570fa09d7f6fd133f7b76b..12b88d09c3a4bf7e9094633276c7de7abddbb849 100644 (file)
@@ -417,7 +417,6 @@ endef
 # Use filechk to avoid rebuilds when a header changes, but the resulting file
 # does not
 define filechk_offsets
-       ( \
         echo "#ifndef $2"; \
         echo "#define $2"; \
         echo "/*"; \
@@ -428,5 +427,5 @@ define filechk_offsets
         echo ""; \
         sed -ne $(sed-offsets) < $<; \
         echo ""; \
-        echo "#endif" )
+        echo "#endif"
 endef