Thread (25 messages) 25 messages, 2 authors, 2021-10-06

Re: [PATCH bpf-next v2 7/9] samples/bpf: install libbpf headers when building

From: Quentin Monnet <hidden>
Date: 2021-10-02 20:30:52
Also in: bpf

On Sat, 2 Oct 2021 at 00:22, Andrii Nakryiko [off-list ref] wrote:
On Fri, Oct 1, 2021 at 4:09 AM Quentin Monnet [off-list ref] wrote:
quoted
API headers from libbpf should not be accessed directly from the source
directory. Instead, they should be exported with "make install_headers".
Make sure that samples/bpf/Makefile installs the headers properly when
building.

The object compiled from and exported by libbpf are now placed into a
subdirectory of sample/bpf/ instead of remaining in tools/lib/bpf/. We
attempt to remove this directory on "make clean". However, the "clean"
target re-enters the samples/bpf/ directory from the root of the
repository ("$(MAKE) -C ../../ M=$(CURDIR) clean"), in such a way that
$(srctree) and $(src) are not defined, making it impossible to use
$(LIBBPF_OUTPUT) and $(LIBBPF_DESTDIR) in the recipe. So we only attempt
to clean $(CURDIR)/libbpf, which is the default value.

We also change the output directory for bpftool, to place the generated
objects under samples/bpf/bpftool/ instead of building in bpftool's
directory directly. Doing so, we make sure bpftool reuses the libbpf
library previously compiled and installed.
quoted
@@ -268,16 +272,28 @@ all:
 clean:
        $(MAKE) -C ../../ M=$(CURDIR) clean
        @find $(CURDIR) -type f -name '*~' -delete
+       @/bin/rm -rf $(CURDIR)/libbpf $(CURDIR)/bpftool
should this be $(RM) -rf ? I've seen other makefiles don't hardcode
/bin/rm. And also below we are passing RM='rm -rf', not /bin/rm.
Inconsistent :)
Inconsistent?! But I took it just a few lines above, from
BTF_LLVM_PROBE! :) But I also prefer "$(RM) -r" (the -f is included in
"$(RM)"), so sure, I'll address.
Quentin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help