11bc38b8fSAlexei Starovoitov# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 21b76c13eSWang Nan# Most of this file is copied from tools/lib/traceevent/Makefile 31b76c13eSWang Nan 4*d71fa5c9SAlexei StarovoitovRM ?= rm 5*d71fa5c9SAlexei Starovoitovsrctree = $(abs_srctree) 6*d71fa5c9SAlexei Starovoitov 7dadb81d0SAndrii NakryikoLIBBPF_VERSION := $(shell \ 8dadb81d0SAndrii Nakryiko grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \ 9dadb81d0SAndrii Nakryiko sort -rV | head -n1 | cut -d'_' -f2) 10dadb81d0SAndrii NakryikoLIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION))) 111b76c13eSWang Nan 121b76c13eSWang NanMAKEFLAGS += --no-print-directory 131b76c13eSWang Nan 1455d554f5SShuah Khan# This will work when bpf is built in tools env. where srctree 1555d554f5SShuah Khan# isn't set and when invoked from selftests build, where srctree 1655d554f5SShuah Khan# is a ".". building_out_of_srctree is undefined for in srctree 1755d554f5SShuah Khan# builds 1855d554f5SShuah Khanifndef building_out_of_srctree 19e19b7ceeSUwe Kleine-Königsrctree := $(patsubst %/,%,$(dir $(CURDIR))) 20d5ef3140SNaveen N. Raosrctree := $(patsubst %/,%,$(dir $(srctree))) 21d5ef3140SNaveen N. Raosrctree := $(patsubst %/,%,$(dir $(srctree))) 22d5ef3140SNaveen N. Rao#$(info Determined 'srctree' to be $(srctree)) 23d5ef3140SNaveen N. Raoendif 241b76c13eSWang Nan 251b76c13eSWang NanINSTALL = install 261b76c13eSWang Nan 271b76c13eSWang Nan# Use DESTDIR for installing into a different root directory. 281b76c13eSWang Nan# This is useful for building a package. The program will be 291b76c13eSWang Nan# installed in this directory as if it was the root directory. 301b76c13eSWang Nan# Then the build tool can move it later. 311b76c13eSWang NanDESTDIR ?= 321b76c13eSWang NanDESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 331b76c13eSWang Nan 34d5ef3140SNaveen N. Raoinclude $(srctree)/tools/scripts/Makefile.arch 35d5ef3140SNaveen N. Rao 361b76c13eSWang Nanifeq ($(LP64), 1) 371b76c13eSWang Nan libdir_relative = lib64 381b76c13eSWang Nanelse 391b76c13eSWang Nan libdir_relative = lib 401b76c13eSWang Nanendif 411b76c13eSWang Nan 421b76c13eSWang Nanprefix ?= /usr/local 431b76c13eSWang Nanlibdir = $(prefix)/$(libdir_relative) 441b76c13eSWang Nanman_dir = $(prefix)/share/man 451b76c13eSWang Nanman_dir_SQ = '$(subst ','\'',$(man_dir))' 461b76c13eSWang Nan 471b76c13eSWang Nanexport man_dir man_dir_SQ INSTALL 481b76c13eSWang Nanexport DESTDIR DESTDIR_SQ 491b76c13eSWang Nan 50eeedd352SStanislav Fomichevinclude $(srctree)/tools/scripts/Makefile.include 511b76c13eSWang Nan 521b76c13eSWang Nan# copy a bit from Linux kbuild 531b76c13eSWang Nan 541b76c13eSWang Nanifeq ("$(origin V)", "command line") 551b76c13eSWang Nan VERBOSE = $(V) 561b76c13eSWang Nanendif 571b76c13eSWang Nanifndef VERBOSE 581b76c13eSWang Nan VERBOSE = 0 591b76c13eSWang Nanendif 601b76c13eSWang Nan 6165f041beSArnaldo Carvalho de MeloFEATURE_USER = .libbpf 6222dd1ac9SAndrii NakryikoFEATURE_TESTS = libelf zlib bpf 63166750bcSAndrii NakryikoFEATURE_DISPLAY = libelf zlib bpf 641b76c13eSWang Nan 65438363c0SYonghong SongINCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi 661b76c13eSWang NanFEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) 671b76c13eSWang Nan 68d8ad6a15SWang Nancheck_feat := 1 69d8ad6a15SWang NanNON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help 70d8ad6a15SWang Nanifdef MAKECMDGOALS 71d8ad6a15SWang Nanifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),) 72d8ad6a15SWang Nan check_feat := 0 73d8ad6a15SWang Nanendif 74d8ad6a15SWang Nanendif 75d8ad6a15SWang Nan 76d8ad6a15SWang Nanifeq ($(check_feat),1) 7758683600SJiri Olsaifeq ($(FEATURES_DUMP),) 781b76c13eSWang Naninclude $(srctree)/tools/build/Makefile.feature 7958683600SJiri Olsaelse 8058683600SJiri Olsainclude $(FEATURES_DUMP) 8158683600SJiri Olsaendif 82d8ad6a15SWang Nanendif 831b76c13eSWang Nan 841b76c13eSWang Nanexport prefix libdir src obj 851b76c13eSWang Nan 861b76c13eSWang Nan# Shell quotes 871b76c13eSWang Nanlibdir_SQ = $(subst ','\'',$(libdir)) 881b76c13eSWang Nanlibdir_relative_SQ = $(subst ','\'',$(libdir_relative)) 891b76c13eSWang Nan 901b76c13eSWang NanOBJ = $@ 911b76c13eSWang NanN = 921b76c13eSWang Nan 931d382264SDaniel BorkmannLIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION) 941d382264SDaniel BorkmannLIB_FILE = libbpf.a libbpf.so* 95dd399ac9SLuca BoccassiPC_FILE = libbpf.pc 961d382264SDaniel Borkmann 971b76c13eSWang Nan# Set compile option CFLAGS 981b76c13eSWang Nanifdef EXTRA_CFLAGS 991b76c13eSWang Nan CFLAGS := $(EXTRA_CFLAGS) 1001b76c13eSWang Nanelse 1011b76c13eSWang Nan CFLAGS := -g -Wall 1021b76c13eSWang Nanendif 1031b76c13eSWang Nan 1041b76c13eSWang Nan# Append required CFLAGS 1058d708236SAndrii Nakryikooverride CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum 1061b76c13eSWang Nanoverride CFLAGS += -Werror -Wall 1071b76c13eSWang Nanoverride CFLAGS += -fPIC 1081b76c13eSWang Nanoverride CFLAGS += $(INCLUDES) 109ab9e0848SAndrey Ignatovoverride CFLAGS += -fvisibility=hidden 11071dd77fdSIvan Khoronzhukoverride CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 1111b76c13eSWang Nan 1121bd63524SYonghong Song# flags specific for shared library 1131bd63524SYonghong SongSHLIB_FLAGS := -DSHARED 1141bd63524SYonghong Song 1151b76c13eSWang Nanifeq ($(VERBOSE),1) 1161b76c13eSWang Nan Q = 1171b76c13eSWang Nanelse 1181b76c13eSWang Nan Q = @ 1191b76c13eSWang Nanendif 1201b76c13eSWang Nan 121505d3085SMasahiro Yamada# Disable command line variables (CFLAGS) override from top 1221b76c13eSWang Nan# level Makefile (perf), otherwise build Makefile will get 1231b76c13eSWang Nan# the same command line setup. 1241b76c13eSWang NanMAKEOVERRIDES= 1251b76c13eSWang Nan 1267c422f55SJiri Olsaall: 1277c422f55SJiri Olsa 1281b76c13eSWang Nanexport srctree OUTPUT CC LD CFLAGS V 129ab6201d0SJiri Olsainclude $(srctree)/tools/build/Makefile.include 1301b76c13eSWang Nan 1311bd63524SYonghong SongSHARED_OBJDIR := $(OUTPUT)sharedobjs/ 1321bd63524SYonghong SongSTATIC_OBJDIR := $(OUTPUT)staticobjs/ 1331bd63524SYonghong SongBPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o 1341bd63524SYonghong SongBPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o 13516192a77SAndrey IgnatovVERSION_SCRIPT := libbpf.map 136fa633a0fSNamhyung KimBPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h 1371b76c13eSWang Nan 1381d382264SDaniel BorkmannLIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) 1391d382264SDaniel BorkmannLIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE)) 140dd399ac9SLuca BoccassiPC_FILE := $(addprefix $(OUTPUT),$(PC_FILE)) 1411d382264SDaniel Borkmann 142a9eb048dSToke Høiland-JørgensenTAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags) 143a9eb048dSToke Høiland-Jørgensen 1441bd63524SYonghong SongGLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ 14510d30e30SKevin Laatz cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ 146aa915931SThadeu Lima de Souza Cascardo sed 's/\[.*\]//' | \ 1473464afdfSAurelien Jarno awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ 14810d30e30SKevin Laatz sort -u | wc -l) 14955983299SYauheni KaliutaVERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ 150306b267cSAndrey Ignatov grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) 151306b267cSAndrey Ignatov 1526bf6affeSStanislav FomichevCMD_TARGETS = $(LIB_TARGET) $(PC_FILE) 1531b76c13eSWang Nan 1548e268887SStanislav Fomichevall: fixdep 1558e268887SStanislav Fomichev $(Q)$(MAKE) all_cmd 1561b76c13eSWang Nan 157306b267cSAndrey Ignatovall_cmd: $(CMD_TARGETS) check 1581b76c13eSWang Nan 15931d518f3SDavid S. Miller$(BPF_IN_SHARED): force elfdep zdep bpfdep $(BPF_HELPER_DEFS) 160f15d5e6dSDaniel Díaz @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \ 161971e827bSArnaldo Carvalho de Melo (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \ 1628255e1efSIngo Molnar echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true 163f15d5e6dSDaniel Díaz @(test -f ../../include/uapi/linux/bpf_common.h -a -f ../../../include/uapi/linux/bpf_common.h && ( \ 164971e827bSArnaldo Carvalho de Melo (diff -B ../../include/uapi/linux/bpf_common.h ../../../include/uapi/linux/bpf_common.h >/dev/null) || \ 1658255e1efSIngo Molnar 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 166dc2b9f19SEric Leblond @(test -f ../../include/uapi/linux/netlink.h -a -f ../../../include/uapi/linux/netlink.h && ( \ 167dc2b9f19SEric Leblond (diff -B ../../include/uapi/linux/netlink.h ../../../include/uapi/linux/netlink.h >/dev/null) || \ 168dc2b9f19SEric Leblond echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/netlink.h' differs from latest version at 'include/uapi/linux/netlink.h'" >&2 )) || true 169dc2b9f19SEric Leblond @(test -f ../../include/uapi/linux/if_link.h -a -f ../../../include/uapi/linux/if_link.h && ( \ 170dc2b9f19SEric Leblond (diff -B ../../include/uapi/linux/if_link.h ../../../include/uapi/linux/if_link.h >/dev/null) || \ 171dc2b9f19SEric Leblond echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'" >&2 )) || true 1721cad0788SMagnus Karlsson @(test -f ../../include/uapi/linux/if_xdp.h -a -f ../../../include/uapi/linux/if_xdp.h && ( \ 1731cad0788SMagnus Karlsson (diff -B ../../include/uapi/linux/if_xdp.h ../../../include/uapi/linux/if_xdp.h >/dev/null) || \ 1741cad0788SMagnus Karlsson 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 1751bd63524SYonghong Song $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(SHARED_OBJDIR) CFLAGS="$(CFLAGS) $(SHLIB_FLAGS)" 1761bd63524SYonghong Song 17731d518f3SDavid S. Miller$(BPF_IN_STATIC): force elfdep zdep bpfdep $(BPF_HELPER_DEFS) 1781bd63524SYonghong Song $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR) 1791b76c13eSWang Nan 180fa633a0fSNamhyung Kim$(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h 181292e1d73SAndrii Nakryiko $(QUIET_GEN)$(srctree)/scripts/bpf_helpers_doc.py --header \ 182fa633a0fSNamhyung Kim --file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS) 183e01a75c1SAndrii Nakryiko 1841d382264SDaniel Borkmann$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) 1851d382264SDaniel Borkmann 1861bd63524SYonghong Song$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) 187793a349cSIvan Khoronzhuk $(QUIET_LINK)$(CC) $(LDFLAGS) \ 188793a349cSIvan Khoronzhuk --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ 189166750bcSAndrii Nakryiko -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -lz -o $@ 1901d382264SDaniel Borkmann @ln -sf $(@F) $(OUTPUT)libbpf.so 191dadb81d0SAndrii Nakryiko @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) 1921b76c13eSWang Nan 1931bd63524SYonghong Song$(OUTPUT)libbpf.a: $(BPF_IN_STATIC) 194*d71fa5c9SAlexei Starovoitov $(QUIET_LINK)$(RM) -f $@; $(AR) rcs $@ $^ 1951b76c13eSWang Nan 196dd399ac9SLuca Boccassi$(OUTPUT)libbpf.pc: 197dd399ac9SLuca Boccassi $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ 198dd399ac9SLuca Boccassi -e "s|@LIBDIR@|$(libdir_SQ)|" \ 199dd399ac9SLuca Boccassi -e "s|@VERSION@|$(LIBBPF_VERSION)|" \ 200dd399ac9SLuca Boccassi < libbpf.pc.template > $@ 201dd399ac9SLuca Boccassi 202306b267cSAndrey Ignatovcheck: check_abi 203306b267cSAndrey Ignatov 204306b267cSAndrey Ignatovcheck_abi: $(OUTPUT)libbpf.so 205306b267cSAndrey Ignatov @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \ 2061bd63524SYonghong Song echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \ 207306b267cSAndrey Ignatov "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \ 208306b267cSAndrey Ignatov "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \ 209306b267cSAndrey Ignatov "Please make sure all LIBBPF_API symbols are" \ 210306b267cSAndrey Ignatov "versioned in $(VERSION_SCRIPT)." >&2; \ 211b5684058SAndrii Nakryiko readelf -s --wide $(BPF_IN_SHARED) | \ 21210d30e30SKevin Laatz cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ 213aa915931SThadeu Lima de Souza Cascardo sed 's/\[.*\]//' | \ 2143464afdfSAurelien Jarno awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ 2159efc7794SAndrii Nakryiko sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ 21655983299SYauheni Kaliuta readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ 2179efc7794SAndrii Nakryiko grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ 2189efc7794SAndrii Nakryiko sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \ 2199efc7794SAndrii Nakryiko diff -u $(OUTPUT)libbpf_global_syms.tmp \ 2209efc7794SAndrii Nakryiko $(OUTPUT)libbpf_versioned_syms.tmp; \ 2219efc7794SAndrii Nakryiko rm $(OUTPUT)libbpf_global_syms.tmp \ 2229efc7794SAndrii Nakryiko $(OUTPUT)libbpf_versioned_syms.tmp; \ 223306b267cSAndrey Ignatov exit 1; \ 224306b267cSAndrey Ignatov fi 225306b267cSAndrey Ignatov 2261d382264SDaniel Borkmanndefine do_install_mkdir 2271d382264SDaniel Borkmann if [ ! -d '$(DESTDIR_SQ)$1' ]; then \ 2281d382264SDaniel Borkmann $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \ 2291d382264SDaniel Borkmann fi 2301d382264SDaniel Borkmannendef 2311d382264SDaniel Borkmann 2321b76c13eSWang Nandefine do_install 2331b76c13eSWang Nan if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ 2341b76c13eSWang Nan $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ 2351b76c13eSWang Nan fi; \ 2367110d80dSJesper Dangaard Brouer $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' 2371b76c13eSWang Nanendef 2381b76c13eSWang Nan 2391b76c13eSWang Naninstall_lib: all_cmd 2401d382264SDaniel Borkmann $(call QUIET_INSTALL, $(LIB_TARGET)) \ 2411d382264SDaniel Borkmann $(call do_install_mkdir,$(libdir_SQ)); \ 2421d382264SDaniel Borkmann cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ) 2431b76c13eSWang Nan 244fa633a0fSNamhyung Kiminstall_headers: $(BPF_HELPER_DEFS) 245eb54e522SJakub Kicinski $(call QUIET_INSTALL, headers) \ 2467d386c62SJesper Dangaard Brouer $(call do_install,bpf.h,$(prefix)/include/bpf,644); \ 2478543e437SDaniel Borkmann $(call do_install,libbpf.h,$(prefix)/include/bpf,644); \ 2488543e437SDaniel Borkmann $(call do_install,btf.h,$(prefix)/include/bpf,644); \ 2497080da89SWilliam Tu $(call do_install,libbpf_util.h,$(prefix)/include/bpf,644); \ 250fb9a98e1SToke Høiland-Jørgensen $(call do_install,libbpf_common.h,$(prefix)/include/bpf,644); \ 251e01a75c1SAndrii Nakryiko $(call do_install,xsk.h,$(prefix)/include/bpf,644); \ 252e01a75c1SAndrii Nakryiko $(call do_install,bpf_helpers.h,$(prefix)/include/bpf,644); \ 253fa633a0fSNamhyung Kim $(call do_install,$(BPF_HELPER_DEFS),$(prefix)/include/bpf,644); \ 254e01a75c1SAndrii Nakryiko $(call do_install,bpf_tracing.h,$(prefix)/include/bpf,644); \ 2557db3822aSAndrii Nakryiko $(call do_install,bpf_endian.h,$(prefix)/include/bpf,644); \ 2567db3822aSAndrii Nakryiko $(call do_install,bpf_core_read.h,$(prefix)/include/bpf,644); 257eb54e522SJakub Kicinski 258dd399ac9SLuca Boccassiinstall_pkgconfig: $(PC_FILE) 259dd399ac9SLuca Boccassi $(call QUIET_INSTALL, $(PC_FILE)) \ 260dd399ac9SLuca Boccassi $(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644) 261dd399ac9SLuca Boccassi 26293581359SNikolay Borisovinstall: install_lib install_pkgconfig install_headers 2631b76c13eSWang Nan 2641b76c13eSWang Nan### Cleaning rules 2651b76c13eSWang Nan 2661b76c13eSWang Nanconfig-clean: 2671b76c13eSWang Nan $(call QUIET_CLEAN, config) 2681b76c13eSWang Nan $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 2691b76c13eSWang Nan 2701b76c13eSWang Nanclean: 2712f184393SDavid S. Miller $(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \ 2722031af28SAndrii Nakryiko *~ .*.d .*.cmd LIBBPF-CFLAGS $(BPF_HELPER_DEFS) \ 2732031af28SAndrii Nakryiko $(SHARED_OBJDIR) $(STATIC_OBJDIR) \ 2742031af28SAndrii Nakryiko $(addprefix $(OUTPUT), \ 2752031af28SAndrii Nakryiko *.o *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) *.pc) 2760c77c04aSYunlong Song $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf 2771b76c13eSWang Nan 2781b76c13eSWang Nan 2791b76c13eSWang Nan 280166750bcSAndrii NakryikoPHONY += force elfdep zdep bpfdep cscope tags 2811b76c13eSWang Nanforce: 2821b76c13eSWang Nan 2831b76c13eSWang Nanelfdep: 28421567edeSJakub Kicinski @if [ "$(feature-libelf)" != "1" ]; then echo "No libelf found"; exit 1 ; fi 2851b76c13eSWang Nan 286166750bcSAndrii Nakryikozdep: 287166750bcSAndrii Nakryiko @if [ "$(feature-zlib)" != "1" ]; then echo "No zlib found"; exit 1 ; fi 288166750bcSAndrii Nakryiko 2891b76c13eSWang Nanbpfdep: 29021567edeSJakub Kicinski @if [ "$(feature-bpf)" != "1" ]; then echo "BPF API too old"; exit 1 ; fi 2911b76c13eSWang Nan 292a9eb048dSToke Høiland-Jørgensencscope: 293a9eb048dSToke Høiland-Jørgensen ls *.c *.h > cscope.files 294a9eb048dSToke Høiland-Jørgensen cscope -b -q -I $(srctree)/include -f cscope.out 295a9eb048dSToke Høiland-Jørgensen 296a9eb048dSToke Høiland-Jørgensentags: 297*d71fa5c9SAlexei Starovoitov $(RM) -f TAGS tags 298a9eb048dSToke Høiland-Jørgensen ls *.c *.h | xargs $(TAGS_PROG) -a 299a9eb048dSToke Høiland-Jørgensen 3001b76c13eSWang Nan# Declare the contents of the .PHONY variable as phony. We keep that 3011b76c13eSWang Nan# information in a variable so we can use it in if_changed and friends. 3021b76c13eSWang Nan.PHONY: $(PHONY) 303ab81e203SJakub Sitnicki 304ab81e203SJakub Sitnicki# Delete partially updated (corrupted) files on error 305ab81e203SJakub Sitnicki.DELETE_ON_ERROR: 306