--- docs/Makefile +++ docs/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -include ../../../scripts/Makefile.include +include ../src/Makefile.include INSTALL ?= install RM ?= rm -f --- src/.gitignore +++ src/.gitignore @@ -1,8 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +*.o *.d /bootstrap/ /bpftool -bpftool*.8 FEATURE-DUMP.bpftool feature libbpf --- src/Makefile +++ src/Makefile @@ -1,10 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -include ../../scripts/Makefile.include +include Makefile.include ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR))) -srctree := $(patsubst %/,%,$(dir $(srctree))) -srctree := $(patsubst %/,%,$(dir $(srctree))) endif ifeq ($(V),1) @@ -13,7 +11,7 @@ Q = @ endif -BPF_DIR = $(srctree)/tools/lib/bpf +BPF_DIR = $(srctree)/libbpf/src ifneq ($(OUTPUT),) _OUTPUT := $(OUTPUT) @@ -43,16 +41,16 @@ $(QUIET_MKDIR)mkdir -p $@ $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT) - $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \ - DESTDIR=$(LIBBPF_DESTDIR:/=) prefix= $(LIBBPF) install_headers + $(Q)$(MAKE) -C $(BPF_DIR) OBJDIR=$(patsubst %/,%,$(LIBBPF_OUTPUT)) \ + PREFIX=$(LIBBPF_DESTDIR:/=) $(LIBBPF) install_headers $(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR) $(call QUIET_INSTALL, $@) $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $< $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_BOOTSTRAP_OUTPUT) - $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_BOOTSTRAP_OUTPUT) \ - DESTDIR=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) prefix= \ + $(Q)$(MAKE) -C $(BPF_DIR) OBJDIR=$(patsubst %/,%,$(LIBBPF_BOOTSTRAP_OUTPUT)) \ + PREFIX=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) \ ARCH= CROSS_COMPILE= CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" $@ install_headers $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BOOTSTRAP_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_BOOTSTRAP_HDRS_DIR) @@ -76,9 +74,9 @@ CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \ -I$(or $(OUTPUT),.) \ -I$(LIBBPF_INCLUDE) \ - -I$(srctree)/kernel/bpf/ \ - -I$(srctree)/tools/include \ - -I$(srctree)/tools/include/uapi + -I$(srctree)/src/kernel/bpf/ \ + -I$(srctree)/include \ + -I$(srctree)/include/uapi ifneq ($(BPFTOOL_VERSION),) CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"' endif @@ -123,11 +121,7 @@ endif ifeq ($(check_feat),1) -ifeq ($(FEATURES_DUMP),) -include $(srctree)/tools/build/Makefile.feature -else -include $(FEATURES_DUMP) -endif +include Makefile.feature endif LIBS = $(LIBBPF) -lelf -lz @@ -214,7 +208,7 @@ $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h $(LIBBPF_BOOTSTRAP) $(QUIET_CLANG)$(CLANG) \ -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include/uapi/ \ + -I$(srctree)/include/uapi/ \ -I$(LIBBPF_BOOTSTRAP_INCLUDE) \ -g -O2 -Wall -fno-stack-protector \ --target=bpf -c $< -o $@ @@ -232,7 +226,7 @@ CFLAGS += $(if $(BUILD_BPF_SKELS),,-DBPFTOOL_WITHOUT_SKELETONS) -$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c +$(OUTPUT)disasm.o: $(srctree)/src/kernel/bpf/disasm.c $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $< -o $@ $(BPFTOOL_BOOTSTRAP): $(BOOTSTRAP_OBJS) $(LIBBPF_BOOTSTRAP) @@ -251,7 +245,7 @@ $(call QUIET_CLEAN, feature-detect) $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null -clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean +clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean $(call QUIET_CLEAN, bpftool) $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h @@ -267,7 +261,7 @@ install: install-bin $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir) - $(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir) + $(Q)$(INSTALL) -m 0644 $(srctree)/bash-completion/bpftool $(DESTDIR)$(bash_compdir) uninstall: $(call QUIET_UNINST, bpftool) @@ -275,16 +269,16 @@ $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool doc: - $(call descend,Documentation) + $(call descend,$(srctree)/docs) doc-clean: - $(call descend,Documentation,clean) + $(call descend,$(srctree)/docs,clean) doc-install: - $(call descend,Documentation,install) + $(call descend,$(srctree)/docs,install) doc-uninstall: - $(call descend,Documentation,uninstall) + $(call descend,$(srctree)/docs,uninstall) FORCE: