Skip to contentSkip to conversation

Makefile cleanups.

PATCH In review Benjamin Marzinski 2 participants 5 messages Nov 10, 2023 – Nov 13, 2023

Subsystems (2)
lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

cover Makefile cleanups.

Two small, and I hope sensible, changes to Makefile.inc

Benjamin Marzinski (2):
Makefile.inc: always use /usr/share/man for mandir Makefile.inc: always use /usr/include for includedir

 Makefile.inc     | 5 ++---
 create-config.mk | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/2 Makefile.inc: always use /usr/share/man for mandir

The current build system, with nothing overridden, will install the man pages in /share/man, which AFAIK isn't correct for any distribution.

---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.inc +1 -1
index a20e2cec..ed40b449 100644
@@ -60,7 +60,7 @@ modulesloaddir	:= $(systemd_prefix)lib/modules-load.d
 libudevdir	:= $(systemd_prefix)lib/udev
 udevrulesdir	:= $(libudevdir)/rules.d
 bindir		:= $(exec_prefix)sbin
-mandir		:= $(usr_prefix)share/man
+mandir		:= /usr/share/man
 LIB		:= $(if $(shell test -d /lib64 && echo 1),lib64,lib)
 syslibdir	:= $(prefix)$(LIB)
 usrlibdir	:= $(usr_prefix)$(LIB)
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH 1/2] Makefile.inc: always use /usr/share/man for mandir

Quoted 20 lines · Benjamin Marzinski

The current build system, with nothing overridden, will install the man
pages in /share/man, which AFAIK isn't correct for any distribution.

---
 Makefile.inc | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.inc +0 -0
index a20e2cec..ed40b449 100644
@@ -60,7 +60,7 @@ modulesloaddir	:=

$(systemd_prefix)lib/modules-load.d
 libudevdir := $(systemd_prefix)lib/udev
 udevrulesdir := $(libudevdir)/rules.d
 bindir := $(exec_prefix)sbin

Makefile.inc +1 -1
-mandir		:= $(usr_prefix)share/man
+mandir		:= /usr/share/man
Quoted 3 lines

 LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
 syslibdir := $(prefix)$(LIB)
 usrlibdir := $(usr_prefix)$(LIB)

Hm. You are right for the default case, but the current code works correctly for prefix=/usr/local, for example. Also, I don't like using no hard-coded values for the secondary paths like "mandir" and "bindir".

What about this instead?

Makefile.inc +1 -1
index a20e2ce..6b45430 100644
@@ -36,7 +36,7 @@ prefix                :=
 # Prefix for binaries
 exec_prefix    := $(prefix)
 # Prefix for non-essential libraries (libdmmp)
-usr_prefix     := $(prefix)
+usr_prefix     := $(if $(prefix),$(prefix),/usr)
 # Prefix for configfuration files (multipath.conf)
 etc_prefix     := $(prefix)
 # Where to install systemd-related files. systemd is usually installed

under /usr

This will put the man pages under /usr/man is prefix is empty (the default case) and under $(prefix)/man otherwise (i.e. /usr/man if prefix=/usr).

Thanks,
Martin

author maintainer
#3 lore raw

PATCH 2/2 Makefile.inc: always use /usr/include for includedir

In reply to Benjamin Marzinski

The current build system, with nothing overridden, will install the header files to /include, which AFAIK isn't correct for any distribution.

---
 Makefile.inc     | 3 +--
 create-config.mk | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.inc +1 -2
index ed40b449..c5ec62d2 100644
@@ -64,7 +64,7 @@ mandir		:= /usr/share/man
 LIB		:= $(if $(shell test -d /lib64 && echo 1),lib64,lib)
 syslibdir	:= $(prefix)$(LIB)
 usrlibdir	:= $(usr_prefix)$(LIB)
-includedir	:= $(usr_prefix)include
+includedir	:= /usr/include
 pkgconfdir	:= $(usrlibdir)/pkgconfig
 plugindir       := $(prefix)$(LIB)/multipath
 configdir       := $(etc_prefix)etc/multipath/conf.d
@@ -73,7 +73,6 @@ statedir        := $(etc_prefix)etc/multipath
 runtimedir      := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
 devmapper_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir devmapper),/usr/include)
 libudev_incdir	:= $(or $(shell $(PKG_CONFIG) --variable=includedir libudev),/usr/include)
-kernel_incdir	:= /usr/include
 
 ifeq ($(V),)
 Q		:= @
create-config.mk +2 -2
index 4d318b96..963f6074 100644
@@ -103,7 +103,7 @@ ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h)
 	DEFINES += LIBDM_API_HOLD_CONTROL
 endif
 
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(includedir)/scsi/fc/fc_els.h),0)
 	DEFINES += FPIN_EVENT_HANDLER
 	FPIN_SUPPORT = 1
 endif
@@ -117,7 +117,7 @@ ifneq ($(call check_func,mnt_table_parse_swaps,$(libmount_h)),0)
 	DEFINES += LIBMOUNT_SUPPORTS_SWAP
 endif
 
-ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
+ifneq ($(call check_file,$(includedir)/linux/nvme_ioctl.h),0)
 	ANA_SUPPORT := 1
 endif
 
Signature · 1 line
2.41.0
#4 lore raw

Re: [PATCH 2/2] Makefile.inc: always use /usr/include for includedir

Quoted 5 lines · Benjamin Marzinski

The current build system, with nothing overridden, will install the header files to /include, which AFAIK isn't correct for any distribution.

I have the same comment as for patch 1/2 - correct for the default case, but the more obvious fix would be changing the default of usr_prefix (our current default prefix="" usr_prefix="" is arguably bad).

Also, I bet that there are cases out there where the assumption that paths for multipath and kernel headers are equal would fail.

I'm going to submit my suggestion here; I'm of course open to further discussion.

Thanks
Martin