1 include ..
/..
/scripts
/Makefile.
include
2 include ..
/..
/scripts
/utilities.mak
5 srctree
:= $(patsubst %/,%,$(dir $(CURDIR
)))
6 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
7 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
16 BPF_DIR
= $(srctree
)/tools
/lib
/bpf
/
24 LIBBPF
= $(BPF_PATH
)libbpf.a
26 BPFTOOL_VERSION
=$(shell make
--no-print-directory
-sC ..
/..
/.. kernelversion
)
29 $(Q
)$(MAKE
) -C
$(BPF_DIR
) OUTPUT
=$(OUTPUT
) $(OUTPUT
)libbpf.a FEATURES_DUMP
=$(FEATURE_DUMP_EXPORT
)
32 $(call QUIET_CLEAN
, libbpf
)
33 $(Q
)$(MAKE
) -C
$(BPF_DIR
) OUTPUT
=$(OUTPUT
) clean >/dev
/null
36 bash_compdir ?
= /usr
/share
/bash-completion
/completions
41 CFLAGS
+= -W
-Wall
-Wextra
-Wno-unused-parameter
-Wshadow
42 CFLAGS
+= -DPACKAGE
='"bpftool"' -D__EXPORTED_HEADERS__
-I
$(srctree
)/tools
/include/uapi
-I
$(srctree
)/tools
/include -I
$(srctree
)/tools
/lib
/bpf
-I
$(srctree
)/kernel
/bpf
/
43 CFLAGS
+= -DBPFTOOL_VERSION
='"$(BPFTOOL_VERSION)"'
44 LIBS
= -lelf
-lbfd
-lopcodes
$(LIBBPF
)
49 FEATURE_USER
= .bpftool
50 FEATURE_TESTS
= libbfd disassembler-four-args
51 FEATURE_DISPLAY
= libbfd disassembler-four-args
54 NON_CHECK_FEAT_TARGETS
:= clean uninstall doc doc-clean doc-install doc-uninstall
56 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS
),$(MAKECMDGOALS
)),)
61 ifeq ($(check_feat
),1)
62 ifeq ($(FEATURES_DUMP
),)
63 include $(srctree
)/tools
/build
/Makefile.feature
65 include $(FEATURES_DUMP
)
69 ifeq ($(feature-disassembler-four-args
), 1)
70 CFLAGS
+= -DDISASM_FOUR_ARGS_SIGNATURE
73 include $(wildcard *.d
)
77 SRCS
= $(wildcard *.c
)
78 OBJS
= $(patsubst %.c
,$(OUTPUT
)%.o
,$(SRCS
)) $(OUTPUT
)disasm.o
80 $(OUTPUT
)disasm.o
: $(srctree
)/kernel
/bpf
/disasm.c
81 $(QUIET_CC
)$(COMPILE.c
) -MMD
-o
$@
$<
83 $(OUTPUT
)bpftool
: $(OBJS
) $(LIBBPF
)
84 $(QUIET_LINK
)$(CC
) $(CFLAGS
) -o
$@
$^
$(LIBS
)
87 $(QUIET_CC
)$(COMPILE.c
) -MMD
-o
$@
$<
89 clean: $(LIBBPF
)-clean
90 $(call QUIET_CLEAN
, bpftool
)
91 $(Q
)$(RM
) $(OUTPUT
)bpftool
$(OUTPUT
)*.o
$(OUTPUT
)*.d
93 install: $(OUTPUT
)bpftool
94 $(call QUIET_INSTALL
, bpftool
)
95 $(Q
)$(INSTALL
) -m
0755 -d
$(DESTDIR
)$(prefix)/sbin
96 $(Q
)$(INSTALL
) $(OUTPUT
)bpftool
$(DESTDIR
)$(prefix)/sbin
/bpftool
97 $(Q
)$(INSTALL
) -m
0755 -d
$(DESTDIR
)$(bash_compdir
)
98 $(Q
)$(INSTALL
) -m
0644 bash-completion
/bpftool
$(DESTDIR
)$(bash_compdir
)
101 $(call QUIET_UNINST
, bpftool
)
102 $(Q
)$(RM
) $(DESTDIR
)$(prefix)/sbin
/bpftool
103 $(Q
)$(RM
) $(DESTDIR
)$(bash_compdir
)/bpftool
106 $(call descend
,Documentation
)
109 $(call descend
,Documentation
,clean)
112 $(call descend
,Documentation
,install)
115 $(call descend
,Documentation
,uninstall)
119 .PHONY
: all FORCE
clean install uninstall
120 .PHONY
: doc doc-clean doc-install doc-uninstall