xref: /dpdk/examples/ip_pipeline/Makefile (revision ca926852)
13998e2a0SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
2fbc74e66SJasvinder Singh# Copyright(c) 2010-2018 Intel Corporation
377a33467SCristian Dumitrescu
40eba4adeSBruce Richardson# binary name
50eba4adeSBruce RichardsonAPP = ip_pipeline
60eba4adeSBruce Richardson
70eba4adeSBruce Richardson# all source are stored in SRCS-y
871937434SJasvinder SinghSRCS-y := action.c
971937434SJasvinder SinghSRCS-y += cli.c
104bbf8e30SJasvinder SinghSRCS-y += conn.c
119a408cc8SJasvinder SinghSRCS-y += kni.c
12133c2c65SJasvinder SinghSRCS-y += link.c
134bbf8e30SJasvinder SinghSRCS-y += main.c
146bfe74f8SJasvinder SinghSRCS-y += mempool.c
150eba4adeSBruce RichardsonSRCS-y += parser.c
16d75c371eSJasvinder SinghSRCS-y += pipeline.c
178245472cSJasvinder SinghSRCS-y += swq.c
182f74ae28SJasvinder SinghSRCS-y += tap.c
19c0b668e0SJasvinder SinghSRCS-y += thread.c
2025961ff3SJasvinder SinghSRCS-y += tmgr.c
21bd9b67a1SFan ZhangSRCS-y += cryptodev.c
220eba4adeSBruce Richardson
2322119c45SBruce Richardson# Build using pkg-config variables if possible
2422119c45SBruce Richardson$(shell pkg-config --exists libdpdk)
2522119c45SBruce Richardsonifeq ($(.SHELLSTATUS),0)
2622119c45SBruce Richardson
271842d194SBruce Richardsonall: shared
281842d194SBruce Richardson.PHONY: shared static
291842d194SBruce Richardsonshared: build/$(APP)-shared
301842d194SBruce Richardson	ln -sf $(APP)-shared build/$(APP)
311842d194SBruce Richardsonstatic: build/$(APP)-static
321842d194SBruce Richardson	ln -sf $(APP)-static build/$(APP)
331842d194SBruce Richardson
34*ca926852SBruce RichardsonPKGCONF=pkg-config --define-prefix
35*ca926852SBruce Richardson
36*ca926852SBruce RichardsonPC_FILE := $(shell $(PKGCONF) --path libdpdk)
37*ca926852SBruce RichardsonCFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
38*ca926852SBruce RichardsonLDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
39*ca926852SBruce RichardsonLDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
4022119c45SBruce Richardson
41fbc74e66SJasvinder SinghCFLAGS += -I.
4222119c45SBruce Richardson
4322119c45SBruce RichardsonOBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
4422119c45SBruce Richardson
4522119c45SBruce Richardsonbuild/%.o: %.c Makefile $(PC_FILE) | build
4622119c45SBruce Richardson	$(CC) $(CFLAGS) -c $< -o $@
4722119c45SBruce Richardson
481842d194SBruce Richardsonbuild/$(APP)-shared: $(OBJS)
491842d194SBruce Richardson	$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
501842d194SBruce Richardson
511842d194SBruce Richardsonbuild/$(APP)-static: $(OBJS)
521842d194SBruce Richardson	$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
5322119c45SBruce Richardson
5422119c45SBruce Richardsonbuild:
5522119c45SBruce Richardson	@mkdir -p $@
5622119c45SBruce Richardson
5722119c45SBruce Richardson.PHONY: clean
5822119c45SBruce Richardsonclean:
591842d194SBruce Richardson	rm -f build/$(APP)* build/*.o
607e9562a1SBruce Richardson	test -d build && rmdir -p build || true
6122119c45SBruce Richardson
6222119c45SBruce Richardsonelse
6322119c45SBruce Richardson
6477a33467SCristian Dumitrescuifeq ($(RTE_SDK),)
6577a33467SCristian Dumitrescu$(error "Please define RTE_SDK environment variable")
6677a33467SCristian Dumitrescuendif
6777a33467SCristian Dumitrescu
68e9c65942SBruce Richardson# Default target, detect a build directory, by looking for a path with a .config
69e9c65942SBruce RichardsonRTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.config)))))
7077a33467SCristian Dumitrescu
7177a33467SCristian Dumitrescuinclude $(RTE_SDK)/mk/rte.vars.mk
7277a33467SCristian Dumitrescu
73742bde12SBruce Richardsonifneq ($(CONFIG_RTE_EXEC_ENV_LINUX),y)
74218c4e68SBruce Richardson$(info This application can only operate in a linux environment, \
75d389f9a3SJasvinder Singhplease change the definition of the RTE_TARGET environment variable)
76d389f9a3SJasvinder Singhall:
77d389f9a3SJasvinder Singhclean:
78d389f9a3SJasvinder Singhelse
79d389f9a3SJasvinder Singh
80fbc74e66SJasvinder SinghINC += $(sort $(wildcard *.h))
81bff54484SMaciej Gajdzica
820eba4adeSBruce RichardsonSRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y)
83ea0908c4SJasvinder Singh
8471937434SJasvinder SinghCFLAGS += -DALLOW_EXPERIMENTAL_API
85fbc74e66SJasvinder SinghCFLAGS += -I$(SRCDIR)
8677a33467SCristian DumitrescuCFLAGS += -O3
87fbc74e66SJasvinder SinghCFLAGS += $(WERROR_FLAGS)
8877a33467SCristian Dumitrescu
8977a33467SCristian Dumitrescuinclude $(RTE_SDK)/mk/rte.extapp.mk
9022119c45SBruce Richardson
9122119c45SBruce Richardsonendif
92d389f9a3SJasvinder Singhendif
93