selftests/bpf: Quote host tools
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 10 Feb 2023 00:11:55 +0000 (01:11 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 10 Feb 2023 23:21:26 +0000 (15:21 -0800)
Using HOSTCC="ccache clang" breaks building the tests, since, when it's
forwarded to e.g. bpftool, the child make sees HOSTCC=ccache and
"clang" is considered a target. Fix by quoting it, and also HOSTLD and
HOSTAR for consistency.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230210001210.395194-2-iii@linux.ibm.com
tools/testing/selftests/bpf/Makefile

index b2eb3201b85a187a3d19d4db1169f60bb95d9725..49bc1ba12d3a061d99b19640c0310ed25ddbaffc 100644 (file)
@@ -248,7 +248,7 @@ BPFTOOL ?= $(DEFAULT_BPFTOOL)
 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
                    $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
        $(Q)$(MAKE) $(submake_extras)  -C $(BPFTOOLDIR)                        \
-                   ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD)             \
+                   ARCH= CROSS_COMPILE= CC="$(HOSTCC)" LD="$(HOSTLD)"         \
                    EXTRA_CFLAGS='-g -O0'                                      \
                    OUTPUT=$(HOST_BUILD_DIR)/bpftool/                          \
                    LIBBPF_OUTPUT=$(HOST_BUILD_DIR)/libbpf/                    \
@@ -280,7 +280,8 @@ $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)                    \
                | $(HOST_BUILD_DIR)/libbpf
        $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR)                             \
                    EXTRA_CFLAGS='-g -O0' ARCH= CROSS_COMPILE=                 \
-                   OUTPUT=$(HOST_BUILD_DIR)/libbpf/ CC=$(HOSTCC) LD=$(HOSTLD) \
+                   OUTPUT=$(HOST_BUILD_DIR)/libbpf/                           \
+                   CC="$(HOSTCC)" LD="$(HOSTLD)"                              \
                    DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
 endif
 
@@ -301,7 +302,7 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids        \
                       $(TOOLSDIR)/lib/ctype.c                  \
                       $(TOOLSDIR)/lib/str_error_r.c
        $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/resolve_btfids \
-               CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) \
+               CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" \
                LIBBPF_INCLUDE=$(HOST_INCLUDE_DIR) \
                OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)