From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: alexei.starovoitov@gmail.com, daniel@iogearbox.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
"Björn Töpel" <bjorn.topel@gmail.com>,
"Y Song" <ys114321@gmail.com>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Jakub Kicinski" <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next v2 3/5] samples: bpf: fix build after move to compiling full libbpf.a
Date: Mon, 14 May 2018 22:35:04 -0700 [thread overview]
Message-ID: <20180515053506.4345-4-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180515053506.4345-1-jakub.kicinski@netronome.com>
There are many ways users may compile samples, some of them got
broken by commit 5f9380572b4b ("samples: bpf: compile and link
against full libbpf"). Improve path resolution and make libbpf
building a dependency of source files to force its build.
Samples should now again build with any of:
cd samples/bpf; make
make samples/bpf/
make -C samples/bpf
cd samples/bpf; make O=builddir
make samples/bpf/ O=builddir
make -C samples/bpf O=builddir
export KBUILD_OUTPUT=builddir
make samples/bpf/
make -C samples/bpf
Fixes: 5f9380572b4b ("samples: bpf: compile and link against full libbpf")
Reported-by: Björn Töpel <bjorn.topel@gmail.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
samples/bpf/Makefile | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 9e255ca4059a..0dae77c88d2e 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -1,4 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
+
+BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src))
+TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools
+
# List of programs to build
hostprogs-y := test_lru_dist
hostprogs-y += sock_example
@@ -49,7 +53,8 @@ hostprogs-y += xdpsock
hostprogs-y += xdp_fwd
# Libbpf dependencies
-LIBBPF := ../../tools/lib/bpf/libbpf.a
+LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a
+
CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o
TRACE_HELPERS := ../../tools/testing/selftests/bpf/trace_helpers.o
@@ -233,15 +238,16 @@ CLANG_ARCH_ARGS = -target $(ARCH)
endif
# Trick to allow make to be run from this directory
-all: $(LIBBPF)
- $(MAKE) -C ../../ $(CURDIR)/
+all:
+ $(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR)
clean:
$(MAKE) -C ../../ M=$(CURDIR) clean
@rm -f *~
$(LIBBPF): FORCE
- $(MAKE) -C $(dir $@)
+# Fix up variables inherited from Kbuild that tools/ build system won't like
+ $(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O=
$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c
$(call if_changed_dep,cc_s_c)
@@ -272,7 +278,8 @@ verify_target_bpf: verify_cmds
exit 2; \
else true; fi
-$(src)/*.c: verify_target_bpf
+$(BPF_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF)
+$(src)/*.c: verify_target_bpf $(LIBBPF)
$(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
--
2.17.0
next prev parent reply other threads:[~2018-05-15 5:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 5:35 [PATCH bpf-next v2 0/5] samples: bpf: fix build after move to full libbpf Jakub Kicinski
2018-05-15 5:35 ` [PATCH bpf-next v2 1/5] samples: bpf: include bpf/bpf.h instead of local libbpf.h Jakub Kicinski
2018-05-15 5:35 ` [PATCH bpf-next v2 2/5] samples: bpf: rename libbpf.h to bpf_insn.h Jakub Kicinski
2018-05-15 5:35 ` Jakub Kicinski [this message]
2018-05-15 6:05 ` [PATCH bpf-next v2 3/5] samples: bpf: fix build after move to compiling full libbpf.a Björn Töpel
2018-05-15 5:35 ` [PATCH bpf-next v2 4/5] samples: bpf: move libbpf from object dependencies to libs Jakub Kicinski
2018-05-15 5:35 ` [PATCH bpf-next v2 5/5] samples: bpf: make the build less noisy Jakub Kicinski
2018-05-15 5:57 ` [PATCH bpf-next v2 0/5] samples: bpf: fix build after move to full libbpf Alexei Starovoitov
2018-05-15 6:10 ` Jesper Dangaard Brouer
2018-05-15 9:16 ` Jesper Dangaard Brouer
2018-05-15 17:46 ` Jakub Kicinski
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=20180515053506.4345-4-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bjorn.topel@gmail.com \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=ys114321@gmail.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 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.