-
Notifications
You must be signed in to change notification settings - Fork 240
/
Makefile.libbpf
29 lines (23 loc) · 953 Bytes
/
Makefile.libbpf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
LIBBPF_TOP := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
LIBBPF_VERSION := 1.4.2
LIBBPF_BRANCH := v$(LIBBPF_VERSION)
LIBBPF_DESTDIR := $(LIBBPF_TOP)/libbpf/dest
LIBBPF_PATH := $(LIBBPF_DESTDIR)/usr/lib/libbpf.so.$(LIBBPF_VERSION)
ifneq ($(BUILD_LIBBPF),0)
LIBBPF_DEPS := $(LIBBPF_PATH)
LIBBPF_PKG_CONFIG_PATH=$(LIBBPF_DESTDIR)/usr/lib/pkgconfig
LIBBPF_CFLAGS := -I$(LIBBPF_DESTDIR)/usr/include
LIBBPF_LDFLAGS := -L$(LIBBPF_DESTDIR)/usr/lib
CGO_LDFLAGS := $(CGO_LDFLAGS) $(LIBBPF_LDFLAGS)
CGO_CFLAGS := $(LIBBPF_CFLAGS)
export LD_LIBRARY_PATH=$(LIBBPF_DESTDIR)/usr/lib
endif
.PHONY: clean-libbpf
clean-libbpf:
rm -rf $(LIBBPF_TOP)/libbpf
.PHONY: libbpf.a
libbpf.a: $(LIBBPF_PATH)
$(LIBBPF_PATH):
$(MAKE) clean-libbpf
git clone --branch v$(LIBBPF_VERSION) --depth 1 https://github.com/libbpf/libbpf.git $(LIBBPF_TOP)/libbpf
$(MAKE) -C $(LIBBPF_TOP)/libbpf/src LIBSUBDIR=lib DESTDIR=$(LIBBPF_DESTDIR) install install_uapi_headers