Revert "tty: hvc: Fix data abort due to race in hvc_open"
[linux/fpc-iii.git] / tools / bpf / runqslower / Makefile
blob8a6f82e56a249af134cdb9261720a891f1fa1f4d
1 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2 OUTPUT := .output
3 CLANG ?= clang
4 LLC ?= llc
5 LLVM_STRIP ?= llvm-strip
6 DEFAULT_BPFTOOL := $(OUTPUT)/sbin/bpftool
7 BPFTOOL ?= $(DEFAULT_BPFTOOL)
8 LIBBPF_SRC := $(abspath ../../lib/bpf)
9 BPFOBJ := $(OUTPUT)/libbpf.a
10 BPF_INCLUDE := $(OUTPUT)
11 INCLUDES := -I$(OUTPUT) -I$(BPF_INCLUDE) -I$(abspath ../../lib)
12 CFLAGS := -g -Wall
14 # Try to detect best kernel BTF source
15 KERNEL_REL := $(shell uname -r)
16 VMLINUX_BTF_PATHS := /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_REL)
17 VMLINUX_BTF_PATH := $(or $(VMLINUX_BTF),$(firstword \
18 $(wildcard $(VMLINUX_BTF_PATHS))))
20 abs_out := $(abspath $(OUTPUT))
21 ifeq ($(V),1)
22 Q =
23 msg =
24 else
25 Q = @
26 msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
27 MAKEFLAGS += --no-print-directory
28 submake_extras := feature_display=0
29 endif
31 .DELETE_ON_ERROR:
33 .PHONY: all clean runqslower
34 all: runqslower
36 runqslower: $(OUTPUT)/runqslower
38 clean:
39 $(call msg,CLEAN)
40 $(Q)rm -rf $(OUTPUT) runqslower
42 $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ)
43 $(call msg,BINARY,$@)
44 $(Q)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
46 $(OUTPUT)/runqslower.o: runqslower.h $(OUTPUT)/runqslower.skel.h \
47 $(OUTPUT)/runqslower.bpf.o
49 $(OUTPUT)/runqslower.bpf.o: $(OUTPUT)/vmlinux.h runqslower.h
51 $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(BPFTOOL)
52 $(call msg,GEN-SKEL,$@)
53 $(Q)$(BPFTOOL) gen skeleton $< > $@
55 $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT)
56 $(call msg,BPF,$@)
57 $(Q)$(CLANG) -g -O2 -target bpf $(INCLUDES) \
58 -c $(filter %.c,$^) -o $@ && \
59 $(LLVM_STRIP) -g $@
61 $(OUTPUT)/%.o: %.c | $(OUTPUT)
62 $(call msg,CC,$@)
63 $(Q)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@
65 $(OUTPUT):
66 $(call msg,MKDIR,$@)
67 $(Q)mkdir -p $(OUTPUT)
69 $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
70 $(call msg,GEN,$@)
71 $(Q)if [ ! -e "$(VMLINUX_BTF_PATH)" ] ; then \
72 echo "Couldn't find kernel BTF; set VMLINUX_BTF to" \
73 "specify its location." >&2; \
74 exit 1;\
76 $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
78 $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)
79 $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \
80 OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
82 $(DEFAULT_BPFTOOL):
83 $(Q)$(MAKE) $(submake_extras) -C ../bpftool \
84 prefix= OUTPUT=$(abs_out)/ DESTDIR=$(abs_out) install