mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 01:16:57 +07:00
995231c820
Add a completion file for bash. The completion function runs bpftool when needed, making it smart enough to help users complete ids or tags for eBPF programs and maps currently on the system. Update Makefile to install completion file to /usr/share/bash-completion/completions when running `make install`. Emacs file mode and (at the end) Vim modeline have been added, to keep the style in use for most existing bash completion files. In this, it differs from tools/perf/perf-completion.sh, which seems to be the only other completion file among the kernel sources repository. This is also valid for indent style: 4-space indents, as in other completion files. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
93 lines
2.1 KiB
Makefile
93 lines
2.1 KiB
Makefile
include ../../scripts/Makefile.include
|
|
|
|
include ../../scripts/utilities.mak
|
|
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
#$(info Determined 'srctree' to be $(srctree))
|
|
endif
|
|
|
|
ifneq ($(objtree),)
|
|
#$(info Determined 'objtree' to be $(objtree))
|
|
endif
|
|
|
|
ifneq ($(OUTPUT),)
|
|
#$(info Determined 'OUTPUT' to be $(OUTPUT))
|
|
# Adding $(OUTPUT) as a directory to look for source files,
|
|
# because use generated output files as sources dependency
|
|
# for flex/bison parsers.
|
|
VPATH += $(OUTPUT)
|
|
export VPATH
|
|
endif
|
|
|
|
ifeq ($(V),1)
|
|
Q =
|
|
else
|
|
Q = @
|
|
endif
|
|
|
|
BPF_DIR = $(srctree)/tools/lib/bpf/
|
|
|
|
ifneq ($(OUTPUT),)
|
|
BPF_PATH=$(OUTPUT)
|
|
else
|
|
BPF_PATH=$(BPF_DIR)
|
|
endif
|
|
|
|
LIBBPF = $(BPF_PATH)libbpf.a
|
|
|
|
$(LIBBPF): FORCE
|
|
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
|
|
|
|
$(LIBBPF)-clean:
|
|
$(call QUIET_CLEAN, libbpf)
|
|
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
|
|
|
|
prefix = /usr
|
|
bash_compdir ?= $(prefix)/share/bash-completion/completions
|
|
|
|
CC = gcc
|
|
|
|
CFLAGS += -O2
|
|
CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow
|
|
CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/
|
|
LIBS = -lelf -lbfd -lopcodes $(LIBBPF)
|
|
|
|
include $(wildcard *.d)
|
|
|
|
all: $(OUTPUT)bpftool
|
|
|
|
SRCS=$(wildcard *.c)
|
|
OBJS=$(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
|
|
|
|
$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
|
|
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
|
|
|
|
$(OUTPUT)bpftool: $(OBJS) $(LIBBPF)
|
|
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
|
|
|
$(OUTPUT)%.o: %.c
|
|
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
|
|
|
|
clean: $(LIBBPF)-clean
|
|
$(call QUIET_CLEAN, bpftool)
|
|
$(Q)rm -rf $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
|
|
|
|
install:
|
|
install $(OUTPUT)bpftool $(prefix)/sbin/bpftool
|
|
install -m 0755 -d $(bash_compdir)
|
|
install -m 0644 bash-completion/bpftool $(bash_compdir)
|
|
|
|
doc:
|
|
$(Q)$(MAKE) -C Documentation/
|
|
|
|
doc-install:
|
|
$(Q)$(MAKE) -C Documentation/ install
|
|
|
|
FORCE:
|
|
|
|
.PHONY: all clean FORCE
|
|
.DEFAULT_GOAL := all
|