xref: /f-stack/dpdk/examples/ptpclient/Makefile (revision 4b05018f)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2015 Intel Corporation
3
4# binary name
5APP = ptpclient
6
7# all source are stored in SRCS-y
8SRCS-y := ptpclient.c
9
10# Build using pkg-config variables if possible
11ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)
12
13all: shared
14.PHONY: shared static
15shared: build/$(APP)-shared
16	ln -sf $(APP)-shared build/$(APP)
17static: build/$(APP)-static
18	ln -sf $(APP)-static build/$(APP)
19
20PC_FILE := $(shell pkg-config --path libdpdk)
21CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
22LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
23LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
24
25build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
26	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
27
28build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
29	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
30
31build:
32	@mkdir -p $@
33
34.PHONY: clean
35clean:
36	rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
37	test -d build && rmdir -p build || true
38
39else # Build using legacy build system
40
41ifeq ($(RTE_SDK),)
42$(error "Please define RTE_SDK environment variable")
43endif
44
45# Default target, can be overriddegitn by command line or environment
46RTE_TARGET ?= x86_64-native-linuxapp-gcc
47
48include $(RTE_SDK)/mk/rte.vars.mk
49
50CFLAGS += -O3
51CFLAGS += $(WERROR_FLAGS)
52
53# workaround for a gcc bug with noreturn attribute
54# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
55ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
56CFLAGS_main.o += -Wno-return-type
57endif
58
59include $(RTE_SDK)/mk/rte.extapp.mk
60endif
61