libvfio-user: support scan-build

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: If338f8e7ddbd31f4fe6a1ce2e2028c2a01b5eec3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12648
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
John Levon 2022-05-12 10:40:11 +01:00 committed by Tomasz Zawadzki
parent 686dcd88c2
commit 895300d840
2 changed files with 10 additions and 5 deletions

View File

@ -24,9 +24,6 @@ if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then
else
scanbuild_exclude="--exclude $rootdir/dpdk/"
fi
if [[ "$SPDK_TEST_VFIOUSER" -eq 1 ]]; then
scanbuild_exclude+=" --exclude $rootdir/libvfio-user/"
fi
scanbuild="scan-build -o $output_dir/scan-build-tmp $scanbuild_exclude --status-bugs"
config_params=$(get_config_params)

View File

@ -36,18 +36,26 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
.PHONY: all clean install uninstall
# Force-disable scan-build
# Force-disable scan-build: we support it below, but meson has its own special
# target instead of allowing CC=scan-build like everyone else.
SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC))
VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=static -Dlibdir=$(VFIO_USER_LIB_PREFIX)
all:
all: scan-build
build:
$(Q)test -d $(VFIO_USER_BUILD_DIR) || \
CC=$(SUB_CC) meson setup $(VFIO_USER_BUILD_DIR) $(VFIO_USER_SRC_DIR)
$(Q)meson configure $(VFIO_USER_BUILD_DIR) $(VFIO_USER_CFG_OPTS)
$(Q)meson compile $(MESON_COMPILE_OPTS) -C $(VFIO_USER_BUILD_DIR)
DESTDIR=$(VFIO_USER_INSTALL_DIR) meson install --quiet -C $(VFIO_USER_BUILD_DIR)
scan-build: build
$(Q)if [ $(CC) = "scan-build" ]; then \
ninja -C $(VFIO_USER_BUILD_DIR) scan-build; \
fi
install: all
uninstall: