Re: [PATCH bpf-next v4 04/10] tools/runqslower: Use consistent include paths for libbpf

From: Andrii Nakryiko
Date: Fri Jan 17 2020 - 16:52:05 EST


On Fri, Jan 17, 2020 at 5:37 AM Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx> wrote:
>
> From: Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx>
>
> Fix the runqslower tool to include libbpf header files with the bpf/
> prefix, to be consistent with external users of the library. Also ensure
> that all includes of exported libbpf header files (those that are exported
> on 'make install' of the library) use bracketed includes instead of quoted.
>
> To not break the build, keep the old include path until everything has been
> changed to the new one; a subsequent patch will remove that.
>
> Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
> Acked-by: Andrii Nakryiko <andriin@xxxxxx>
> Signed-off-by: Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx>
> ---
> tools/bpf/runqslower/Makefile | 5 +++--
> tools/bpf/runqslower/runqslower.bpf.c | 2 +-
> tools/bpf/runqslower/runqslower.c | 4 ++--
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> index b62fc9646c39..9f022f7f2593 100644
> --- a/tools/bpf/runqslower/Makefile
> +++ b/tools/bpf/runqslower/Makefile
> @@ -5,6 +5,7 @@ LLC := llc
> LLVM_STRIP := llvm-strip
> DEFAULT_BPFTOOL := $(OUTPUT)/sbin/bpftool
> BPFTOOL ?= $(DEFAULT_BPFTOOL)
> +INCLUDES := -I$(OUTPUT) -I$(abspath ../../lib) -I$(abspath ../../lib/bpf)
> LIBBPF_SRC := $(abspath ../../lib/bpf)

drop LIBBPF_SRC, it's not used anymore

> CFLAGS := -g -Wall
>
> @@ -51,13 +52,13 @@ $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(BPFTOOL)
>
> $(OUTPUT)/%.bpf.o: %.bpf.c $(OUTPUT)/libbpf.a | $(OUTPUT)
> $(call msg,BPF,$@)
> - $(Q)$(CLANG) -g -O2 -target bpf -I$(OUTPUT) -I$(LIBBPF_SRC) \
> + $(Q)$(CLANG) -g -O2 -target bpf $(INCLUDES) \

please preserve formatting and alignment conventions of a file

> -c $(filter %.c,$^) -o $@ && \
> $(LLVM_STRIP) -g $@
>
> $(OUTPUT)/%.o: %.c | $(OUTPUT)
> $(call msg,CC,$@)
> - $(Q)$(CC) $(CFLAGS) -I$(LIBBPF_SRC) -I$(OUTPUT) -c $(filter %.c,$^) -o $@
> + $(Q)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@
>
> $(OUTPUT):

[...]