[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180405151645.19130-5-jolsa@kernel.org>
Date: Thu, 5 Apr 2018 17:16:40 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Cc: lkml <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org,
linux-kbuild@...r.kernel.org,
Quentin Monnet <quentin.monnet@...ronome.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Jiri Benc <jbenc@...hat.com>,
Stanislav Kozina <skozina@...hat.com>,
Jerome Marchand <jmarchan@...hat.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Michal Marek <michal.lkml@...kovi.net>,
Jiri Kosina <jkosina@...e.cz>
Subject: [PATCH 4/9] kbuild: Add filechk2 function
Adding filechk2 function that has the same semantics
as filechk, but it takes the target file from the 2nd
argument instead of from the '$@' as in the filechk
function.
This function is needed when we can't have separate
target for the file, like in the following patch.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
scripts/Kbuild.include | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 065324a8046f..9775ce2771d4 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -67,6 +67,30 @@ define filechk
fi
endef
+# filechk2 is used to check if the content of a generated file is updated.
+# It follows the same logic as the filechk except instead of the $@ target
+# variable, the checked file is passed in 2nd argument.
+#
+# Sample usage:
+# define filechk_sample
+# echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+# $(call filechk2,sample,version.h)
+# endef
+define filechk2
+ $(Q)set -e; \
+ $(kecho) ' CHK $(2)'; \
+ mkdir -p $(dir $(2)); \
+ $(filechk_$(1)) < $< > $(2).tmp; \
+ if [ -r $(2) ] && cmp -s $(2) $(2).tmp; then \
+ rm -f $(2).tmp; \
+ else \
+ $(kecho) ' UPD $(2)'; \
+ mv -f $(2).tmp $(2); \
+ fi
+endef
+
######
# gcc support functions
# See documentation in Documentation/kbuild/makefiles.txt
--
2.13.6
Powered by blists - more mailing lists