From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Thu, 27 Oct 2022 16:17:40 +0200 Subject: [PATCH] multipath-tools: Makefiles: simplify code for include dirs Use make's if function, and use lower-case latters for make variable names that represent directories, such as elsewhere. Signed-off-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- Makefile.inc | 16 +++------------- kpartx/Makefile | 2 +- libmultipath/Makefile | 14 +++++++------- libmultipath/prioritizers/Makefile | 2 +- multipathd/Makefile | 4 ++-- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index c39cec9b..38bd1d80 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -37,20 +37,7 @@ else endif endif -ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1) - DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper) -else - DEVMAPPER_INCDIR = /usr/include -endif - -ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1) - LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev) -else - LIBUDEV_INCDIR = /usr/include -endif - # Allow user to override default location. -LINUX_HEADERS_INCDIR = /usr/include # Paths. All these can be overridden on the "make" command line. prefix = @@ -89,6 +76,9 @@ pkgconfdir = $(usrlibdir)/pkgconfig plugindir := $(prefix)/$(LIB)/multipath configdir := $(prefix)/etc/multipath/conf.d runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run) +devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/usr/include) +libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include) +kernel_incdir := /usr/include GZIP_PROG = gzip -9 -c RM = rm -f diff --git a/kpartx/Makefile b/kpartx/Makefile index 742d3bcd..bdf2d035 100644 --- a/kpartx/Makefile +++ b/kpartx/Makefile @@ -9,7 +9,7 @@ LDFLAGS += $(BIN_LDFLAGS) LIBDEPS += -ldevmapper -ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_COOKIE endif diff --git a/libmultipath/Makefile b/libmultipath/Makefile index 3b60a525..f0df27c0 100644 --- a/libmultipath/Makefile +++ b/libmultipath/Makefile @@ -22,31 +22,31 @@ ifdef SYSTEMD endif endif -ifneq ($(call check_func,dm_task_no_flush,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_FLUSH endif -ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_GET_ERRNO endif -ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_COOKIE endif -ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(LIBUDEV_INCDIR)/libudev.h),0) +ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0) CPPFLAGS += -DLIBUDEV_API_RECVBUF endif -ifneq ($(call check_func,dm_task_deferred_remove,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_DEFERRED endif -ifneq ($(call check_func,dm_hold_control_dev,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_HOLD_CONTROL endif -ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0) +ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0) CPPFLAGS += -DFPIN_EVENT_HANDLER endif diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile index 400f7735..97155f51 100644 --- a/libmultipath/prioritizers/Makefile +++ b/libmultipath/prioritizers/Makefile @@ -26,7 +26,7 @@ LIBS = \ libpriopath_latency.so \ libpriosysfs.so -ifneq ($(call check_file,$(LINUX_HEADERS_INCDIR)/linux/nvme_ioctl.h),0) +ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0) LIBS += libprioana.so CPPFLAGS += -I../nvme endif diff --git a/multipathd/Makefile b/multipathd/Makefile index 3ce9465e..c462d7b1 100644 --- a/multipathd/Makefile +++ b/multipathd/Makefile @@ -1,10 +1,10 @@ include ../Makefile.inc -ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0) +ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0) CPPFLAGS += -DLIBDM_API_GET_ERRNO endif -ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0) +ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0) CPPFLAGS += -DFPIN_EVENT_HANDLER FPIN_SUPPORT = 1 endif