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 124131ad5dSBruce Richardsonifeq ($(shell pkg-config --exists libdpdk && echo 0),0) 13291d0903SBruce Richardson 14291d0903SBruce Richardsonall: shared 15291d0903SBruce Richardson.PHONY: shared static 16291d0903SBruce Richardsonshared: build/$(APP)-shared 17291d0903SBruce Richardson ln -sf $(APP)-shared build/$(APP) 18291d0903SBruce Richardsonstatic: build/$(APP)-static 19291d0903SBruce Richardson ln -sf $(APP)-static build/$(APP) 20291d0903SBruce Richardson 21*12a652a0SBruce RichardsonPKGCONF ?= pkg-config 22291d0903SBruce Richardson 23291d0903SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk) 24291d0903SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 25291d0903SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 26291d0903SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) 27291d0903SBruce Richardson 28291d0903SBruce Richardsonbuild/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 29291d0903SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 30291d0903SBruce Richardson 31291d0903SBruce Richardsonbuild/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 32291d0903SBruce Richardson $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 33291d0903SBruce Richardson 34291d0903SBruce Richardsonbuild: 35291d0903SBruce Richardson @mkdir -p $@ 36291d0903SBruce Richardson 37291d0903SBruce Richardson.PHONY: clean 38291d0903SBruce Richardsonclean: 39291d0903SBruce Richardson rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 40291d0903SBruce Richardson test -d build && rmdir -p build || true 41291d0903SBruce Richardson 42291d0903SBruce Richardsonelse 43291d0903SBruce Richardson 44f5188211SFan Zhangifeq ($(RTE_SDK),) 45f5188211SFan Zhang$(error "Please define RTE_SDK environment variable") 46f5188211SFan Zhangendif 47f5188211SFan Zhang 48e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config 49e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 50f5188211SFan Zhang 51f5188211SFan Zhanginclude $(RTE_SDK)/mk/rte.vars.mk 52f5188211SFan Zhang 53742bde12SBruce Richardsonifneq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) 54218c4e68SBruce Richardson$(info This application can only operate in a linux environment, \ 55f5188211SFan Zhangplease change the definition of the RTE_TARGET environment variable) 56f5188211SFan Zhangall: 57f5188211SFan Zhangelse 58f5188211SFan Zhang 59f5188211SFan ZhangCFLAGS += -DALLOW_EXPERIMENTAL_API 60f5188211SFan ZhangCFLAGS += -O2 -D_FILE_OFFSET_BITS=64 61f5188211SFan ZhangCFLAGS += $(WERROR_FLAGS) 62f5188211SFan Zhang 63f5188211SFan Zhanginclude $(RTE_SDK)/mk/rte.extapp.mk 64f5188211SFan Zhang 65291d0903SBruce Richardsonendif # Linux 66291d0903SBruce Richardson 67291d0903SBruce Richardsonendif # pkg-config 68