Skip to content

Commit

Permalink
Makefile: build and use lightweight bootstrap version of bpftool
Browse files Browse the repository at this point in the history
We don't need most of bpftool functionality, just the skeleton
generation and, potentially, static linking, so there is no point in
building full-featured final bpftool version. So build and use bootstrap
bpftool. This should also ease user's pain like [0].

  [0] libbpf#89

Cc: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
  • Loading branch information
anakryiko committed Jul 8, 2022
1 parent 4d02012 commit fc28424
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ LLVM_STRIP ?= llvm-strip
LIBBPF_SRC := $(abspath ../../libbpf/src)
BPFTOOL_SRC := $(abspath ../../bpftool/src)
LIBBPF_OBJ := $(abspath $(OUTPUT)/libbpf.a)
BPFTOOL ?= $(abspath $(OUTPUT)/bpftool/bpftool)
BPFTOOL_OUTPUT ?= $(abspath $(OUTPUT)/bpftool)
BPFTOOL ?= $(BPFTOOL_OUTPUT)/bootstrap/bpftool
LIBBLAZESYM_SRC := $(abspath ../../blazesym/)
LIBBLAZESYM_OBJ := $(abspath $(OUTPUT)/libblazesym.a)
LIBBLAZESYM_HEADER := $(abspath $(OUTPUT)/blazesym.h)
Expand Down Expand Up @@ -70,7 +71,7 @@ clean:
$(call msg,CLEAN)
$(Q)rm -rf $(OUTPUT) $(APPS)

$(OUTPUT) $(OUTPUT)/libbpf $(dir $(BPFTOOL)):
$(OUTPUT) $(OUTPUT)/libbpf $(BPFTOOL_OUTPUT):
$(call msg,MKDIR,$@)
$(Q)mkdir -p $@

Expand All @@ -83,9 +84,9 @@ $(LIBBPF_OBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPU
install

# Build bpftool
$(BPFTOOL): | $(dir $(BPFTOOL))
$(BPFTOOL): | $(BPFTOOL_OUTPUT)
$(call msg,BPFTOOL,$@)
$(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(dir $(BPFTOOL)) -C $(BPFTOOL_SRC)
$(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap


$(LIBBLAZESYM_SRC)/target/release/libblazesym.a::
Expand Down

0 comments on commit fc28424

Please sign in to comment.