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@@ -123,11 +121,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@@ -214,7 +208,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@@ -232,7 +226,7 @@ 102 103 CFLAGS += $(if $(BUILD_BPF_SKELS),,-DBPFTOOL_WITHOUT_SKELETONS) 104 105-$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c 106+$(OUTPUT)disasm.o: $(srctree)/src/kernel/bpf/disasm.c 107 $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $< -o $@ 108 109 $(BPFTOOL_BOOTSTRAP): $(BOOTSTRAP_OBJS) $(LIBBPF_BOOTSTRAP) 110@@ -251,7 +245,7 @@ 111 $(call QUIET_CLEAN, feature-detect) 112 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 113 114-clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean 115+clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean 116 $(call QUIET_CLEAN, bpftool) 117 $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d 118 $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h 119@@ -267,7 +261,7 @@ 120 121 install: install-bin 122 $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir) 123- $(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir) 124+ $(Q)$(INSTALL) -m 0644 $(srctree)/bash-completion/bpftool $(DESTDIR)$(bash_compdir) 125 126 uninstall: 127 $(call QUIET_UNINST, bpftool) 128@@ -275,16 +269,16 @@ 129 $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool 130 131 doc: 132- $(call descend,Documentation) 133+ $(call descend,$(srctree)/docs) 134 135 doc-clean: 136- $(call descend,Documentation,clean) 137+ $(call descend,$(srctree)/docs,clean) 138 139 doc-install: 140- $(call descend,Documentation,install) 141+ $(call descend,$(srctree)/docs,install) 142 143 doc-uninstall: 144- $(call descend,Documentation,uninstall) 145+ $(call descend,$(srctree)/docs,uninstall) 146 147 FORCE: 148 149