2022-06-03 19:15:11 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
# Copyright (C) 2020 Intel Corporation.
|
2020-11-02 15:32:20 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
|
|
|
|
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
|
|
|
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
|
|
|
|
|
|
|
.PHONY: all clean install uninstall
|
|
|
|
|
2022-05-12 09:40:11 +00:00
|
|
|
# Force-disable scan-build: we support it below, but meson has its own special
|
|
|
|
# target instead of allowing CC=scan-build like everyone else.
|
2020-11-02 15:32:20 +00:00
|
|
|
SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC))
|
|
|
|
|
2022-06-15 00:54:11 +00:00
|
|
|
VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=$(VFIO_USER_BUILD_SHARED) -Dlibdir=$(VFIO_USER_LIB_PREFIX)
|
2022-05-11 22:42:50 +00:00
|
|
|
|
2022-05-12 09:40:11 +00:00
|
|
|
all: scan-build
|
|
|
|
|
|
|
|
build:
|
2022-05-11 22:42:50 +00:00
|
|
|
$(Q)test -d $(VFIO_USER_BUILD_DIR) || \
|
|
|
|
CC=$(SUB_CC) meson setup $(VFIO_USER_BUILD_DIR) $(VFIO_USER_SRC_DIR)
|
2022-08-25 17:07:10 +00:00
|
|
|
# Work around pre-v1.9 versions of ninja ignoring new configuration.
|
2022-09-06 16:22:05 +00:00
|
|
|
$(Q)[ $$( (ninja --version; echo 1.9) | sort --version-sort | head -n 1) \
|
2022-08-25 17:07:10 +00:00
|
|
|
= 1.9 ] || sleep 0.5
|
2022-05-11 22:42:50 +00:00
|
|
|
$(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)
|
2020-11-02 15:32:20 +00:00
|
|
|
|
2022-05-12 09:40:11 +00:00
|
|
|
scan-build: build
|
|
|
|
$(Q)if [ $(CC) = "scan-build" ]; then \
|
|
|
|
ninja -C $(VFIO_USER_BUILD_DIR) scan-build; \
|
|
|
|
fi
|
|
|
|
|
2020-11-02 15:32:20 +00:00
|
|
|
install: all
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
@:
|
|
|
|
|
|
|
|
clean:
|
2022-05-11 22:42:50 +00:00
|
|
|
$(Q)rm -rf $(VFIO_USER_BUILD_DIR)
|