xref: /spdk/vfiouserbuild/Makefile (revision 488570ebd418ba07c9e69e65106dcc964f3bb41b)
1#  SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (c) 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=static -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_BUILD_DIR) $(VFIO_USER_SRC_DIR)
22	$(Q)meson configure $(VFIO_USER_BUILD_DIR) $(VFIO_USER_CFG_OPTS)
23	$(Q)meson compile $(MESON_COMPILE_OPTS) -C $(VFIO_USER_BUILD_DIR)
24	DESTDIR=$(VFIO_USER_INSTALL_DIR) meson install --quiet -C $(VFIO_USER_BUILD_DIR)
25
26scan-build: build
27	$(Q)if [ $(CC) = "scan-build" ]; then \
28		ninja -C $(VFIO_USER_BUILD_DIR) scan-build; \
29	fi
30
31install: all
32
33uninstall:
34	@:
35
36clean:
37	$(Q)rm -rf $(VFIO_USER_BUILD_DIR)
38