Skip to content

Commit 064365f

Browse files
committed
Change libbpf install_headers DESTDIR to "build" and cleanup
The libbpf headers got installed into ../libbpf/src/root via invoking make install_headers with DESTDIR=root. This patch change the clean target to also cleanup this DESTDIR, but LIBBPF_DIR is supplied by Makefile that include common.mk, and rm command could be expanded to /root, if Makefile didn't define this, which is too high risk. Thus, change the DESTDIR name to "build" before, changing clean target. I don't think this solves the issue #72, but it helps avoid stale files in this DESTDIR. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
1 parent dbd66f1 commit 064365f

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
22

33
LESSONS = $(wildcard basic*) $(wildcard packet*) $(wildcard tracing??-*)
4+
# LESSONS += advanced03-AF_XDP
45
LESSONS_CLEAN = $(addsuffix _clean,$(LESSONS))
56

67
.PHONY: clean $(LESSONS) $(LESSONS_CLEAN)

common/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ all: common_params.o common_user_bpf_xdp.o common_libbpf.o
66
CFLAGS := -g -Wall
77

88
LIBBPF_DIR = ../libbpf/src/
9-
CFLAGS += -I$(LIBBPF_DIR)/root/usr/include/ -I../headers
9+
CFLAGS += -I$(LIBBPF_DIR)/build/usr/include/ -I../headers
1010
# TODO: Do we need to make libbpf from this make file too?
1111

1212
common_params.o: common_params.c common_params.h

common/common.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ EXTRA_DEPS +=
3838
# BPF-prog kern and userspace shares struct via header file:
3939
KERN_USER_H ?= $(wildcard common_kern_user.h)
4040

41-
CFLAGS ?= -I$(LIBBPF_DIR)/root/usr/include/ -g
41+
CFLAGS ?= -I$(LIBBPF_DIR)/build/usr/include/ -g
4242
# Extra include for Ubuntu issue #44
4343
CFLAGS += -I/usr/include/x86_64-linux-gnu
4444
CFLAGS += -I../headers/
@@ -51,6 +51,7 @@ all: llvm-check $(USER_TARGETS) $(XDP_OBJ) $(COPY_LOADER) $(COPY_STATS)
5151
.PHONY: clean $(CLANG) $(LLC)
5252

5353
clean:
54+
rm -rf $(LIBBPF_DIR)/build
5455
$(MAKE) -C $(LIBBPF_DIR) clean
5556
$(MAKE) -C $(COMMON_DIR) clean
5657
rm -f $(USER_TARGETS) $(XDP_OBJ) $(USER_OBJ) $(COPY_LOADER) $(COPY_STATS)
@@ -89,7 +90,7 @@ $(OBJECT_LIBBPF):
8990
exit 1; \
9091
else \
9192
cd $(LIBBPF_DIR) && $(MAKE) all; \
92-
mkdir -p root; DESTDIR=root $(MAKE) install_headers; \
93+
mkdir -p build; DESTDIR=build $(MAKE) install_headers; \
9394
fi
9495

9596
# Create dependency: detect if C-file change and touch H-file, to trigger

0 commit comments

Comments
 (0)