xref: /dpdk/examples/ip_pipeline/Makefile (revision 5ae1edff)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2010-2014 Intel Corporation
3
4# binary name
5APP = ip_pipeline
6
7# all source are stored in SRCS-y
8SRCS-y := main.c
9SRCS-y += config_parse.c
10SRCS-y += parser.c
11SRCS-y += config_parse_tm.c
12SRCS-y += config_check.c
13SRCS-y += init.c
14SRCS-y += thread.c
15SRCS-y += thread_fe.c
16SRCS-y += cpu_core_map.c
17
18SRCS-y += pipeline_common_be.c
19SRCS-y += pipeline_common_fe.c
20SRCS-y += pipeline_master_be.c
21SRCS-y += pipeline_master.c
22SRCS-y += pipeline_passthrough_be.c
23SRCS-y += pipeline_passthrough.c
24SRCS-y += pipeline_firewall_be.c
25SRCS-y += pipeline_firewall.c
26SRCS-y += pipeline_flow_classification_be.c
27SRCS-y += pipeline_flow_classification.c
28SRCS-y += pipeline_flow_actions_be.c
29SRCS-y += pipeline_flow_actions.c
30SRCS-y += pipeline_routing_be.c
31SRCS-y += pipeline_routing.c
32
33# Build using pkg-config variables if possible
34$(shell pkg-config --exists libdpdk)
35ifeq ($(.SHELLSTATUS),0)
36
37all: shared
38.PHONY: shared static
39shared: build/$(APP)-shared
40	ln -sf $(APP)-shared build/$(APP)
41static: build/$(APP)-static
42	ln -sf $(APP)-static build/$(APP)
43
44PC_FILE := $(shell pkg-config --path libdpdk)
45CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
46LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
47LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
48
49VPATH += pipeline
50CFLAGS += -I. -I./pipeline/
51CFLAGS += -DALLOW_EXPERIMENTAL_API
52
53OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
54
55build/%.o: %.c Makefile $(PC_FILE) | build
56	$(CC) $(CFLAGS) -c $< -o $@
57
58build/$(APP)-shared: $(OBJS)
59	$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
60
61build/$(APP)-static: $(OBJS)
62	$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
63
64build:
65	@mkdir -p $@
66
67.PHONY: clean
68clean:
69	rm -f build/$(APP)* build/*.o
70	rmdir --ignore-fail-on-non-empty build
71
72else
73
74ifeq ($(RTE_SDK),)
75$(error "Please define RTE_SDK environment variable")
76endif
77
78VPATH += $(SRCDIR)/pipeline
79
80# Default target, can be overridden by command line or environment
81RTE_TARGET ?= x86_64-native-linuxapp-gcc
82
83include $(RTE_SDK)/mk/rte.vars.mk
84
85INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h))
86
87SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y)
88
89CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline
90CFLAGS += -O3
91CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable
92CFLAGS += -DALLOW_EXPERIMENTAL_API
93
94include $(RTE_SDK)/mk/rte.extapp.mk
95
96endif
97