On Sat, 2 Oct 2021 at 00:22, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Fri, Oct 1, 2021 at 4:09 AM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote: > > > > 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. > > @@ -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