1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright (C) 2020 Intel Corporation. 3# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES 4# All rights reserved. 5# 6 7PKG_CONFIG_PATH = $(SPDK_LIB_DIR)/pkgconfig 8 9DPDK_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_env_dpdk) 10SPDK_EVENT_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_event spdk_event_bdev) 11SPDK_DPDK_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_event spdk_event_bdev spdk_env_dpdk) 12SYS_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs --static spdk_syslibs) 13 14# Shows how to compile both an external bdev and an external application against the SPDK combined shared object and dpdk shared objects. 15bdev_shared_combo: 16 $(CC) $(COMMON_CFLAGS) -L../passthru -Wl,-rpath=$(SPDK_LIB_DIR),--no-as-needed -o hello_bdev ./hello_bdev.c -lpassthru_external \ 17 -lspdk $(DPDK_LIB) -Wl,--no-whole-archive $(SYS_LIB) 18 19# Shows how to compile both an external bdev and an external application against the SPDK individual shared objects and dpdk shared objects. 20bdev_shared_iso: 21 $(CC) $(COMMON_CFLAGS) -L../passthru -Wl,--no-as-needed -o hello_bdev ./hello_bdev.c \ 22 -lpassthru_external $(SPDK_EVENT_LIB) \ 23 $(DPDK_LIB) $(SYS_LIB) 24 25# Shows how to compile an external application against the SPDK combined shared object and dpdk shared objects. 26alone_shared_combo: 27 $(CC) $(COMMON_CFLAGS) -Wl,-rpath=$(SPDK_LIB_DIR),--no-as-needed -o hello_bdev ./hello_bdev.c -lspdk $(DPDK_LIB) $(SYS_LIB) 28 29# Shows how to compile an external application against the SPDK individual shared objects and dpdk shared objects. 30alone_shared_iso: 31 $(CC) $(COMMON_CFLAGS) -Wl,-rpath=$(SPDK_LIB_DIR),--no-as-needed -o hello_bdev ./hello_bdev.c \ 32 $(SPDK_EVENT_LIB) $(DPDK_LIB) $(SYS_LIB) 33 34# Shows how to compile an external application against the SPDK archives. 35alone_static: 36 $(CC) $(COMMON_CFLAGS) -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic \ 37 $(SPDK_DPDK_LIB) -Wl,--no-whole-archive,-Bdynamic $(SYS_LIB) 38 39# Shows how to compile and external bdev and application against the SPDK archives. 40bdev_static: 41 $(CC) $(COMMON_CFLAGS) -L../passthru -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic -lpassthru_external $(SPDK_DPDK_LIB) \ 42 -Wl,--no-whole-archive,-Bdynamic $(SYS_LIB) 43