blob: 4be7144e4803ddf1b8bfd6d85e85af68407c1a51 [file] [log] [blame]
Alexei Starovoitov1bc38b82018-10-05 16:40:00 -07001# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
Wang Nan1b76c132015-07-01 02:13:51 +00002# Most of this file is copied from tools/lib/traceevent/Makefile
3
Alexei Starovoitovd71fa5c2020-08-18 21:27:58 -07004RM ?= rm
5srctree = $(abs_srctree)
6
Andrii Nakryiko61c7aa52021-08-15 00:06:00 -07007VERSION_SCRIPT := libbpf.map
Andrii Nakryikodadb81d2019-08-14 13:05:48 -07008LIBBPF_VERSION := $(shell \
Andrii Nakryiko61c7aa52021-08-15 00:06:00 -07009 grep -oE '^LIBBPF_([0-9.]+)' $(VERSION_SCRIPT) | \
Andrii Nakryikodadb81d2019-08-14 13:05:48 -070010 sort -rV | head -n1 | cut -d'_' -f2)
Quentin Monnet0b46b752021-09-08 14:32:26 -070011LIBBPF_MAJOR_VERSION := $(word 1,$(subst ., ,$(LIBBPF_VERSION)))
12LIBBPF_MINOR_VERSION := $(word 2,$(subst ., ,$(LIBBPF_VERSION)))
Wang Nan1b76c132015-07-01 02:13:51 +000013
14MAKEFLAGS += --no-print-directory
15
Shuah Khan55d554f2019-09-26 19:13:44 -060016# This will work when bpf is built in tools env. where srctree
17# isn't set and when invoked from selftests build, where srctree
18# is a ".". building_out_of_srctree is undefined for in srctree
19# builds
20ifndef building_out_of_srctree
Uwe Kleine-Könige19b7ce2016-11-22 09:30:26 +010021srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Naveen N. Raod5ef3142016-01-11 13:48:00 +000022srctree := $(patsubst %/,%,$(dir $(srctree)))
23srctree := $(patsubst %/,%,$(dir $(srctree)))
24#$(info Determined 'srctree' to be $(srctree))
25endif
Wang Nan1b76c132015-07-01 02:13:51 +000026
Wang Nan1b76c132015-07-01 02:13:51 +000027INSTALL = install
28
29# Use DESTDIR for installing into a different root directory.
30# This is useful for building a package. The program will be
31# installed in this directory as if it was the root directory.
32# Then the build tool can move it later.
33DESTDIR ?=
34DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
35
Naveen N. Raod5ef3142016-01-11 13:48:00 +000036include $(srctree)/tools/scripts/Makefile.arch
37
Wang Nan1b76c132015-07-01 02:13:51 +000038ifeq ($(LP64), 1)
39 libdir_relative = lib64
40else
41 libdir_relative = lib
42endif
43
44prefix ?= /usr/local
45libdir = $(prefix)/$(libdir_relative)
46man_dir = $(prefix)/share/man
47man_dir_SQ = '$(subst ','\'',$(man_dir))'
48
49export man_dir man_dir_SQ INSTALL
50export DESTDIR DESTDIR_SQ
51
Stanislav Fomicheveeedd352019-01-15 13:13:46 -080052include $(srctree)/tools/scripts/Makefile.include
Wang Nan1b76c132015-07-01 02:13:51 +000053
54# copy a bit from Linux kbuild
55
56ifeq ("$(origin V)", "command line")
57 VERBOSE = $(V)
58endif
59ifndef VERBOSE
60 VERBOSE = 0
61endif
62
Masahiro Yamada5c816642022-02-11 14:14:11 +090063INCLUDES = -I$(or $(OUTPUT),.) \
Quentin Monnet0b46b752021-09-08 14:32:26 -070064 -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
Wang Nan1b76c132015-07-01 02:13:51 +000065
66export prefix libdir src obj
67
68# Shell quotes
69libdir_SQ = $(subst ','\'',$(libdir))
70libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
Wang Nan1b76c132015-07-01 02:13:51 +000071
Wang Nan1b76c132015-07-01 02:13:51 +000072OBJ = $@
73N =
74
Daniel Borkmann1d382262019-03-23 01:49:10 +010075LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION)
76LIB_FILE = libbpf.a libbpf.so*
Luca Boccassidd399ac2019-03-28 11:33:53 +000077PC_FILE = libbpf.pc
Wang Nan1b76c132015-07-01 02:13:51 +000078
79# Set compile option CFLAGS
80ifdef EXTRA_CFLAGS
81 CFLAGS := $(EXTRA_CFLAGS)
82else
Andrii Nakryiko0a622912020-09-29 15:06:03 -070083 CFLAGS := -g -O2
Wang Nan1b76c132015-07-01 02:13:51 +000084endif
85
Wang Nan1b76c132015-07-01 02:13:51 +000086# Append required CFLAGS
Kumar Kartikeya Dwivedi3a74ac22021-11-06 05:12:40 +053087override CFLAGS += -std=gnu89
Andrii Nakryiko8d708232020-08-18 14:33:50 -070088override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
Wang Nan1b76c132015-07-01 02:13:51 +000089override CFLAGS += -Werror -Wall
Wang Nan1b76c132015-07-01 02:13:51 +000090override CFLAGS += $(INCLUDES)
Andrey Ignatovab9e0842018-10-15 22:50:34 -070091override CFLAGS += -fvisibility=hidden
Ivan Khoronzhuk71dd77f2019-08-15 15:13:54 +030092override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Jean-Philippe Brucker4980beb2021-12-16 16:38:40 +000093override CFLAGS += $(CLANG_CROSS_FLAGS)
Wang Nan1b76c132015-07-01 02:13:51 +000094
Yonghong Song1bd63522019-09-30 14:02:03 -070095# flags specific for shared library
Andrii Nakryikob0efc212020-09-29 15:06:04 -070096SHLIB_FLAGS := -DSHARED -fPIC
Yonghong Song1bd63522019-09-30 14:02:03 -070097
Wang Nan1b76c132015-07-01 02:13:51 +000098ifeq ($(VERBOSE),1)
99 Q =
100else
101 Q = @
102endif
103
Masahiro Yamada505d3082017-03-09 16:16:33 -0800104# Disable command line variables (CFLAGS) override from top
Wang Nan1b76c132015-07-01 02:13:51 +0000105# level Makefile (perf), otherwise build Makefile will get
106# the same command line setup.
107MAKEOVERRIDES=
108
Jiri Olsa7c422f52015-09-23 12:34:02 +0200109all:
110
Wang Nan1b76c132015-07-01 02:13:51 +0000111export srctree OUTPUT CC LD CFLAGS V
Jiri Olsaab6201d2015-09-23 12:33:56 +0200112include $(srctree)/tools/build/Makefile.include
Wang Nan1b76c132015-07-01 02:13:51 +0000113
Yonghong Song1bd63522019-09-30 14:02:03 -0700114SHARED_OBJDIR := $(OUTPUT)sharedobjs/
115STATIC_OBJDIR := $(OUTPUT)staticobjs/
116BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
117BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
Namhyung Kimfa633a02019-12-23 15:13:26 +0900118BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h
Andrii Nakryiko2f383042021-09-13 15:23:09 -0700119BPF_GENERATED := $(BPF_HELPER_DEFS)
Daniel Borkmann1d382262019-03-23 01:49:10 +0100120
121LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
122LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
Luca Boccassidd399ac2019-03-28 11:33:53 +0000123PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE))
Wang Nan1b76c132015-07-01 02:13:51 +0000124
Toke Høiland-Jørgensena9eb0482019-10-04 17:34:44 +0200125TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
126
Yonghong Song1bd63522019-09-30 14:02:03 -0700127GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
Kevin Laatz10d30e32019-08-27 02:25:27 +0000128 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
Thadeu Lima de Souza Cascardoaa915932019-12-13 07:11:14 -0300129 sed 's/\[.*\]//' | \
Andrii Nakryiko056431a2022-05-18 11:59:13 -0700130 awk '/GLOBAL/ && /DEFAULT/ && !/UND|ABS/ {print $$NF}' | \
Kevin Laatz10d30e32019-08-27 02:25:27 +0000131 sort -u | wc -l)
Yauheni Kaliuta55983292020-05-25 09:18:46 +0300132VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
Jiri Olsa1fd6cee2020-11-18 22:13:50 +0100133 sed 's/\[.*\]//' | \
Yonghong Song0908a662022-02-04 13:43:55 -0800134 awk '/GLOBAL/ && /DEFAULT/ && !/UND|ABS/ {print $$NF}' | \
Andrey Ignatov306b2672018-11-23 16:44:34 -0800135 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
136
Stanislav Fomichev6bf6aff2019-12-02 13:59:31 -0800137CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
Wang Nan1b76c132015-07-01 02:13:51 +0000138
Stanislav Fomichev8e268882019-03-06 11:59:27 -0800139all: fixdep
140 $(Q)$(MAKE) all_cmd
Wang Nan1b76c132015-07-01 02:13:51 +0000141
Andrey Ignatov306b2672018-11-23 16:44:34 -0800142all_cmd: $(CMD_TARGETS) check
Wang Nan1b76c132015-07-01 02:13:51 +0000143
Quentin Monnet0b46b752021-09-08 14:32:26 -0700144$(BPF_IN_SHARED): force $(BPF_GENERATED)
Daniel Díazf15d5e62017-08-15 11:33:30 -0500145 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \
Arnaldo Carvalho de Melo971e8272016-07-11 16:38:05 -0300146 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \
Ingo Molnar8255e1e2017-07-30 11:51:30 +0200147 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true
Daniel Díazf15d5e62017-08-15 11:33:30 -0500148 @(test -f ../../include/uapi/linux/bpf_common.h -a -f ../../../include/uapi/linux/bpf_common.h && ( \
Arnaldo Carvalho de Melo971e8272016-07-11 16:38:05 -0300149 (diff -B ../../include/uapi/linux/bpf_common.h ../../../include/uapi/linux/bpf_common.h >/dev/null) || \
Ingo Molnar8255e1e2017-07-30 11:51:30 +0200150 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf_common.h' differs from latest version at 'include/uapi/linux/bpf_common.h'" >&2 )) || true
Magnus Karlsson1cad0782019-02-21 10:21:26 +0100151 @(test -f ../../include/uapi/linux/if_xdp.h -a -f ../../../include/uapi/linux/if_xdp.h && ( \
152 (diff -B ../../include/uapi/linux/if_xdp.h ../../../include/uapi/linux/if_xdp.h >/dev/null) || \
153 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true
Yonghong Song1bd63522019-09-30 14:02:03 -0700154 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(SHARED_OBJDIR) CFLAGS="$(CFLAGS) $(SHLIB_FLAGS)"
155
Quentin Monnet0b46b752021-09-08 14:32:26 -0700156$(BPF_IN_STATIC): force $(BPF_GENERATED)
Yonghong Song1bd63522019-09-30 14:02:03 -0700157 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
Wang Nan1b76c132015-07-01 02:13:51 +0000158
Namhyung Kimfa633a02019-12-23 15:13:26 +0900159$(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
Joe Stringer923a9322021-03-02 09:19:41 -0800160 $(QUIET_GEN)$(srctree)/scripts/bpf_doc.py --header \
Namhyung Kimfa633a02019-12-23 15:13:26 +0900161 --file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS)
Andrii Nakryikoe01a75c2019-10-08 10:59:40 -0700162
Daniel Borkmann1d382262019-03-23 01:49:10 +0100163$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
164
Andrii Nakryiko61c7aa52021-08-15 00:06:00 -0700165$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) $(VERSION_SCRIPT)
Jean-Philippe Brucker4980beb2021-12-16 16:38:40 +0000166 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
Ivan Khoronzhuk793a3492019-10-11 03:28:05 +0300167 --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
Andrii Nakryiko61c7aa52021-08-15 00:06:00 -0700168 -Wl,--version-script=$(VERSION_SCRIPT) $< -lelf -lz -o $@
Daniel Borkmann1d382262019-03-23 01:49:10 +0100169 @ln -sf $(@F) $(OUTPUT)libbpf.so
Andrii Nakryikodadb81d2019-08-14 13:05:48 -0700170 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
Wang Nan1b76c132015-07-01 02:13:51 +0000171
Yonghong Song1bd63522019-09-30 14:02:03 -0700172$(OUTPUT)libbpf.a: $(BPF_IN_STATIC)
Alexei Starovoitovd71fa5c2020-08-18 21:27:58 -0700173 $(QUIET_LINK)$(RM) -f $@; $(AR) rcs $@ $^
Wang Nan1b76c132015-07-01 02:13:51 +0000174
Luca Boccassidd399ac2019-03-28 11:33:53 +0000175$(OUTPUT)libbpf.pc:
176 $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
177 -e "s|@LIBDIR@|$(libdir_SQ)|" \
178 -e "s|@VERSION@|$(LIBBPF_VERSION)|" \
179 < libbpf.pc.template > $@
180
Andrii Nakryiko2f383042021-09-13 15:23:09 -0700181check: check_abi check_version
Andrey Ignatov306b2672018-11-23 16:44:34 -0800182
Andrii Nakryiko61c7aa52021-08-15 00:06:00 -0700183check_abi: $(OUTPUT)libbpf.so $(VERSION_SCRIPT)
Andrey Ignatov306b2672018-11-23 16:44:34 -0800184 @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
Yonghong Song1bd63522019-09-30 14:02:03 -0700185 echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \
Andrey Ignatov306b2672018-11-23 16:44:34 -0800186 "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
187 "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
188 "Please make sure all LIBBPF_API symbols are" \
189 "versioned in $(VERSION_SCRIPT)." >&2; \
Andrii Nakryikob5684052019-11-27 12:01:34 -0800190 readelf -s --wide $(BPF_IN_SHARED) | \
Kevin Laatz10d30e32019-08-27 02:25:27 +0000191 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
Thadeu Lima de Souza Cascardoaa915932019-12-13 07:11:14 -0300192 sed 's/\[.*\]//' | \
Aurelien Jarno3464afd2019-12-01 20:57:28 +0100193 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
Andrii Nakryiko9efc7792019-05-22 10:51:28 -0700194 sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
Yauheni Kaliuta55983292020-05-25 09:18:46 +0300195 readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
Jiri Olsa1fd6cee2020-11-18 22:13:50 +0100196 sed 's/\[.*\]//' | \
Yonghong Song0908a662022-02-04 13:43:55 -0800197 awk '/GLOBAL/ && /DEFAULT/ && !/UND|ABS/ {print $$NF}'| \
Andrii Nakryiko9efc7792019-05-22 10:51:28 -0700198 grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
199 sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
200 diff -u $(OUTPUT)libbpf_global_syms.tmp \
201 $(OUTPUT)libbpf_versioned_syms.tmp; \
202 rm $(OUTPUT)libbpf_global_syms.tmp \
203 $(OUTPUT)libbpf_versioned_syms.tmp; \
Andrey Ignatov306b2672018-11-23 16:44:34 -0800204 exit 1; \
205 fi
206
Quentin Monnet929bef42021-10-06 12:10:49 +0100207HDR_MAJ_VERSION := $(shell grep -oE '^$(pound)define LIBBPF_MAJOR_VERSION ([0-9]+)$$' libbpf_version.h | cut -d' ' -f3)
208HDR_MIN_VERSION := $(shell grep -oE '^$(pound)define LIBBPF_MINOR_VERSION ([0-9]+)$$' libbpf_version.h | cut -d' ' -f3)
Andrii Nakryiko2f383042021-09-13 15:23:09 -0700209
210check_version: $(VERSION_SCRIPT) libbpf_version.h
211 @if [ "$(HDR_MAJ_VERSION)" != "$(LIBBPF_MAJOR_VERSION)" ]; then \
212 echo "Error: libbpf major version mismatch detected: " \
213 "'$(HDR_MAJ_VERSION)' != '$(LIBBPF_MAJOR_VERSION)'" >&2; \
214 exit 1; \
215 fi
216 @if [ "$(HDR_MIN_VERSION)" != "$(LIBBPF_MINOR_VERSION)" ]; then \
217 echo "Error: libbpf minor version mismatch detected: " \
218 "'$(HDR_MIN_VERSION)' != '$(LIBBPF_MINOR_VERSION)'" >&2; \
219 exit 1; \
220 fi
221
Daniel Borkmann1d382262019-03-23 01:49:10 +0100222define do_install_mkdir
223 if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
224 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
225 fi
226endef
227
Wang Nan1b76c132015-07-01 02:13:51 +0000228define do_install
229 if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
230 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
231 fi; \
Georgi Valkove7fb6462021-03-08 10:30:38 -0800232 $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2'
Wang Nan1b76c132015-07-01 02:13:51 +0000233endef
234
235install_lib: all_cmd
Daniel Borkmann1d382262019-03-23 01:49:10 +0100236 $(call QUIET_INSTALL, $(LIB_TARGET)) \
237 $(call do_install_mkdir,$(libdir_SQ)); \
238 cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ)
Wang Nan1b76c132015-07-01 02:13:51 +0000239
Andrii Nakryikof3660062022-06-27 14:15:13 -0700240SRC_HDRS := bpf.h libbpf.h btf.h libbpf_common.h libbpf_legacy.h \
Quentin Monnetb79c2ce2021-10-07 20:44:27 +0100241 bpf_helpers.h bpf_tracing.h bpf_endian.h bpf_core_read.h \
Andrii Nakryikod72e2962022-04-04 16:41:56 -0700242 skel_internal.h libbpf_version.h usdt.bpf.h
Quentin Monnetb79c2ce2021-10-07 20:44:27 +0100243GEN_HDRS := $(BPF_GENERATED)
Andrii Nakryiko232c9e82021-06-02 17:40:24 -0700244
Quentin Monnetb79c2ce2021-10-07 20:44:27 +0100245INSTALL_PFX := $(DESTDIR)$(prefix)/include/bpf
246INSTALL_SRC_HDRS := $(addprefix $(INSTALL_PFX)/, $(SRC_HDRS))
247INSTALL_GEN_HDRS := $(addprefix $(INSTALL_PFX)/, $(notdir $(GEN_HDRS)))
248
249$(INSTALL_SRC_HDRS): $(INSTALL_PFX)/%.h: %.h
250 $(call QUIET_INSTALL, $@) \
251 $(call do_install,$<,$(prefix)/include/bpf,644)
252
253$(INSTALL_GEN_HDRS): $(INSTALL_PFX)/%.h: $(OUTPUT)%.h
254 $(call QUIET_INSTALL, $@) \
255 $(call do_install,$<,$(prefix)/include/bpf,644)
256
257install_headers: $(BPF_GENERATED) $(INSTALL_SRC_HDRS) $(INSTALL_GEN_HDRS)
Ian Rogersdaa45f32022-11-16 16:43:52 -0800258 $(call QUIET_INSTALL, libbpf_headers)
Jakub Kicinskieb54e522017-07-25 11:17:11 -0700259
Luca Boccassidd399ac2019-03-28 11:33:53 +0000260install_pkgconfig: $(PC_FILE)
261 $(call QUIET_INSTALL, $(PC_FILE)) \
262 $(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
263
Nikolay Borisov93581352020-05-26 20:46:12 +0300264install: install_lib install_pkgconfig install_headers
Wang Nan1b76c132015-07-01 02:13:51 +0000265
Andrii Nakryiko5f10c1a2021-02-03 12:34:45 -0800266clean:
Andrii Nakryiko2031af22020-01-09 21:17:14 -0800267 $(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \
Quentin Monnet0b46b752021-09-08 14:32:26 -0700268 *~ .*.d .*.cmd LIBBPF-CFLAGS $(BPF_GENERATED) \
Andrii Nakryiko2031af22020-01-09 21:17:14 -0800269 $(SHARED_OBJDIR) $(STATIC_OBJDIR) \
270 $(addprefix $(OUTPUT), \
271 *.o *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) *.pc)
Wang Nan1b76c132015-07-01 02:13:51 +0000272
Andrii Nakryiko2f383042021-09-13 15:23:09 -0700273PHONY += force cscope tags check check_abi check_version
Wang Nan1b76c132015-07-01 02:13:51 +0000274force:
275
Toke Høiland-Jørgensena9eb0482019-10-04 17:34:44 +0200276cscope:
277 ls *.c *.h > cscope.files
278 cscope -b -q -I $(srctree)/include -f cscope.out
279
280tags:
Alexei Starovoitovd71fa5c2020-08-18 21:27:58 -0700281 $(RM) -f TAGS tags
Toke Høiland-Jørgensena9eb0482019-10-04 17:34:44 +0200282 ls *.c *.h | xargs $(TAGS_PROG) -a
283
Wang Nan1b76c132015-07-01 02:13:51 +0000284# Declare the contents of the .PHONY variable as phony. We keep that
285# information in a variable so we can use it in if_changed and friends.
286.PHONY: $(PHONY)
Jakub Sitnickiab81e202019-10-20 13:23:44 +0200287
288# Delete partially updated (corrupted) files on error
289.DELETE_ON_ERROR:
Xin Liu70681942022-12-02 16:17:38 +0800290
291help:
292 @echo 'libbpf common targets:'
293 @echo ' HINT: use "V=1" to enable verbose build'
294 @echo ' all - build libraries and pkgconfig'
295 @echo ' clean - remove all generated files'
Randy Dunlap94e38c92023-07-21 23:52:36 -0700296 @echo ' check - check ABI and version info'
Xin Liu70681942022-12-02 16:17:38 +0800297 @echo ''
298 @echo 'libbpf install targets:'
299 @echo ' HINT: use "prefix"(defaults to "/usr/local") or "DESTDIR" (defaults to "/")'
Randy Dunlap94e38c92023-07-21 23:52:36 -0700300 @echo ' to adjust target destination, e.g. "make prefix=/usr/local install"'
Xin Liu70681942022-12-02 16:17:38 +0800301 @echo ' install - build and install all headers, libraries and pkgconfig'
302 @echo ' install_headers - install only headers to include/bpf'
303 @echo ''
304 @echo 'libbpf make targets:'
305 @echo ' tags - use ctags to make tag information for source code browsing'
306 @echo ' cscope - use cscope to make interactive source code browsing database'