netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: lkml <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Quentin Monnet <quentin.monnet@netronome.com>,
	Eugene Syromiatnikov <esyr@redhat.com>,
	Jiri Benc <jbenc@redhat.com>,
	Stanislav Kozina <skozina@redhat.com>,
	Jerome Marchand <jmarchan@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH 4/9] kbuild: Add filechk2 function
Date: Thu,  5 Apr 2018 17:16:40 +0200	[thread overview]
Message-ID: <20180405151645.19130-5-jolsa@kernel.org> (raw)
In-Reply-To: <20180405151645.19130-1-jolsa@kernel.org>

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@kernel.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

  parent reply	other threads:[~2018-04-05 15:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 15:16 [RFC 0/9] bpf: Add buildid check support Jiri Olsa
2018-04-05 15:16 ` [PATCH 1/9] perf tools: Make read_build_id function public Jiri Olsa
2018-04-05 15:16 ` [PATCH 2/9] perf tools: Add fetch_kernel_buildid function Jiri Olsa
2018-04-05 15:16 ` [PATCH 3/9] kbuild: Do not pass arguments to link-vmlinux.sh Jiri Olsa
2018-04-05 15:50   ` Masahiro Yamada
2018-04-05 18:59     ` Jiri Olsa
2018-04-06  0:59       ` Masahiro Yamada
2018-04-06 16:54         ` Jiri Olsa
2018-04-05 15:16 ` Jiri Olsa [this message]
2018-04-05 15:16 ` [PATCH 5/9] bpf: Add CONFIG_BUILDID_H option Jiri Olsa
2018-04-05 15:16 ` [PATCH 6/9] bpf: Add CONFIG_BPF_BUILDID_CHECK option Jiri Olsa
2018-04-05 15:16 ` [PATCH 7/9] libbpf: Synchronize uapi bpf.h header Jiri Olsa
2018-04-05 15:16 ` [PATCH 8/9] libbpf: Add support to attach buildid to program load Jiri Olsa
2018-04-05 15:16 ` [PATCH 9/9] perf tools: The buildid usage in example eBPF program Jiri Olsa
2018-04-06  1:37 ` [RFC 0/9] bpf: Add buildid check support Alexei Starovoitov
2018-04-06 15:07   ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180405151645.19130-5-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=esyr@redhat.com \
    --cc=jbenc@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=jmarchan@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.monnet@netronome.com \
    --cc=skozina@redhat.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).