1f5188211SFan Zhang# SPDX-License-Identifier: BSD-3-Clause 2f5188211SFan Zhang# Copyright(c) 2017-2018 Intel Corporation 3f5188211SFan Zhang 4291d0903SBruce Richardson# binary name 5291d0903SBruce RichardsonAPP = vhost-crypto 6291d0903SBruce Richardson 7291d0903SBruce Richardson# all source are stored in SRCS-y 8291d0903SBruce RichardsonSRCS-y := main.c 9291d0903SBruce RichardsonCFLAGS += -DALLOW_EXPERIMENTAL_API 10291d0903SBruce Richardson 11291d0903SBruce Richardson# Build using pkg-config variables if possible 12*fda34680SCiara Powerifneq ($(shell pkg-config --exists libdpdk && echo 0),0) 13*fda34680SCiara Power$(error "no installation of DPDK found") 14*fda34680SCiara Powerendif 15291d0903SBruce Richardson 16291d0903SBruce Richardsonall: shared 17291d0903SBruce Richardson.PHONY: shared static 18291d0903SBruce Richardsonshared: build/$(APP)-shared 19291d0903SBruce Richardson ln -sf $(APP)-shared build/$(APP) 20291d0903SBruce Richardsonstatic: build/$(APP)-static 21291d0903SBruce Richardson ln -sf $(APP)-static build/$(APP) 22291d0903SBruce Richardson 2312a652a0SBruce RichardsonPKGCONF ?= pkg-config 24291d0903SBruce Richardson 2569b1bb49SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 26291d0903SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 27291d0903SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 288549295dSBruce RichardsonLDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 29291d0903SBruce Richardson 30291d0903SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 31291d0903SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 32291d0903SBruce Richardson 33291d0903SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 34291d0903SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 35291d0903SBruce Richardson 36291d0903SBruce Richardsonbuild: 37291d0903SBruce Richardson @mkdir -p $@ 38291d0903SBruce Richardson 39291d0903SBruce Richardson.PHONY: clean 40291d0903SBruce Richardsonclean: 41291d0903SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 42291d0903SBruce Richardson test -d build && rmdir -p build || true 43