common/cnxk: allow building for generic arm64
[dpdk.git] / examples / fips_validation / Makefile
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2018 Intel Corporation
3
4 # binary name
5 APP = fips_validation
6
7 # all source are stored in SRCS-y
8 SRCS-y := fips_validation.c
9 SRCS-y += fips_validation_aes.c
10 SRCS-y += fips_validation_hmac.c
11 SRCS-y += fips_validation_tdes.c
12 SRCS-y += fips_validation_gcm.c
13 SRCS-y += fips_validation_cmac.c
14 SRCS-y += fips_validation_ccm.c
15 SRCS-y += fips_validation_sha.c
16 SRCS-y += fips_dev_self_test.c
17 SRCS-y += fips_validation_xts.c
18 SRCS-y += main.c
19
20 PKGCONF ?= pkg-config
21
22 # Build using pkg-config variables if possible
23 ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
24 $(error "no installation of DPDK found")
25 endif
26
27 all: shared
28 .PHONY: shared static
29 shared: build/$(APP)-shared
30         ln -sf $(APP)-shared build/$(APP)
31 static: build/$(APP)-static
32         ln -sf $(APP)-static build/$(APP)
33
34 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
35 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
36 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
37 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
38
39 ifeq ($(MAKECMDGOALS),static)
40 # check for broken pkg-config
41 ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)
42 $(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.")
43 $(error "Cannot generate statically-linked binaries with this version of pkg-config")
44 endif
45 endif
46
47 CFLAGS += -DALLOW_EXPERIMENTAL_API
48
49 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
50         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
51
52 build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
53         $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
54
55 build:
56         @mkdir -p $@
57
58 .PHONY: clean
59 clean:
60         rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
61         test -d build && rmdir -p build || true