All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Monnet <quentin@isovalent.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	Quentin Monnet <quentin@isovalent.com>
Subject: [PATCH bpf-next v4 10/12] samples/bpf: do not FORCE-recompile libbpf
Date: Thu,  7 Oct 2021 20:44:36 +0100	[thread overview]
Message-ID: <20211007194438.34443-11-quentin@isovalent.com> (raw)
In-Reply-To: <20211007194438.34443-1-quentin@isovalent.com>

In samples/bpf/Makefile, libbpf has a FORCE dependency that force it to
be rebuilt. I read this as a way to keep the library up-to-date, given
that we do not have, in samples/bpf, a list of the source files for
libbpf itself. However, a better approach would be to use the
"$(wildcard ...)" function from make, and to have libbpf depend on all
the .c and .h files in its directory. This is what samples/bpf/Makefile
does for bpftool, and also what the BPF selftests' Makefile does for
libbpf.

Let's update the Makefile to avoid rebuilding libbpf all the time (and
bpftool on top of it).

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
---
 samples/bpf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index cb72198f6b48..c9cee54ce79d 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -276,7 +276,8 @@ clean:
 	@find $(CURDIR) -type f -name '*~' -delete
 	@$(RM) -r $(CURDIR)/libbpf $(CURDIR)/bpftool
 
-$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
+$(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) \
+	   | $(LIBBPF_OUTPUT)
 # Fix up variables inherited from Kbuild that tools/ build system won't like
 	$(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \
 		LDFLAGS=$(TPROGS_LDFLAGS) srctree=$(BPF_SAMPLES_PATH)/../../ \
-- 
2.30.2


  parent reply	other threads:[~2021-10-07 19:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 19:44 [PATCH bpf-next v4 00/12] install libbpf headers when using the library Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 01/12] libbpf: skip re-installing headers file if source is older than target Quentin Monnet
2021-10-08 19:13   ` Andrii Nakryiko
2021-10-07 19:44 ` [PATCH bpf-next v4 02/12] bpftool: remove unused includes to <bpf/bpf_gen_internal.h> Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 03/12] bpftool: install libbpf headers instead of including the dir Quentin Monnet
2021-10-08 19:13   ` Andrii Nakryiko
2021-10-07 19:44 ` [PATCH bpf-next v4 04/12] tools/resolve_btfids: install libbpf headers when building Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 05/12] tools/runqslower: " Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 06/12] bpf: preload: " Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 07/12] bpf: iterators: " Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 08/12] samples/bpf: update .gitignore Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 09/12] samples/bpf: install libbpf headers when building Quentin Monnet
2021-10-07 19:44 ` Quentin Monnet [this message]
2021-10-07 19:44 ` [PATCH bpf-next v4 11/12] selftests/bpf: better clean up for runqslower in test_bpftool_build.sh Quentin Monnet
2021-10-07 19:44 ` [PATCH bpf-next v4 12/12] bpftool: add install-bin target to install binary only Quentin Monnet
2021-10-08 19:13 ` [PATCH bpf-next v4 00/12] install libbpf headers when using the library Andrii Nakryiko
2021-10-09 21:03   ` Quentin Monnet
2021-10-11  6:46     ` Andrii Nakryiko

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=20211007194438.34443-11-quentin@isovalent.com \
    --to=quentin@isovalent.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.