1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2015-2020 Intel Corporation
5 ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
6 $(error "no installation of DPDK found")
8 ifneq ($(shell uname),Linux)
9 $(error This application can only operate in a linux environment)
15 LIB = librte_ethtool.so
16 LIB_STATIC = librte_ethtool.a
21 CFLAGS += -DALLOW_EXPERIMENTAL_API
23 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
24 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
25 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
26 LDFLAGS += -Wl,--no-undefined $(LDFLAGS_SHARED)
28 # check for ixgbe by grepping pre-processor output
29 ifneq ($(shell $(CC) $(CFLAGS) -dM -E - < /dev/null | grep IXGBE),)
30 LDFLAGS += -lrte_pmd_ixgbe
33 .PHONY: all clean static shared
34 all shared: build/$(LIB)
35 static: build/$(LIB_STATIC)
39 test -d build && rmdir -p build || true
44 build/%.so: $(SRCS) Makefile $(PC_FILE) | build
45 $(CC) $(CFLAGS) -o $@ -shared $(SRCS) $(LDFLAGS)
47 build/%.a: $(SRCS) Makefile $(PC_FILE) | build
48 $(CC) $(CFLAGS) -c $(SRCS) -o build/$(SRCS).o
49 $(AR) -cr $@ build/*.o