xref: /dpdk/examples/vhost_blk/Makefile (revision fda34680)
1c19beb3fSJin Yu# SPDX-License-Identifier: BSD-3-Clause
2c19beb3fSJin Yu# Copyright(c) 2010-2014 Intel Corporation
3c19beb3fSJin Yu
4c19beb3fSJin Yu# binary name
5c19beb3fSJin YuAPP = vhost-blk
6c19beb3fSJin Yu
7c19beb3fSJin Yu# all source are stored in SRCS-y
8c19beb3fSJin YuSRCS-y := blk.c vhost_blk.c vhost_blk_compat.c
9c19beb3fSJin Yu
10c19beb3fSJin Yu# Build using pkg-config variables if possible
11*fda34680SCiara Powerifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
12*fda34680SCiara Power$(error "no installation of DPDK found")
13*fda34680SCiara Powerendif
14c19beb3fSJin Yu
15c19beb3fSJin Yuall: shared
16c19beb3fSJin Yu.PHONY: shared static
17c19beb3fSJin Yushared: build/$(APP)-shared
18c19beb3fSJin Yu	ln -sf $(APP)-shared build/$(APP)
19c19beb3fSJin Yustatic: build/$(APP)-static
20c19beb3fSJin Yu	ln -sf $(APP)-static build/$(APP)
21c19beb3fSJin Yu
2212a652a0SBruce RichardsonPKGCONF ?= pkg-config
2312a652a0SBruce Richardson
24c19beb3fSJin YuLDFLAGS += -pthread
25c19beb3fSJin Yu
2669b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
2712a652a0SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
2812a652a0SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
298549295dSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
30c19beb3fSJin Yu
31c19beb3fSJin YuCFLAGS += -DALLOW_EXPERIMENTAL_API
32c19beb3fSJin Yu
33c19beb3fSJin Yubuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
34c19beb3fSJin Yu	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
35c19beb3fSJin Yu
36c19beb3fSJin Yubuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
37c19beb3fSJin Yu	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
38c19beb3fSJin Yu
39c19beb3fSJin Yubuild:
40c19beb3fSJin Yu	@mkdir -p $@
41c19beb3fSJin Yu
42c19beb3fSJin Yu.PHONY: clean
43c19beb3fSJin Yuclean:
44c19beb3fSJin Yu	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
45c19beb3fSJin Yu	test -d build && rmdir -p build || true
46