eal: rename lcore master and slave
[dpdk.git] / examples / performance-thread / pthread_shim / Makefile
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2020 Intel Corporation
3
4 # binary name
5 APP = lthread_pthread_shim
6
7 # all source are stored in SRCS-y
8 SRCS-y := main.c pthread_shim.c
9
10 include ../common/common.mk
11
12 CFLAGS += -DALLOW_EXPERIMENTAL_API
13 CFLAGS += -D_GNU_SOURCE
14 LDFLAGS += "-Wl,--copy-dt-needed-entries"
15
16 # Build using pkg-config variables if possible
17 ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
18 $(error "no installation of DPDK found")
19 endif
20
21 all: shared
22 .PHONY: shared static
23 shared: build/$(APP)-shared
24         ln -sf $(APP)-shared build/$(APP)
25 static: build/$(APP)-static
26         ln -sf $(APP)-static build/$(APP)
27
28 LDFLAGS += -lpthread
29
30 PKGCONF ?= pkg-config
31
32 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
33 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
34 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
35 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
36
37 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
38         $(CC) $(CFLAGS) $(filter %.c,$^) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
39
40 build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
41         $(CC) $(CFLAGS) $(filter %.c,$^) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
42
43 # workaround for a gcc bug with noreturn attribute
44 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
45 ifeq ($(shell gcc -dumpversion),-gt 0)
46 CFLAGS_main.o += -Wno-return-type
47 endif
48
49 build:
50         @mkdir -p $@
51
52 .PHONY: clean
53 clean:
54         rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
55         test -d build && rmdir -p build || true