Makefile (734c7022adaa7833aa809b3f2c3fc0cf09b2a48e) Makefile (6bf6affe18dafea6ef12036001162ac7f2dbf738)
1# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2# Most of this file is copied from tools/lib/traceevent/Makefile
3
4LIBBPF_VERSION := $(shell \
5 grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
6 sort -rV | head -n1 | cut -d'_' -f2)
7LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
8

--- 138 unchanged lines hidden (view full) ---

147
148GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
149 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
150 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
151 sort -u | wc -l)
152VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
153 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
154
1# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2# Most of this file is copied from tools/lib/traceevent/Makefile
3
4LIBBPF_VERSION := $(shell \
5 grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
6 sort -rV | head -n1 | cut -d'_' -f2)
7LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
8

--- 138 unchanged lines hidden (view full) ---

147
148GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
149 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
150 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
151 sort -u | wc -l)
152VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
153 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
154
155CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) $(OUTPUT)test_libbpf
155CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
156
157all: fixdep
158 $(Q)$(MAKE) all_cmd
159
160all_cmd: $(CMD_TARGETS) check
161
162$(BPF_IN_SHARED): force elfdep bpfdep bpf_helper_defs.h
163 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \

--- 27 unchanged lines hidden (view full) ---

191 --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
192 -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@
193 @ln -sf $(@F) $(OUTPUT)libbpf.so
194 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
195
196$(OUTPUT)libbpf.a: $(BPF_IN_STATIC)
197 $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
198
156
157all: fixdep
158 $(Q)$(MAKE) all_cmd
159
160all_cmd: $(CMD_TARGETS) check
161
162$(BPF_IN_SHARED): force elfdep bpfdep bpf_helper_defs.h
163 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \

--- 27 unchanged lines hidden (view full) ---

191 --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
192 -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@
193 @ln -sf $(@F) $(OUTPUT)libbpf.so
194 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
195
196$(OUTPUT)libbpf.a: $(BPF_IN_STATIC)
197 $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
198
199$(OUTPUT)test_libbpf: test_libbpf.c $(OUTPUT)libbpf.a
200 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) $^ -lelf -o $@
201
202$(OUTPUT)libbpf.pc:
203 $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
204 -e "s|@LIBDIR@|$(libdir_SQ)|" \
205 -e "s|@VERSION@|$(LIBBPF_VERSION)|" \
206 < libbpf.pc.template > $@
207
208check: check_abi
209

--- 96 unchanged lines hidden ---
199$(OUTPUT)libbpf.pc:
200 $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
201 -e "s|@LIBDIR@|$(libdir_SQ)|" \
202 -e "s|@VERSION@|$(LIBBPF_VERSION)|" \
203 < libbpf.pc.template > $@
204
205check: check_abi
206

--- 96 unchanged lines hidden ---