Skip to content

Commit af03299

Browse files
captain5050borkmann
authored andcommitted
tools/resolve_btfids: Install subcmd headers
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 0cea651 commit af03299

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

tools/bpf/resolve_btfids/Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,29 @@ SUBCMD_SRC := $(srctree)/tools/lib/subcmd/
3535
BPFOBJ := $(OUTPUT)/libbpf/libbpf.a
3636
LIBBPF_OUT := $(abspath $(dir $(BPFOBJ)))/
3737
SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a
38+
SUBCMD_OUT := $(abspath $(dir $(SUBCMDOBJ)))/
3839

3940
LIBBPF_DESTDIR := $(LIBBPF_OUT)
4041
LIBBPF_INCLUDE := $(LIBBPF_DESTDIR)include
4142

43+
SUBCMD_DESTDIR := $(SUBCMD_OUT)
44+
SUBCMD_INCLUDE := $(SUBCMD_DESTDIR)include
45+
4246
BINARY := $(OUTPUT)/resolve_btfids
4347
BINARY_IN := $(BINARY)-in.o
4448

4549
all: $(BINARY)
4650

51+
prepare: $(BPFOBJ) $(SUBCMDOBJ)
52+
4753
$(OUTPUT) $(OUTPUT)/libsubcmd $(LIBBPF_OUT):
4854
$(call msg,MKDIR,,$@)
4955
$(Q)mkdir -p $(@)
5056

5157
$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd
52-
$(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
58+
$(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(SUBCMD_OUT) \
59+
DESTDIR=$(SUBCMD_DESTDIR) prefix= \
60+
$(abspath $@) install_headers
5361

5462
$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUT)
5563
$(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(LIBBPF_OUT) \
@@ -63,15 +71,15 @@ CFLAGS += -g \
6371
-I$(srctree)/tools/include \
6472
-I$(srctree)/tools/include/uapi \
6573
-I$(LIBBPF_INCLUDE) \
66-
-I$(SUBCMD_SRC) \
74+
-I$(SUBCMD_INCLUDE) \
6775
$(LIBELF_FLAGS)
6876

6977
LIBS = $(LIBELF_LIBS) -lz
7078

7179
export srctree OUTPUT CFLAGS Q
7280
include $(srctree)/tools/build/Makefile.include
7381

74-
$(BINARY_IN): $(BPFOBJ) fixdep FORCE | $(OUTPUT)
82+
$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)
7583
$(Q)$(MAKE) $(build)=resolve_btfids
7684

7785
$(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
@@ -83,7 +91,8 @@ clean_objects := $(wildcard $(OUTPUT)/*.o \
8391
$(OUTPUT)/.*.o.d \
8492
$(LIBBPF_OUT) \
8593
$(LIBBPF_DESTDIR) \
86-
$(OUTPUT)/libsubcmd \
94+
$(SUBCMD_OUT) \
95+
$(SUBCMD_DESTDIR) \
8796
$(OUTPUT)/resolve_btfids)
8897

8998
ifneq ($(clean_objects),)
@@ -100,4 +109,4 @@ tags:
100109

101110
FORCE:
102111

103-
.PHONY: all FORCE clean tags
112+
.PHONY: all FORCE clean tags prepare

tools/bpf/resolve_btfids/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#include <linux/err.h>
7676
#include <bpf/btf.h>
7777
#include <bpf/libbpf.h>
78-
#include <parse-options.h>
78+
#include <subcmd/parse-options.h>
7979

8080
#define BTF_IDS_SECTION ".BTF_ids"
8181
#define BTF_ID "__BTF_ID__"

0 commit comments

Comments
 (0)