aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2016-04-28 08:20:58 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-29 14:25:32 -0400
commit7b01dd5793394ee2ef47c328b28c30f5c01107c9 (patch)
tree8ec412e7697255f51eae0cebd92600cbbbfd8dbb /samples/bpf
parent6ccfba75d3137efc3b665a337b946fd6df1162b9 (diff)
samples/bpf: Makefile verify LLVM compiler avail and bpf target is supported
Make compiling samples/bpf more user friendly, by detecting if LLVM compiler tool 'llc' is available, and also detect if the 'bpf' target is available in this version of LLVM. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf')
-rw-r--r--samples/bpf/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 5bae9536f100..45859c99f573 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -85,6 +85,24 @@ HOSTLOADLIBES_test_overhead += -lelf -lrt
85# make samples/bpf/ LLC=~/git/llvm/build/bin/llc 85# make samples/bpf/ LLC=~/git/llvm/build/bin/llc
86LLC ?= llc 86LLC ?= llc
87 87
88# Verify LLVM compiler is available and bpf target is supported
89.PHONY: verify_cmd_llc verify_target_bpf
90
91verify_cmd_llc:
92 @if ! (which "${LLC}" > /dev/null 2>&1); then \
93 echo "*** ERROR: Cannot find LLVM tool 'llc' (${LLC})" ;\
94 exit 1; \
95 else true; fi
96
97verify_target_bpf: verify_cmd_llc
98 @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \
99 echo "*** ERROR: LLVM (${LLC}) does not support 'bpf' target" ;\
100 echo " NOTICE: LLVM version >= 3.7.1 required" ;\
101 exit 2; \
102 else true; fi
103
104$(src)/*.c: verify_target_bpf
105
88# asm/sysreg.h - inline assembly used by it is incompatible with llvm. 106# asm/sysreg.h - inline assembly used by it is incompatible with llvm.
89# But, there is no easy way to fix it, so just exclude it since it is 107# But, there is no easy way to fix it, so just exclude it since it is
90# useless for BPF samples. 108# useless for BPF samples.