1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2010-2018 Intel Corporation 3 4# binary name 5APP = ip_pipeline 6 7# all source are stored in SRCS-y 8SRCS-y := cli.c 9SRCS-y += conn.c 10SRCS-y += link.c 11SRCS-y += main.c 12SRCS-y += mempool.c 13SRCS-y += parser.c 14#SRCS-y += thread.c 15 16# Build using pkg-config variables if possible 17$(shell pkg-config --exists libdpdk) 18ifeq ($(.SHELLSTATUS),0) 19 20all: shared 21.PHONY: shared static 22shared: build/$(APP)-shared 23 ln -sf $(APP)-shared build/$(APP) 24static: build/$(APP)-static 25 ln -sf $(APP)-static build/$(APP) 26 27PC_FILE := $(shell pkg-config --path libdpdk) 28CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) 29LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) 30LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) 31 32CFLAGS += -I. 33 34OBJS := $(patsubst %.c,build/%.o,$(SRCS-y)) 35 36build/%.o: %.c Makefile $(PC_FILE) | build 37 $(CC) $(CFLAGS) -c $< -o $@ 38 39build/$(APP)-shared: $(OBJS) 40 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 41 42build/$(APP)-static: $(OBJS) 43 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 44 45build: 46 @mkdir -p $@ 47 48.PHONY: clean 49clean: 50 rm -f build/$(APP)* build/*.o 51 rmdir --ignore-fail-on-non-empty build 52 53else 54 55ifeq ($(RTE_SDK),) 56$(error "Please define RTE_SDK environment variable") 57endif 58 59# Default target, can be overridden by command line or environment 60RTE_TARGET ?= x86_64-native-linuxapp-gcc 61 62include $(RTE_SDK)/mk/rte.vars.mk 63 64INC += $(sort $(wildcard *.h)) 65 66SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y) 67 68CFLAGS += -I$(SRCDIR) 69CFLAGS += -O3 70CFLAGS += $(WERROR_FLAGS) 71 72include $(RTE_SDK)/mk/rte.extapp.mk 73 74endif 75