kbuild: do not redirect the first prerequisite for filechk
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 25 Jul 2018 05:16:11 +0000 (14:16 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 28 Jul 2018 01:34:10 +0000 (10:34 +0900)
Currently, filechk unconditionally opens the first prerequisite and
redirects it as the stdin of a filechk_* rule.  Hence, every target
using $(call filechk,...) must list something as the first prerequisite
even if it is unneeded.

'< $<' is actually unneeded in most cases.  Each rule can explicitly
adds it if necessary.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Makefile
arch/s390/kernel/syscalls/Makefile
arch/um/Makefile
scripts/Kbuild.include
scripts/Makefile.lib

index 433f870..bc3a65b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1117,7 +1117,7 @@ define filechk_version.h
        echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
 endef
 
-$(version_h): $(srctree)/Makefile FORCE
+$(version_h): FORCE
        $(call filechk,version.h)
        $(Q)rm -f $(old_version_h)
 
index 8ff96c0..4d929ed 100644 (file)
@@ -25,15 +25,15 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
          $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
 
 define filechk_syshdr
-       $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2"
+       $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
 endef
 
 define filechk_sysnr
-       $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget))
+       $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
 endef
 
 define filechk_syscalls
-       $(CONFIG_SHELL) '$(systbl)' -S
+       $(CONFIG_SHELL) '$(systbl)' -S < $<
 endef
 
 syshdr_abi_unistd_32 := common,32
index e54dda8..8c35261 100644 (file)
@@ -169,7 +169,7 @@ define filechk_gen-asm-offsets
          echo " *"; \
          echo " */"; \
          echo ""; \
-         sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+         sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \
          echo ""; )
 endef
 
index 02bb316..7eabe80 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 f56bb4b..df0fff2 100644 (file)
@@ -415,7 +415,7 @@ define filechk_offsets
         echo " * This file was generated by Kbuild"; \
         echo " */"; \
         echo ""; \
-        sed -ne $(sed-offsets); \
+        sed -ne $(sed-offsets) < $<; \
         echo ""; \
         echo "#endif" )
 endef