build: make clang the default compiler for build targets 73/42373/8
authorDave Wallace <[email protected]>
Sat, 15 Feb 2025 01:53:47 +0000 (20:53 -0500)
committerFlorin Coras <[email protected]>
Tue, 18 Feb 2025 22:56:47 +0000 (22:56 +0000)
- fixes compiler version for hs-test and other CI jobs which
  default to CC=cc in make
- not all build targets compile successfully with clang (e.g.
  libmemif, xdp-tools) which are hard-coded to use gcc for now

Type: fix

Change-Id: I505e67a08687f17fd4e26e1a3c236fb7c54ff49d
Signed-off-by: Dave Wallace <[email protected]>
Makefile
build-root/Makefile
build/external/packages/xdp-tools.mk

index 5cfc0cc..c3a114b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -90,7 +90,7 @@ endif
 DEB_DEPENDS  = curl build-essential autoconf automake ccache
 DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-python
 DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
-DEB_DEPENDS += gcovr lcov chrpath autoconf libnuma-dev
+DEB_DEPENDS += clang gcovr lcov chrpath autoconf libnuma-dev
 DEB_DEPENDS += python3-all python3-setuptools check
 DEB_DEPENDS += libffi-dev python3-ply libunwind-dev
 DEB_DEPENDS += cmake ninja-build python3-jsonschema python3-yaml
@@ -560,12 +560,12 @@ test-cov:
 
 .PHONY: test-cov-hs
 test-cov-hs: build-gcov
-       @$(MAKE) -C extras/hs-test test-cov \
+       @$(MAKE) CC=$(CC) -C extras/hs-test test-cov \
        VPP_BUILD_DIR=$(BR)/build-vpp_gcov-native/vpp
 
 .PHONY: test-cov-post-standalone
 test-cov-post-standalone:
-       $(MAKE) -C test cov-post VPP_BUILD_DIR=$(BR)/build-vpp_gcov-native/vpp
+       $(MAKE) CC=$(CC) -C test cov-post VPP_BUILD_DIR=$(BR)/build-vpp_gcov-native/vpp
 
 .PHONY: test-cov-both
 test-cov-both:
@@ -795,14 +795,14 @@ pkg-srpm: dist
 
 .PHONY: install-ext-deps
 install-ext-deps:
-       $(MAKE) -C build/external install-$(PKG)
+       $(MAKE) CC=$(CC) -C build/external install-$(PKG)
 
 .PHONY: install-ext-dep
 install-ext-dep: install-ext-deps
 
 .PHONY: install-opt-deps
 install-opt-deps:
-       $(MAKE) -C build/optional install-$(PKG)
+       $(MAKE) CC=$(CC) -C build/optional install-$(PKG)
 
 .PHONY: json-api-files
 json-api-files:
@@ -928,13 +928,13 @@ docs:
 .PHONY: pkg-verify
 pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps
        $(call banner,"Building for PLATFORM=vpp")
-       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
+       @$(MAKE) CC=$(CC) -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
        $(call banner,"Building sample-plugin")
-       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
+       @$(MAKE) CC=$(CC) -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
        $(call banner,"Building libmemif")
-       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp libmemif-install
+       @$(MAKE) CC=gcc -C build-root PLATFORM=vpp TAG=vpp libmemif-install
        $(call banner,"Building $(PKG) packages")
-       @$(MAKE) pkg-$(PKG)
+       @$(MAKE) CC=$(CC) pkg-$(PKG)
 
 # Note: 'make verify' target is not used by ci-management scripts
 MAKE_VERIFY_GATE_OS ?= ubuntu-22.04
@@ -944,7 +944,7 @@ ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS))
        $(call banner,"Testing vppapigen")
        @src/tools/vppapigen/test_vppapigen.py
        $(call banner,"Running tests")
-       @$(MAKE) COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
+       @$(MAKE) CC=$(CC) COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
 else
        $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
 endif
index b62a671..b529acb 100644 (file)
@@ -667,7 +667,7 @@ MAKE_PARALLEL_FLAGS ?= $(if $($(PACKAGE)_make_parallel_fails),,-j $(MAKE_PARALLE
 
 # Make command shorthand for packages & tools.
 PACKAGE_MAKE =                                 \
-  $(MAKE)                                      \
+  $(MAKE) CC=$(CC)                             \
     -C $(PACKAGE_BUILD_DIR)                    \
     $($(PACKAGE)_make_args)                    \
     $(MAKE_PARALLEL_FLAGS)
index 08d94e4..57f5e0a 100644 (file)
@@ -25,7 +25,7 @@ define  xdp-tools_config_cmds
 endef
 
 define  xdp-tools_build_cmds
-       @cd ${xdp-tools_src_dir} && $(MAKE) V=1 BUILD_STATIC_ONLY=y > $(xdp-tools_build_log)
+       @cd ${xdp-tools_src_dir} && $(MAKE) CC=gcc V=1 BUILD_STATIC_ONLY=y > $(xdp-tools_build_log)
 endef
 
 define  xdp-tools_install_cmds