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