1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(C) 2019 Marvell International Ltd. 3# 4 5# binary name 6APP = l2fwd-event 7 8# all source are stored in SRCS-y 9SRCS-y := main.c 10SRCS-y += l2fwd_poll.c 11SRCS-y += l2fwd_event.c 12SRCS-y += l2fwd_common.c 13SRCS-y += l2fwd_event_generic.c 14SRCS-y += l2fwd_event_internal_port.c 15 16# Build using pkg-config variables if possible 17ifeq ($(shell pkg-config --exists libdpdk && echo 0),0) 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 = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) 32 33build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build 34 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) 35 36build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build 37 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) 38 39build: 40 @mkdir -p $@ 41 42.PHONY: clean 43clean: 44 rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared 45 test -d build && rmdir -p build || true 46 47else # Build using legacy build system 48 49ifeq ($(RTE_SDK),) 50$(error "Please define RTE_SDK environment variable") 51endif 52 53# Default target, detect a build directory, by looking for a path with a .config 54RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config))))) 55 56include $(RTE_SDK)/mk/rte.vars.mk 57 58CFLAGS += -O3 59CFLAGS += $(WERROR_FLAGS) 60 61include $(RTE_SDK)/mk/rte.extapp.mk 62endif 63