From: Jiri Olsa <olsajiri@gmail.com>
To: Ian Rogers <irogers@google.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Connor OBrien <connoro@google.com>,
Nathan Chancellor <nathan@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] tools/resolve_btfids: Install subcmd headers
Date: Wed, 25 Jan 2023 00:04:57 +0100 [thread overview]
Message-ID: <Y9BkGR8me2T7CWoT@krava> (raw)
In-Reply-To: <20230124064324.672022-1-irogers@google.com>
On Mon, Jan 23, 2023 at 10:43:23PM -0800, Ian Rogers wrote:
> Previously tools/lib/subcmd was added to the include path, switch to
> installing the headers and then including from that directory. This
> avoids dependencies on headers internal to tools/lib/subcmd. Add the
> missing subcmd directory to the affected #include.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: iri Olsa <jolsa@kernel.org>
jirka
> ---
> tools/bpf/resolve_btfids/Makefile | 19 ++++++++++++++-----
> tools/bpf/resolve_btfids/main.c | 2 +-
> 2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index f7375a119f54..1fe0082b2ecc 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -35,21 +35,29 @@ SUBCMD_SRC := $(srctree)/tools/lib/subcmd/
> BPFOBJ := $(OUTPUT)/libbpf/libbpf.a
> LIBBPF_OUT := $(abspath $(dir $(BPFOBJ)))/
> SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a
> +SUBCMD_OUT := $(abspath $(dir $(SUBCMDOBJ)))/
>
> LIBBPF_DESTDIR := $(LIBBPF_OUT)
> LIBBPF_INCLUDE := $(LIBBPF_DESTDIR)include
>
> +SUBCMD_DESTDIR := $(SUBCMD_OUT)
> +SUBCMD_INCLUDE := $(SUBCMD_DESTDIR)include
> +
> BINARY := $(OUTPUT)/resolve_btfids
> BINARY_IN := $(BINARY)-in.o
>
> all: $(BINARY)
>
> +prepare: $(BPFOBJ) $(SUBCMDOBJ)
> +
> $(OUTPUT) $(OUTPUT)/libsubcmd $(LIBBPF_OUT):
> $(call msg,MKDIR,,$@)
> $(Q)mkdir -p $(@)
>
> $(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd
> - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
> + $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(SUBCMD_OUT) \
> + DESTDIR=$(SUBCMD_DESTDIR) prefix= \
> + $(abspath $@) install_headers
>
> $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUT)
> $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(LIBBPF_OUT) \
> @@ -63,7 +71,7 @@ CFLAGS += -g \
> -I$(srctree)/tools/include \
> -I$(srctree)/tools/include/uapi \
> -I$(LIBBPF_INCLUDE) \
> - -I$(SUBCMD_SRC) \
> + -I$(SUBCMD_INCLUDE) \
> $(LIBELF_FLAGS)
>
> LIBS = $(LIBELF_LIBS) -lz
> @@ -71,7 +79,7 @@ LIBS = $(LIBELF_LIBS) -lz
> export srctree OUTPUT CFLAGS Q
> include $(srctree)/tools/build/Makefile.include
>
> -$(BINARY_IN): $(BPFOBJ) fixdep FORCE | $(OUTPUT)
> +$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)
> $(Q)$(MAKE) $(build)=resolve_btfids
>
> $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
> @@ -83,7 +91,8 @@ clean_objects := $(wildcard $(OUTPUT)/*.o \
> $(OUTPUT)/.*.o.d \
> $(LIBBPF_OUT) \
> $(LIBBPF_DESTDIR) \
> - $(OUTPUT)/libsubcmd \
> + $(SUBCMD_OUT) \
> + $(SUBCMD_DESTDIR) \
> $(OUTPUT)/resolve_btfids)
>
> ifneq ($(clean_objects),)
> @@ -100,4 +109,4 @@ tags:
>
> FORCE:
>
> -.PHONY: all FORCE clean tags
> +.PHONY: all FORCE clean tags prepare
> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> index 80cd7843c677..77058174082d 100644
> --- a/tools/bpf/resolve_btfids/main.c
> +++ b/tools/bpf/resolve_btfids/main.c
> @@ -75,7 +75,7 @@
> #include <linux/err.h>
> #include <bpf/btf.h>
> #include <bpf/libbpf.h>
> -#include <parse-options.h>
> +#include <subcmd/parse-options.h>
>
> #define BTF_IDS_SECTION ".BTF_ids"
> #define BTF_ID "__BTF_ID__"
> --
> 2.39.0.246.g2a6d74b583-goog
>
next prev parent reply other threads:[~2023-01-24 23:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 6:43 [PATCH v4 1/2] tools/resolve_btfids: Install subcmd headers Ian Rogers
2023-01-24 6:43 ` [PATCH v4 2/2] tools/resolve_btfids: Alter how HOSTCC is forced Ian Rogers
2023-01-24 23:08 ` Jiri Olsa
2023-01-31 17:20 ` Nathan Chancellor
2023-01-31 18:08 ` Ian Rogers
2023-01-31 19:25 ` Ian Rogers
2023-01-31 19:33 ` Nathan Chancellor
2023-01-31 20:59 ` Ian Rogers
2023-01-31 21:17 ` Nathan Chancellor
2023-01-31 22:40 ` Jiri Olsa
2023-01-31 22:50 ` Ian Rogers
2023-02-01 2:00 ` Ian Rogers
2023-01-24 23:04 ` Jiri Olsa [this message]
2023-01-25 17:30 ` [PATCH v4 1/2] tools/resolve_btfids: Install subcmd headers patchwork-bot+netdevbpf
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=Y9BkGR8me2T7CWoT@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=connoro@google.com \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=irogers@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=nathan@kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.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.