1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2018 Intel Corporation
7 # all source are stored in SRCS-y
22 # Build using pkg-config variables if possible
23 $(shell pkg-config --exists libdpdk)
24 ifeq ($(.SHELLSTATUS),0)
28 shared: build/$(APP)-shared
29 ln -sf $(APP)-shared build/$(APP)
30 static: build/$(APP)-static
31 ln -sf $(APP)-static build/$(APP)
33 PC_FILE := $(shell pkg-config --path libdpdk)
34 CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
35 LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
36 LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
40 OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
42 build/%.o: %.c Makefile $(PC_FILE) | build
43 $(CC) $(CFLAGS) -c $< -o $@
45 build/$(APP)-shared: $(OBJS)
46 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
48 build/$(APP)-static: $(OBJS)
49 $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
56 rm -f build/$(APP)* build/*.o
57 rmdir --ignore-fail-on-non-empty build
62 $(error "Please define RTE_SDK environment variable")
65 # Default target, can be overridden by command line or environment
66 RTE_TARGET ?= x86_64-native-linuxapp-gcc
68 include $(RTE_SDK)/mk/rte.vars.mk
70 ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp")
71 $(info This application can only operate in a linuxapp environment, \
72 please change the definition of the RTE_TARGET environment variable)
77 INC += $(sort $(wildcard *.h))
79 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y)
81 CFLAGS += -DALLOW_EXPERIMENTAL_API
84 CFLAGS += $(WERROR_FLAGS)
86 include $(RTE_SDK)/mk/rte.extapp.mk