1*c19beb3fSJin Yu# SPDX-License-Identifier: BSD-3-Clause 2*c19beb3fSJin Yu# Copyright(c) 2010-2014 Intel Corporation 3*c19beb3fSJin Yu 4*c19beb3fSJin Yu# binary name 5*c19beb3fSJin YuAPP = vhost-blk 6*c19beb3fSJin Yu 7*c19beb3fSJin Yu# all source are stored in SRCS-y 8*c19beb3fSJin YuSRCS-y := blk.c vhost_blk.c vhost_blk_compat.c 9*c19beb3fSJin Yu 10*c19beb3fSJin Yu# Build using pkg-config variables if possible 11*c19beb3fSJin Yu$(shell pkg-config --exists libdpdk) 12*c19beb3fSJin Yuifeq ($(.SHELLSTATUS),0) 13*c19beb3fSJin Yu 14*c19beb3fSJin Yuall: shared 15*c19beb3fSJin Yu.PHONY: shared static 16*c19beb3fSJin Yushared: build/$(APP)-shared 17*c19beb3fSJin Yu ln -sf $(APP)-shared build/$(APP) 18*c19beb3fSJin Yustatic: build/$(APP)-static 19*c19beb3fSJin Yu ln -sf $(APP)-static build/$(APP) 20*c19beb3fSJin Yu 21*c19beb3fSJin YuLDFLAGS += -pthread 22*c19beb3fSJin Yu 23*c19beb3fSJin YuPC_FILE := $(shell pkg-config --path libdpdk) 24*c19beb3fSJin YuCFLAGS += -O3 $(shell pkg-config --cflags libdpdk) 25*c19beb3fSJin YuLDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) 26*c19beb3fSJin YuLDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) 27*c19beb3fSJin Yu 28*c19beb3fSJin YuCFLAGS += -DALLOW_EXPERIMENTAL_API 29*c19beb3fSJin Yu 30*c19beb3fSJin Yubuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 31*c19beb3fSJin Yu $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 32*c19beb3fSJin Yu 33*c19beb3fSJin Yubuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 34*c19beb3fSJin Yu $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 35*c19beb3fSJin Yu 36*c19beb3fSJin Yubuild: 37*c19beb3fSJin Yu @mkdir -p $@ 38*c19beb3fSJin Yu 39*c19beb3fSJin Yu.PHONY: clean 40*c19beb3fSJin Yuclean: 41*c19beb3fSJin Yu rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 42*c19beb3fSJin Yu test -d build && rmdir -p build || true 43*c19beb3fSJin Yu 44*c19beb3fSJin Yuelse # Build using legacy build system 45*c19beb3fSJin Yu 46*c19beb3fSJin Yuifeq ($(RTE_SDK),) 47*c19beb3fSJin Yu$(error "Please define RTE_SDK environment variable") 48*c19beb3fSJin Yuendif 49*c19beb3fSJin Yu 50*c19beb3fSJin Yu# Default target, detect a build directory, by looking for a path with a .config 51*c19beb3fSJin YuRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 52*c19beb3fSJin Yu 53*c19beb3fSJin Yuinclude $(RTE_SDK)/mk/rte.vars.mk 54*c19beb3fSJin Yu 55*c19beb3fSJin Yuifneq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) 56*c19beb3fSJin Yu$(info This application can only operate in a linux environment, \ 57*c19beb3fSJin Yuplease change the definition of the RTE_TARGET environment variable) 58*c19beb3fSJin Yuall: 59*c19beb3fSJin Yuelse 60*c19beb3fSJin Yu 61*c19beb3fSJin YuCFLAGS += -DALLOW_EXPERIMENTAL_API 62*c19beb3fSJin YuCFLAGS += -O2 -D_FILE_OFFSET_BITS=64 63*c19beb3fSJin YuCFLAGS += $(WERROR_FLAGS) 64*c19beb3fSJin Yu 65*c19beb3fSJin Yuinclude $(RTE_SDK)/mk/rte.extapp.mk 66*c19beb3fSJin Yu 67*c19beb3fSJin Yuendif 68*c19beb3fSJin Yuendif 69