1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 Intel Corporation 3 4# binary name 5APP = flow_classify 6 7# all source are stored in SRCS-y 8SRCS-y := flow_classify.c 9 10# Build using pkg-config variables if possible 11ifeq ($(shell pkg-config --exists libdpdk && echo 0),0) 12 13all: shared 14.PHONY: shared static 15shared: build/$(APP)-shared 16 ln -sf $(APP)-shared build/$(APP) 17static: build/$(APP)-static 18 ln -sf $(APP)-static build/$(APP) 19 20PC_FILE := $(shell pkg-config --path libdpdk) 21CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) 22LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) 23LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) 24 25CFLAGS += -DALLOW_EXPERIMENTAL_API 26 27build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 28 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 29 30build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 31 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 32 33build: 34 @mkdir -p $@ 35 36.PHONY: clean 37clean: 38 rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 39 test -d build && rmdir -p build || true 40 41else 42 43ifeq ($(RTE_SDK),) 44$(error "Please define RTE_SDK environment variable") 45endif 46 47# Default target, can be overridden by command line or environment 48RTE_TARGET ?= x86_64-native-linuxapp-gcc 49 50include $(RTE_SDK)/mk/rte.vars.mk 51 52CFLAGS += -DALLOW_EXPERIMENTAL_API 53CFLAGS += -O3 54CFLAGS += $(WERROR_FLAGS) 55 56# workaround for a gcc bug with noreturn attribute 57# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 58ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) 59CFLAGS_main.o += -Wno-return-type 60endif 61 62include $(RTE_SDK)/mk/rte.extapp.mk 63 64endif 65