diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2016-04-28 08:20:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-29 14:25:32 -0400 |
commit | 7b01dd5793394ee2ef47c328b28c30f5c01107c9 (patch) | |
tree | 8ec412e7697255f51eae0cebd92600cbbbfd8dbb /samples/bpf | |
parent | 6ccfba75d3137efc3b665a337b946fd6df1162b9 (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/Makefile | 18 |
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 |
86 | LLC ?= llc | 86 | LLC ?= llc |
87 | 87 | ||
88 | # Verify LLVM compiler is available and bpf target is supported | ||
89 | .PHONY: verify_cmd_llc verify_target_bpf | ||
90 | |||
91 | verify_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 | |||
97 | verify_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. |