1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2020 Intel Corporation 3 4# binary name 5APP = pipeline 6 7# all source are stored in SRCS-y 8SRCS-y += cli.c 9SRCS-y += conn.c 10SRCS-y += main.c 11SRCS-y += obj.c 12SRCS-y += thread.c 13 14# Build using pkg-config variables if possible 15ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) 16$(error "no installation of DPDK found") 17endif 18 19all: shared 20.PHONY: shared static 21shared: build/$(APP)-shared 22 ln -sf $(APP)-shared build/$(APP) 23static: build/$(APP)-static 24 ln -sf $(APP)-static build/$(APP) 25 26PKGCONF ?= pkg-config 27 28PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) 29CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) 30LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) 31LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) 32 33CFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE 34 35OBJS := $(patsubst %.c,build/%.o,$(SRCS-y)) 36 37build/%.o: %.c Makefile $(PC_FILE) | build 38 $(CC) $(CFLAGS) -c $< -o $@ 39 40build/$(APP)-shared: $(OBJS) 41 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 42 43build/$(APP)-static: $(OBJS) 44 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 45 46build: 47 @mkdir -p $@ 48 49.PHONY: clean 50clean: 51 rm -f build/$(APP)* build/*.o 52 test -d build && rmdir -p build || true 53