build: fix 'make test' target to build with clang 27/40127/2
authorDave Wallace <dwallacelf@gmail.com>
Thu, 21 Dec 2023 01:02:45 +0000 (20:02 -0500)
committerDamjan Marion <dmarion@0xa5.net>
Fri, 22 Dec 2023 14:32:38 +0000 (14:32 +0000)
- gmake set CC=cc as the default therefore the test/test-debug
  makefile targets will build using gcc (cc == gcc for debian/ubuntu
  distros) unless set explicitly to clang due to use of 'CC=$(CC)' in
  test macro.

  Note: the CI builds vpp images prior to running 'make test', thus
  the CI does test vpp built using clang.  This basically makes local
  runs of 'make test' build using clang as well.

Type: make

Change-Id: I7221098c200be23b53bb616e41a42a6d65a03699
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Makefile

index ed7d5b2..70e7dd3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -448,10 +448,16 @@ 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