examples/ip_pipeline: remove infra code
[dpdk.git] / examples / ip_pipeline / Makefile
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2018 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 += parser.c
10 #SRCS-y += thread.c
11
12 # Build using pkg-config variables if possible
13 $(shell pkg-config --exists libdpdk)
14 ifeq ($(.SHELLSTATUS),0)
15
16 all: shared
17 .PHONY: shared static
18 shared: build/$(APP)-shared
19         ln -sf $(APP)-shared build/$(APP)
20 static: build/$(APP)-static
21         ln -sf $(APP)-static build/$(APP)
22
23 PC_FILE := $(shell pkg-config --path libdpdk)
24 CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
25 LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
26 LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
27
28 CFLAGS += -I.
29
30 OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
31
32 build/%.o: %.c Makefile $(PC_FILE) | build
33         $(CC) $(CFLAGS) -c $< -o $@
34
35 build/$(APP)-shared: $(OBJS)
36         $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
37
38 build/$(APP)-static: $(OBJS)
39         $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
40
41 build:
42         @mkdir -p $@
43
44 .PHONY: clean
45 clean:
46         rm -f build/$(APP)* build/*.o
47         rmdir --ignore-fail-on-non-empty build
48
49 else
50
51 ifeq ($(RTE_SDK),)
52 $(error "Please define RTE_SDK environment variable")
53 endif
54
55 # Default target, can be overridden by command line or environment
56 RTE_TARGET ?= x86_64-native-linuxapp-gcc
57
58 include $(RTE_SDK)/mk/rte.vars.mk
59
60 INC += $(sort $(wildcard *.h))
61
62 SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y)
63
64 CFLAGS += -I$(SRCDIR)
65 CFLAGS += -O3
66 CFLAGS += $(WERROR_FLAGS)
67
68 include $(RTE_SDK)/mk/rte.extapp.mk
69
70 endif