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