xref: /spdk/vfiouserbuild/Makefile (revision b3bec07939ebe2ea2e0c43931705d32aa9e06719)
1#  SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (C) 2020 Intel Corporation.
3#  All rights reserved.
4#
5
6SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
7include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
8
9.PHONY: all clean install uninstall
10
11# Force-disable scan-build: we support it below, but meson has its own special
12# target instead of allowing CC=scan-build like everyone else.
13SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC))
14
15VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=$(VFIO_USER_BUILD_SHARED) -Dlibdir=$(VFIO_USER_LIB_PREFIX)
16
17all: scan-build
18
19build:
20	$(Q)test -d $(VFIO_USER_BUILD_DIR) || \
21	     CC=$(SUB_CC) meson setup $(VFIO_USER_CFG_OPTS) $(VFIO_USER_BUILD_DIR) $(VFIO_USER_SRC_DIR)
22	$(Q)meson compile $(MESON_COMPILE_OPTS) -C $(VFIO_USER_BUILD_DIR)
23	DESTDIR=$(VFIO_USER_INSTALL_DIR) meson install --quiet -C $(VFIO_USER_BUILD_DIR)
24
25scan-build: build
26	$(Q)if [ $(CC) = "scan-build" ]; then \
27		ninja -C $(VFIO_USER_BUILD_DIR) scan-build; \
28	fi
29
30install: all
31
32uninstall:
33	@:
34
35clean:
36	$(Q)rm -rf $(VFIO_USER_BUILD_DIR)
37