diff mbox series

[bpf-next,1/8] samples: bpf: Makefile: use --target from cross-compile

Message ID 20190904212212.13052-2-ivan.khoronzhuk@linaro.org
State New
Headers show
Series [bpf-next,1/8] samples: bpf: Makefile: use --target from cross-compile | expand

Commit Message

Ivan Khoronzhuk Sept. 4, 2019, 9:22 p.m. UTC
For cross compiling the target triple can be inherited from
cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile.
So copy-paste this decision from kernel Makefile.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

---
 samples/bpf/Makefile | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.17.1
diff mbox series

Patch

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 1d9be26b4edd..61b7394b811e 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -196,6 +196,8 @@  BTF_PAHOLE ?= pahole
 # Detect that we're cross compiling and use the cross compiler
 ifdef CROSS_COMPILE
 HOSTCC = $(CROSS_COMPILE)gcc
+CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%))
+else
 CLANG_ARCH_ARGS = -target $(ARCH)
 endif