1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright (C) 2015 Intel Corporation. 3# Copyright (c) 2017, IBM Corporation. 4# Copyright (c) 2019, 2021 Mellanox Corporation. 5# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES 6# All rights reserved. 7# Copyright (c) 2022 Dell Inc, or its subsidiaries. 8# 9 10ifeq ($(wildcard $(SPDK_ROOT_DIR)/mk/config.mk),) 11$(error mk/config.mk: file not found. Please run configure before make) 12endif 13 14include $(SPDK_ROOT_DIR)/mk/config.mk 15-include $(SPDK_ROOT_DIR)/mk/cc.flags.mk 16-include $(SPDK_ROOT_DIR)/mk/cc.mk 17 18ifneq ($(V),1) 19Q ?= @ 20endif 21S ?= $(notdir $(CURDIR)) 22 23DESTDIR?= 24EXEEXT?= 25 26ifneq ($(prefix),) 27CONFIG_PREFIX=$(prefix) 28endif 29 30bindir?=$(CONFIG_PREFIX)/bin 31ifeq ($(CONFIG_LIBDIR),) 32libdir?=$(CONFIG_PREFIX)/lib 33else 34libdir?=$(CONFIG_LIBDIR) 35endif 36includedir?=$(CONFIG_PREFIX)/include 37 38ifeq ($(MAKECMDGOALS),) 39MAKECMDGOALS=$(.DEFAULT_GOAL) 40endif 41 42TARGET_TRIPLET := $(shell $(CC) -dumpmachine) 43TARGET_TRIPLET_WORDS := $(subst -, ,$(TARGET_TRIPLET)) 44 45ifneq ($(filter linux%,$(TARGET_TRIPLET_WORDS)),) 46OS = Linux 47endif 48ifneq ($(filter freebsd%,$(TARGET_TRIPLET_WORDS)),) 49OS = FreeBSD 50endif 51ifneq ($(filter mingw% windows%,$(TARGET_TRIPLET_WORDS)),) 52OS = Windows 53endif 54 55TARGET_ARCHITECTURE ?= $(CONFIG_ARCH) 56TARGET_MACHINE := $(firstword $(TARGET_TRIPLET_WORDS)) 57 58ifeq ($(OS),Windows) 59EXEEXT = .exe 60endif 61 62COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing -I$(SPDK_ROOT_DIR)/include 63 64ifneq ($(filter powerpc% ppc%,$(TARGET_MACHINE)),) 65COMMON_CFLAGS += -mcpu=$(TARGET_ARCHITECTURE) 66else ifeq ($(TARGET_MACHINE),aarch64) 67COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE) 68COMMON_CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE) 69else ifeq ('$(TARGET_MACHINE)|$(TARGET_ARCHITECTURE)','riscv64|native') 70# -march=native is not yet supported by GCC on RISC-V. Falling back to default. 71else ifneq ($(filter loongarch%,$(TARGET_MACHINE)),) 72COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE) 73COMMON_CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE) 74else 75COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE) 76endif 77 78ifeq ($(TARGET_MACHINE),x86_64) 79ifeq ($(CC_TYPE),gcc) 80ifneq (,$(shell $(CC) --target-help 2>/dev/null | grep -e -mavx512f >/dev/null && echo 1)) 81# Don't use AVX-512 instructions in SPDK code - it breaks Valgrind for 82# some cases where compiler decides to hyper-optimize a relatively 83# simple operation (like int-to-float conversion) using AVX-512 84COMMON_CFLAGS += -mno-avx512f 85endif 86endif 87ifeq ($(CC_TYPE),clang) 88LLC=llc$(shell echo $(CC) | grep -o -E "\-[0-9]{2}") 89ifneq (,$(shell $(LLC) -march=x86-64 -mattr=help 2>&1 | grep -e avx512f >/dev/null && echo 1)) 90COMMON_CFLAGS += -mno-avx512f 91endif 92endif 93endif 94 95ifeq ($(CONFIG_WERROR), y) 96COMMON_CFLAGS += -Werror 97endif 98 99ifeq ($(CONFIG_LTO),y) 100COMMON_CFLAGS += -flto 101LDFLAGS += -flto 102endif 103 104ifeq ($(CONFIG_PGO_CAPTURE),y) 105COMMON_CFLAGS += -fprofile-generate=$(SPDK_ROOT_DIR)/build/pgo 106LDFLAGS += -fprofile-generate=$(SPDK_ROOT_DIR)/build/pgo 107endif 108 109ifeq ($(CONFIG_PGO_USE),y) 110COMMON_CFLAGS += -fprofile-use=$(SPDK_ROOT_DIR)/build/pgo 111LDFLAGS += -fprofile-use=$(SPDK_ROOT_DIR)/build/pgo 112endif 113 114ifeq ($(CONFIG_CET),y) 115COMMON_CFLAGS += -fcf-protection 116LDFLAGS += -fcf-protection 117endif 118 119COMMON_CFLAGS += -Wformat -Wformat-security 120 121COMMON_CFLAGS += -D_GNU_SOURCE 122 123# Always build PIC code so that objects can be used in shared libs and position-independent executables 124COMMON_CFLAGS += -fPIC 125 126# Enable stack buffer overflow checking 127COMMON_CFLAGS += -fstack-protector 128 129ifeq ($(OS).$(CC_TYPE),Windows.gcc) 130# Workaround for gcc bug 86832 - invalid TLS usage 131COMMON_CFLAGS += -mstack-protector-guard=global 132endif 133 134# Prevent accidental multiple definitions of global variables 135COMMON_CFLAGS += -fno-common 136 137# Enable full RELRO - no lazy relocation (resolve everything at load time). 138# This allows the GOT to be made read-only early in the loading process. 139ifneq ($(OS),Windows) 140LDFLAGS += -Wl,-z,relro,-z,now 141endif 142 143# Make the stack non-executable. 144# This is the default in most environments, but it doesn't hurt to set it explicitly. 145ifneq ($(OS),Windows) 146LDFLAGS += -Wl,-z,noexecstack 147endif 148 149# Specify the linker to use 150ifneq ($(LD_TYPE),) 151LDFLAGS += -fuse-ld=$(LD_TYPE) 152endif 153 154SYS_LIBS = 155 156ifeq ($(OS),FreeBSD) 157SYS_LIBS += -L/usr/local/lib 158COMMON_CFLAGS += -I/usr/local/include 159endif 160 161ifeq ($(CONFIG_RDMA),y) 162SYS_LIBS += -libverbs -lrdmacm 163endif 164 165ifeq ($(CONFIG_URING),y) 166SYS_LIBS += -luring 167ifneq ($(strip $(CONFIG_URING_PATH)),) 168CFLAGS += -I$(CONFIG_URING_PATH) 169LDFLAGS += -L$(CONFIG_URING_PATH) 170endif 171endif 172 173ifeq ($(CONFIG_AVAHI),y) 174SYS_LIBS += -lavahi-common -lavahi-client 175endif 176 177IPSEC_MB_DIR=$(CONFIG_IPSEC_MB_DIR) 178 179ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l 180ISAL_CRYPTO_DIR=$(SPDK_ROOT_DIR)/isa-l-crypto 181ifeq ($(CONFIG_ISAL), y) 182SYS_LIBS += -L$(ISAL_DIR)/.libs -lisal 183COMMON_CFLAGS += -I$(ISAL_DIR)/.. 184ifeq ($(CONFIG_ISAL_CRYPTO), y) 185SYS_LIBS += -L$(ISAL_CRYPTO_DIR)/.libs -lisal_crypto 186COMMON_CFLAGS += -I$(ISAL_CRYPTO_DIR)/.. 187endif 188endif 189 190ifeq ($(CONFIG_VFIO_USER), y) 191ifneq ($(CONFIG_VFIO_USER_DIR),) 192VFIO_USER_SRC_DIR=$(CONFIG_VFIO_USER_DIR) 193else 194VFIO_USER_SRC_DIR=$(SPDK_ROOT_DIR)/libvfio-user 195endif 196ifeq ($(CONFIG_DEBUG), y) 197VFIO_USER_BUILD_TYPE=debug 198else 199VFIO_USER_BUILD_TYPE=release 200endif 201ifeq ($(CONFIG_SHARED), y) 202VFIO_USER_BUILD_SHARED=shared 203else 204VFIO_USER_BUILD_SHARED=static 205endif 206VFIO_USER_LIB_PREFIX=/usr/local/lib 207VFIO_USER_BUILD_DIR=$(SPDK_ROOT_DIR)/build/libvfio-user/build-$(VFIO_USER_BUILD_TYPE) 208VFIO_USER_INSTALL_DIR=$(SPDK_ROOT_DIR)/build/libvfio-user 209VFIO_USER_INCLUDE_DIR=$(VFIO_USER_INSTALL_DIR)/usr/local/include 210VFIO_USER_LIBRARY_DIR=$(VFIO_USER_INSTALL_DIR)$(VFIO_USER_LIB_PREFIX) 211 212CFLAGS += -I$(VFIO_USER_INCLUDE_DIR) 213LDFLAGS += -L$(VFIO_USER_LIBRARY_DIR) 214SYS_LIBS += -lvfio-user -ljson-c 215endif 216 217ifeq ($(CONFIG_XNVME), y) 218XNVME_DIR=$(SPDK_ROOT_DIR)/xnvme 219XNVME_INSTALL_DIR=$(XNVME_DIR)/builddir/lib 220XNVME_INCLUDE_DIR=$(XNVME_DIR)/include 221 222CFLAGS += -I$(XNVME_INCLUDE_DIR) 223LDFLAGS += -L$(XNVME_INSTALL_DIR) 224SYS_LIBS += -lxnvme 225ifneq ($(CONFIG_URING), y) 226SYS_LIBS += -luring 227endif 228endif 229 230ifeq ($(CONFIG_DAOS),y) 231ifneq ($(CONFIG_DAOS_DIR),) 232CFLAGS += -I$(CONFIG_DAOS_DIR)/include 233LDFLAGS += -L$(CONFIG_DAOS_DIR)/lib64 234endif 235endif 236 237ifeq ($(CONFIG_UBLK),y) 238SYS_LIBS += -luring 239endif 240 241#Attach only if FreeBSD and RDMA is specified with configure 242ifeq ($(OS),FreeBSD) 243ifeq ($(CONFIG_RDMA),y) 244# Mellanox - MLX4 HBA Userspace Library 245ifneq ("$(wildcard /usr/lib/libmlx4.*)","") 246SYS_LIBS += -lmlx4 247endif 248# Mellanox - MLX5 HBA Userspace Library 249ifneq ("$(wildcard /usr/lib/libmlx5.*)","") 250SYS_LIBS += -lmlx5 251endif 252# Chelsio HBA Userspace Library 253ifneq ("$(wildcard /usr/lib/libcxgb4.*)","") 254SYS_LIBS += -lcxgb4 255endif 256endif 257endif 258 259ifeq ($(CONFIG_FC),y) 260ifneq ($(strip $(CONFIG_FC_PATH)),) 261SYS_LIBS += -L$(CONFIG_FC_PATH) 262endif 263SYS_LIBS += -lufc 264endif 265 266ifeq ($(CONFIG_DEBUG), y) 267COMMON_CFLAGS += -DDEBUG -O0 -fno-omit-frame-pointer 268else 269COMMON_CFLAGS += -DNDEBUG -O2 270# Enable _FORTIFY_SOURCE checks - these only work when optimizations are enabled. 271COMMON_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 272endif 273 274ifeq ($(CONFIG_COVERAGE), y) 275COMMON_CFLAGS += -fprofile-arcs -ftest-coverage 276LDFLAGS += -fprofile-arcs -ftest-coverage 277ifeq ($(OS),FreeBSD) 278LDFLAGS += --coverage 279endif 280endif 281 282ifeq ($(OS),Windows) 283WPDK_DIR = $(abspath $(CONFIG_WPDK_DIR)) 284COMMON_CFLAGS += -I$(WPDK_DIR)/include/wpdk -I$(WPDK_DIR)/include 285LDFLAGS += -L$(WPDK_DIR)/lib 286ifeq ($(CONFIG_SHARED),y) 287SYS_LIBS += -lwpdk 288else 289SYS_LIBS += $(WPDK_DIR)/lib/libwpdk.a 290endif 291SYS_LIBS += -ldbghelp -lkernel32 -lsetupapi -lws2_32 -lrpcrt4 -liphlpapi 292endif 293 294include $(CONFIG_ENV)/env.mk 295 296ifeq ($(CONFIG_ASAN),y) 297COMMON_CFLAGS += -fsanitize=address 298LDFLAGS += -fsanitize=address 299endif 300 301ifeq ($(CONFIG_UBSAN),y) 302COMMON_CFLAGS += -fsanitize=undefined 303LDFLAGS += -fsanitize=undefined 304endif 305 306ifeq ($(CONFIG_TSAN),y) 307COMMON_CFLAGS += -fsanitize=thread 308LDFLAGS += -fsanitize=thread 309endif 310 311ifeq ($(CONFIG_FUZZER),y) 312COMMON_CFLAGS += -fsanitize=fuzzer-no-link 313LDFLAGS += -fsanitize=fuzzer-no-link 314SYS_LIBS += $(CONFIG_FUZZER_LIB) 315endif 316 317SPDK_GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) 318ifneq (, $(SPDK_GIT_COMMIT)) 319COMMON_CFLAGS += -DSPDK_GIT_COMMIT=$(SPDK_GIT_COMMIT) 320endif 321 322ifneq ($(OS),Windows) 323COMMON_CFLAGS += -pthread 324SYS_LIBS += -pthread 325endif 326 327ifeq ($(CONFIG_IDXD_KERNEL),y) 328SYS_LIBS += -laccel-config 329endif 330 331CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -Wold-style-definition -std=gnu99 332CXXFLAGS += $(COMMON_CFLAGS) -std=c++11 333 334SYS_LIBS += -lrt 335ifneq ($(OS),FreeBSD) 336SYS_LIBS += -luuid 337endif 338SYS_LIBS += -lssl 339SYS_LIBS += -lcrypto 340SYS_LIBS += -lm 341 342PKGCONF ?= pkg-config 343ifneq ($(strip $(CONFIG_OPENSSL_PATH)),) 344CFLAGS += -I$(CONFIG_OPENSSL_PATH)/include 345LDFLAGS += -L$(CONFIG_OPENSSL_PATH) 346else 347# `libssl11` name is unique to Centos7 via EPEL 348# So it's safe to add it here without additional check for Centos7 349ifeq ($(shell $(PKGCONF) --exists libssl11 && echo 1),1) 350CFLAGS += $(shell $(PKGCONF) --cflags libssl11) 351LDFLAGS += $(shell $(PKGCONF) --libs libssl11) 352endif 353endif 354 355ifneq ($(CONFIG_NVME_CUSE)$(CONFIG_FUSE),nn) 356SYS_LIBS += -lfuse3 357endif 358 359ifeq ($(OS).$(CC_TYPE),Windows.gcc) 360# Include libssp.a for stack-protector and _FORTIFY_SOURCE 361SYS_LIBS += -l:libssp.a 362endif 363 364MAKEFLAGS += --no-print-directory 365 366C_SRCS += $(C_SRCS-y) 367CXX_SRCS += $(CXX_SRCS-y) 368 369OBJS = $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o) 370 371DEPFLAGS = -MMD -MP -MF $*.d.tmp 372 373# Compile first input $< (.c) into $@ (.o) 374COMPILE_C=\ 375 $(Q)echo " CC $S/$@"; \ 376 $(CC) -o $@ $(DEPFLAGS) $(CFLAGS) -c $< && \ 377 mv -f $*.d.tmp $*.d && touch -c $@ 378 379COMPILE_CXX=\ 380 $(Q)echo " CXX $S/$@"; \ 381 $(CXX) -o $@ $(DEPFLAGS) $(CXXFLAGS) -c $< && \ 382 mv -f $*.d.tmp $*.d && touch -c $@ 383 384ENV_LDFLAGS = $(if $(SPDK_NO_LINK_ENV),,$(ENV_LINKER_ARGS)) 385 386# Link $(OBJS) and $(LIBS) into $@ (app) 387LINK_C=\ 388 $(Q)echo " LINK $(notdir $@)"; \ 389 $(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LDFLAGS) $(SYS_LIBS) 390 391LINK_CXX=\ 392 $(Q)echo " LINK $(notdir $@)"; \ 393 $(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(ENV_LDFLAGS) $(SYS_LIBS) 394 395# Provide function to ease build of a shared lib 396define spdk_build_realname_shared_lib 397 $(1) -o $@ -shared $(CPPFLAGS) $(LDFLAGS) \ 398 -Wl,-rpath=$(DESTDIR)/$(libdir) \ 399 -Wl,--soname,$(notdir $@) \ 400 -Wl,--whole-archive $(2) -Wl,--no-whole-archive \ 401 -Wl,--version-script=$(3) \ 402 $(4) -Wl,--no-as-needed $(5) -Wl,--as-needed 403endef 404 405BUILD_LINKERNAME_LIB=\ 406 ln -sf $(notdir $<) $@ 407 408# Archive $(OBJS) into $@ (.a) 409LIB_C=\ 410 $(Q)echo " LIB $(notdir $@)"; \ 411 rm -f $@; \ 412 mkdir -p $(dir $@); \ 413 $(CCAR) crDs $@ $(OBJS) 414 415# Clean up generated files listed as arguments plus a default list 416CLEAN_C=\ 417 $(Q)rm -f *.a *.lib *.o *.obj *.d *.d.tmp *.pdb *.gcno *.gcda 418 419# Install a library 420INSTALL_LIB=\ 421 $(Q)echo " INSTALL $(DESTDIR)$(libdir)/$(notdir $(LIB))"; \ 422 install -d -m 755 "$(DESTDIR)$(libdir)"; \ 423 install -m 644 "$(LIB)" "$(DESTDIR)$(libdir)/" 424 425# Uninstall a library 426UNINSTALL_LIB=\ 427 $(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(LIB))";\ 428 rm -f "$(DESTDIR)$(libdir)/$(notdir $(LIB))"; \ 429 if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi 430 431define pkgconfig_install 432 echo " INSTALL $(DESTDIR)$(libdir)/pkgconfig/$(notdir $(1))"; 433 install -d -m 755 "$(DESTDIR)$(libdir)/pkgconfig"; 434 install -m 644 "$(1)" "$(DESTDIR)$(libdir)/pkgconfig"; 435endef 436 437define pkgconfig_uninstall 438 echo " UNINSTALL $(DESTDIR)$(libdir)/pkgconfig/$(notdir $(1))"; 439 rm -f "$(DESTDIR)$(libdir)/pkgconfig/$(notdir $(1))"; 440 if [ -d "$(DESTDIR)$(libdir)/pkgconfig" ] && [ $$(ls -A "$(DESTDIR)$(libdir)/pkgconfig" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)/pkgconfig"; fi; 441endef 442 443ifeq ($(OS),FreeBSD) 444INSTALL_REL_SYMLINK := install -l rs 445else 446INSTALL_REL_SYMLINK := ln -sf -r 447endif 448 449define spdk_install_lib_symlink 450 $(INSTALL_REL_SYMLINK) $(DESTDIR)$(libdir)/$(1) $(DESTDIR)$(libdir)/$(2) 451endef 452 453INSTALL_SHARED_LIB=\ 454 $(Q)echo " INSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \ 455 install -d -m 755 "$(DESTDIR)$(libdir)"; \ 456 if file $(SHARED_REALNAME_LIB) | grep -q 'LSB shared object'; then \ 457 perm_mode=755; \ 458 else \ 459 perm_mode=644; \ 460 fi; \ 461 install -m $$perm_mode "$(SHARED_REALNAME_LIB)" "$(DESTDIR)$(libdir)/"; \ 462 $(call spdk_install_lib_symlink,$(notdir $(SHARED_REALNAME_LIB)),$(notdir $(SHARED_LINKED_LIB))); 463 464# Uninstall an shared library 465UNINSTALL_SHARED_LIB=\ 466 $(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \ 467 rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \ 468 rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_REALNAME_LIB))"; \ 469 if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi 470 471 472# Install an app binary 473INSTALL_APP=\ 474 $(Q)echo " INSTALL $(DESTDIR)$(bindir)/$(notdir $<)"; \ 475 install -d -m 755 "$(DESTDIR)$(bindir)"; \ 476 install -m 755 "$<" "$(DESTDIR)$(bindir)/" 477 478# Uninstall an app binary 479UNINSTALL_APP=\ 480 $(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/$(notdir $(APP))"; \ 481 rm -f "$(DESTDIR)$(bindir)/$(notdir $(APP))"; \ 482 if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi 483 484INSTALL_EXAMPLE=\ 485 $(Q)echo " INSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \ 486 install -d -m 755 "$(DESTDIR)$(bindir)"; \ 487 install -m 755 "$<" "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))" 488 489# Uninstall an example binary 490UNINSTALL_EXAMPLE=\ 491 $(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \ 492 rm -f "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \ 493 if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi 494 495# Install a header 496INSTALL_HEADER=\ 497 $(Q)echo " INSTALL $@"; \ 498 install -d -m 755 "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; \ 499 install -m 644 "$(patsubst $(DESTDIR)$(includedir)/%,%,$@)" "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; 500 501# Uninstall a header 502UNINSTALL_HEADER=\ 503 $(Q)echo " UNINSTALL $@"; \ 504 rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))$(notdir $@)"; \ 505 if [ -d "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" ] \ 506 && [ $$(ls -A "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" | wc -l) -eq 0 ]; \ 507 then rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; fi 508 509%.o: %.c %.d $(MAKEFILE_LIST) 510 $(COMPILE_C) 511 512%.o: %.cpp %.d $(MAKEFILE_LIST) 513 $(COMPILE_CXX) 514 515%.d: ; 516 517define spdk_lib_list_to_static_libs 518$(1:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.a) 519endef 520 521define spdk_lib_list_to_shared_libs 522$(1:%=$(SPDK_ROOT_DIR)/build/lib/libspdk_%.so) 523endef 524 525define add_no_as_needed 526-Wl,--no-as-needed $(1) -Wl,-as-needed 527endef 528 529define add_whole_archive 530-Wl,--whole-archive $(1) -Wl,--no-whole-archive 531endef 532 533define pkgconfig_filename 534$(SPDK_ROOT_DIR)/build/lib/pkgconfig/$(1).pc 535endef 536