diff mbox series

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

Message ID 20231110195304.107907-2-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series Makefile cleanups. | expand

Commit Message

Benjamin Marzinski Nov. 10, 2023, 7:53 p.m. UTC
The current build system, with nothing overridden, will install the man
pages in /share/man, which AFAIK isn't correct for any distribution.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Wilck Nov. 13, 2023, 1:52 p.m. UTC | #1
On Fri, 2023-11-10 at 14:53 -0500, Benjamin Marzinski wrote:
> The current build system, with nothing overridden, will install the
> man
> pages in /share/man, which AFAIK isn't correct for any distribution.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  Makefile.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index a20e2cec..ed40b449 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -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)

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?

diff --git a/Makefile.inc b/Makefile.inc
index a20e2ce..6b45430 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -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
diff mbox series

Patch

diff --git a/Makefile.inc b/Makefile.inc
index a20e2cec..ed40b449 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -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)