Merge tag 'asoc-fix-v5.8' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[platform/kernel/linux-starfive.git] / scripts / Kbuild.include
index bc5f257..6cabf20 100644 (file)
@@ -33,6 +33,10 @@ real-prereqs = $(filter-out $(PHONY), $^)
 escsq = $(subst $(squote),'\$(squote)',$1)
 
 ###
+# Quote a string to pass it to C files. foo => '"foo"'
+stringify = $(squote)$(quote)$1$(quote)$(squote)
+
+###
 # Easy method for doing a status message
        kecho := :
  quiet_kecho := echo
@@ -55,14 +59,13 @@ kecho := $($(quiet)kecho)
 # - stdin is piped in from the first prerequisite ($<) so one has
 #   to specify a valid file as first prerequisite (often the kbuild file)
 define filechk
-       $(Q)set -e;                             \
-       mkdir -p $(dir $@);                     \
-       { $(filechk_$(1)); } > $@.tmp;          \
-       if [ -r $@ ] && cmp -s $@ $@.tmp; then  \
-               rm -f $@.tmp;                   \
-       else                                    \
-               $(kecho) '  UPD     $@';        \
-               mv -f $@.tmp $@;                \
+       $(Q)set -e;                                             \
+       mkdir -p $(dir $@);                                     \
+       trap "rm -f $(dot-target).tmp" EXIT;                    \
+       { $(filechk_$(1)); } > $(dot-target).tmp;               \
+       if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then   \
+               $(kecho) '  UPD     $@';                        \
+               mv -f $(dot-target).tmp $@;                     \
        fi
 endef
 
@@ -160,12 +163,6 @@ ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
 build := -f $(srctree)/scripts/Makefile.build obj
 
 ###
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
-# Usage:
-# $(Q)$(MAKE) $(modbuiltin)=dir
-modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj
-
-###
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
 # Usage:
 # $(Q)$(MAKE) $(dtbinst)=dir