1--- docs/Makefile 2+++ docs/Makefile 3@@ -1,5 +1,5 @@ 4 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 5-include ../../../scripts/Makefile.include 6+include ../src/Makefile.include 7 8 INSTALL ?= install 9 RM ?= rm -f 10--- src/.gitignore 11+++ src/.gitignore 12@@ -1,8 +1,8 @@ 13 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 14+*.o 15 *.d 16 /bootstrap/ 17 /bpftool 18-bpftool*.8 19 FEATURE-DUMP.bpftool 20 feature 21 libbpf 22--- src/Makefile 23+++ src/Makefile 24@@ -1,10 +1,8 @@ 25 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 26-include ../../scripts/Makefile.include 27+include Makefile.include 28 29 ifeq ($(srctree),) 30 srctree := $(patsubst %/,%,$(dir $(CURDIR))) 31-srctree := $(patsubst %/,%,$(dir $(srctree))) 32-srctree := $(patsubst %/,%,$(dir $(srctree))) 33 endif 34 35 ifeq ($(V),1) 36@@ -13,7 +11,7 @@ 37 Q = @ 38 endif 39 40-BPF_DIR = $(srctree)/tools/lib/bpf 41+BPF_DIR = $(srctree)/libbpf/src 42 43 ifneq ($(OUTPUT),) 44 _OUTPUT := $(OUTPUT) 45@@ -43,16 +41,16 @@ 46 $(QUIET_MKDIR)mkdir -p $@ 47 48 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT) 49- $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \ 50- DESTDIR=$(LIBBPF_DESTDIR:/=) prefix= $(LIBBPF) install_headers 51+ $(Q)$(MAKE) -C $(BPF_DIR) OBJDIR=$(patsubst %/,%,$(LIBBPF_OUTPUT)) \ 52+ PREFIX=$(LIBBPF_DESTDIR:/=) $(LIBBPF) install_headers 53 54 $(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR) 55 $(call QUIET_INSTALL, $@) 56 $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $< 57 58 $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_BOOTSTRAP_OUTPUT) 59- $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_BOOTSTRAP_OUTPUT) \ 60- DESTDIR=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) prefix= \ 61+ $(Q)$(MAKE) -C $(BPF_DIR) OBJDIR=$(patsubst %/,%,$(LIBBPF_BOOTSTRAP_OUTPUT)) \ 62+ PREFIX=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) \ 63 ARCH= CROSS_COMPILE= CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" $@ install_headers 64 65 $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BOOTSTRAP_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_BOOTSTRAP_HDRS_DIR) 66@@ -76,9 +74,9 @@ 67 CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \ 68 -I$(or $(OUTPUT),.) \ 69 -I$(LIBBPF_INCLUDE) \ 70- -I$(srctree)/kernel/bpf/ \ 71- -I$(srctree)/tools/include \ 72- -I$(srctree)/tools/include/uapi 73+ -I$(srctree)/src/kernel/bpf/ \ 74+ -I$(srctree)/include \ 75+ -I$(srctree)/include/uapi 76 ifneq ($(BPFTOOL_VERSION),) 77 CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"' 78 endif 79@@ -119,11 +117,7 @@ 80 endif 81 82 ifeq ($(check_feat),1) 83-ifeq ($(FEATURES_DUMP),) 84-include $(srctree)/tools/build/Makefile.feature 85-else 86-include $(FEATURES_DUMP) 87-endif 88+include Makefile.feature 89 endif 90 91 LIBS = $(LIBBPF) -lelf -lz 92@@ -213,7 +207,7 @@ 93 $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h $(LIBBPF_BOOTSTRAP) 94 $(QUIET_CLANG)$(CLANG) \ 95 -I$(or $(OUTPUT),.) \ 96- -I$(srctree)/tools/include/uapi/ \ 97+ -I$(srctree)/include/uapi/ \ 98 -I$(LIBBPF_BOOTSTRAP_INCLUDE) \ 99 -g -O2 -Wall -fno-stack-protector \ 100 -target bpf -c $< -o $@ 101@@ -231,10 +225,10 @@ 102 103 CFLAGS += $(if $(BUILD_BPF_SKELS),,-DBPFTOOL_WITHOUT_SKELETONS) 104 105-$(BOOTSTRAP_OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c 106+$(BOOTSTRAP_OUTPUT)disasm.o: $(srctree)/src/kernel/bpf/disasm.c 107 $(QUIET_CC)$(HOSTCC) $(HOST_CFLAGS) -c -MMD $< -o $@ 108 109-$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c 110+$(OUTPUT)disasm.o: $(srctree)/src/kernel/bpf/disasm.c 111 $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $< -o $@ 112 113 $(BPFTOOL_BOOTSTRAP): $(BOOTSTRAP_OBJS) $(LIBBPF_BOOTSTRAP) 114@@ -253,7 +247,7 @@ 115 $(call QUIET_CLEAN, feature-detect) 116 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 117 118-clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean 119+clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean 120 $(call QUIET_CLEAN, bpftool) 121 $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d 122 $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h 123@@ -269,7 +263,7 @@ 124 125 install: install-bin 126 $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir) 127- $(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir) 128+ $(Q)$(INSTALL) -m 0644 $(srctree)/bash-completion/bpftool $(DESTDIR)$(bash_compdir) 129 130 uninstall: 131 $(call QUIET_UNINST, bpftool) 132@@ -277,16 +271,16 @@ 133 $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool 134 135 doc: 136- $(call descend,Documentation) 137+ $(call descend,$(srctree)/docs) 138 139 doc-clean: 140- $(call descend,Documentation,clean) 141+ $(call descend,$(srctree)/docs,clean) 142 143 doc-install: 144- $(call descend,Documentation,install) 145+ $(call descend,$(srctree)/docs,install) 146 147 doc-uninstall: 148- $(call descend,Documentation,uninstall) 149+ $(call descend,$(srctree)/docs,uninstall) 150 151 FORCE: 152 153