1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(C) 2019 Marvell International Ltd.
8 # all source are stored in SRCS-y
10 SRCS-y += l2fwd_poll.c
11 SRCS-y += l2fwd_event.c
12 SRCS-y += l2fwd_common.c
13 SRCS-y += l2fwd_event_generic.c
14 SRCS-y += l2fwd_event_internal_port.c
18 # Build using pkg-config variables if possible
19 ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
20 $(error "no installation of DPDK found")
25 shared: build/$(APP)-shared
26 ln -sf $(APP)-shared build/$(APP)
27 static: build/$(APP)-static
28 ln -sf $(APP)-static build/$(APP)
30 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
31 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
32 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
33 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
35 ifeq ($(MAKECMDGOALS),static)
36 # check for broken pkg-config
37 ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
38 $(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
39 $(error "Cannot generate statically-linked binaries with this version of pkg-config")
43 CFLAGS += -DALLOW_EXPERIMENTAL_API
45 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
46 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
48 build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
49 $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
56 rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
57 test -d build && rmdir -p build || true