build: use clang by default when using Makefile 72/42372/2
authorBenoît Ganne <[email protected]>
Fri, 14 Feb 2025 18:27:51 +0000 (19:27 +0100)
committerFlorin Coras <[email protected]>
Sat, 15 Feb 2025 02:20:04 +0000 (02:20 +0000)
Change https://gerrit.fd.io/r/c/vpp/+/42189 changed default compiler
from clang to GCC as a side effect when using Makefile.
Restore default behavior.

Type: fix
Fixes: b7a00271990b67458afd2e660f92ebf3ebb6f887

Change-Id: I3478fa7c5e2132486a4c3b9d8363c60ed81b0d43
Signed-off-by: Benoît Ganne <[email protected]>
Makefile

index 1f873fa..5cfc0cc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,11 @@ MACHINE=$(shell uname -m)
 SUDO?=sudo -E
 DPDK_CONFIG?=no-pci
 
+# we prefer clang by default
+ifeq ($(CC),cc)
+  CC=clang
+endif
+
 ifeq ($(strip $(SHELL)),)
 $(error "bash not found, VPP requires bash to build")
 endif
@@ -541,16 +546,10 @@ endef
 
 .PHONY: test
 test:
-ifeq ($(CC),cc)
-       $(eval CC=clang)
-endif
        $(call test,vpp,test)
 
 .PHONY: test-debug
 test-debug:
-ifeq ($(CC),cc)
-       $(eval CC=clang)
-endif
        $(call test,vpp_debug,test)
 
 .PHONY: test-cov