Skip to contentSkip to conversation

Makefile: do not hardcode the `install` program path

PATCH Applied Samuel Tardieu 2 participants 2 messages Feb 8, 2024 – Feb 14, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: do not hardcode the `install` program path

On systems that do not use the FHS, such as NixOS, the install program is not located in /usr/bin/ as its location is dynamic.

dtc can be easily installed on such systems by using the install program available in the $PATH with:

make PREFIX=… INSTALL=install

However, this becomes more difficult when dtc is being compiled as part of a larger toolchain, as the toolchain build scripts will not spontaneously pass such an argument on the command line. This happens for example when dtc is build as a part of the RTEMS build system.

By not hardcoding a predefined path for install, as is done for other executables, dtc will allow the one in the $PATH to be used.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 10a56d4..f1f0ab3 100644
@@ -29,7 +29,7 @@ SWIG = swig
 PKG_CONFIG ?= pkg-config
 PYTHON ?= python3
 
-INSTALL = /usr/bin/install
+INSTALL = install
 INSTALL_PROGRAM = $(INSTALL)
 INSTALL_LIB = $(INSTALL)
 INSTALL_DATA = $(INSTALL) -m 644
Signature · 1 line
2.43.0
Applied
#1 lore raw
Quoted 13 lines · Samuel Tardieu

On systems that do not use the FHS, such as NixOS, the install program is not located in /usr/bin/ as its location is dynamic.

dtc can be easily installed on such systems by using the install program available in the $PATH with:

make PREFIX=… INSTALL=install

However, this becomes more difficult when dtc is being compiled as part of a larger toolchain, as the toolchain build scripts will not spontaneously pass such an argument on the command line. This happens for example when dtc is build as a part of the RTEMS build system.

Quoted 4 lines

By not hardcoding a predefined path for install, as is done for other executables, dtc will allow the one in the $PATH to be used.

Applied, thanks.

Quoted 17 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 10a56d4..f1f0ab3 100644
@@ -29,7 +29,7 @@ SWIG = swig
 PKG_CONFIG ?= pkg-config
 PYTHON ?= python3
 
-INSTALL = /usr/bin/install
+INSTALL = install
 INSTALL_PROGRAM = $(INSTALL)
 INSTALL_LIB = $(INSTALL)
 INSTALL_DATA = $(INSTALL) -m 644
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson