[Buildroot] [RFC PATCH 2/3] make: Drop `type -p ...' fallback
Petr Vorel
petr.vorel at gmail.com
Mon Oct 11 22:00:24 UTC 2021
`command -v' is good enough as it's POSIX.
For easier debugging previous problems removed separately.
Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
---
Makefile | 22 +++++++++++-----------
package/Makefile.in | 6 +++---
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 2317655272..81b7173974 100644
--- a/Makefile
+++ b/Makefile
@@ -284,12 +284,12 @@ HOSTAS := as
endif
ifndef HOSTCC
HOSTCC := gcc
-HOSTCC := $(shell $(SHELL) -c "command -v '$(HOSTCC)' || type -p '$(HOSTCC)' || echo gcc")
+HOSTCC := $(shell $(SHELL) -c "command -v '$(HOSTCC)' || echo gcc")
endif
HOSTCC_NOCCACHE := $(HOSTCC)
ifndef HOSTCXX
HOSTCXX := g++
-HOSTCXX := $(shell $(SHELL) -c "command -v '$(HOSTCXX)' || type -p '$(HOSTCXX)' || echo g++")
+HOSTCXX := $(shell $(SHELL) -c "command -v '$(HOSTCXX)' || echo g++")
endif
HOSTCXX_NOCCACHE := $(HOSTCXX)
ifndef HOSTCPP
@@ -310,15 +310,15 @@ endif
ifndef HOSTRANLIB
HOSTRANLIB := ranlib
endif
-HOSTAR := $(shell '$(SHELL)' -c "command -v '$(HOSTAR)' || type -p '$(HOSTAR)' || echo ar")
-HOSTAS := $(shell '$(SHELL)' -c "command -v '$(HOSTAS)' || type -p '$(HOSTAS)' || echo as")
-HOSTCPP := $(shell '$(SHELL)' -c "command -v '$(HOSTCPP)' || type -p '$(HOSTCPP)' || echo cpp")
-HOSTLD := $(shell '$(SHELL)' -c "command -v '$(HOSTLD)' || type -p '$(HOSTLD)' || echo ld")
-HOSTLN := $(shell '$(SHELL)' -c "command -v '$(HOSTLN)' || type -p '$(HOSTLN)' || echo ln")
-HOSTNM := $(shell '$(SHELL)' -c "command -v '$(HOSTNM)' || type -p '$(HOSTNM)' || echo nm")
-HOSTOBJCOPY := $(shell '$(SHELL)' -c "command -v '$(HOSTOBJCOPY)' || type -p '$(HOSTOBJCOPY)' || echo objcopy")
-HOSTRANLIB := $(shell '$(SHELL)' -c "command -v '$(HOSTRANLIB)' || type -p '$(HOSTRANLIB)' || echo ranlib")
-SED := $(shell $(SHELL) -c "command -v sed || type -p sed") -i -e
+HOSTAR := $(shell '$(SHELL)' -c "command -v '$(HOSTAR)' || echo ar")
+HOSTAS := $(shell '$(SHELL)' -c "command -v '$(HOSTAS)' || echo as")
+HOSTCPP := $(shell '$(SHELL)' -c "command -v '$(HOSTCPP)' || echo cpp")
+HOSTLD := $(shell '$(SHELL)' -c "command -v '$(HOSTLD)' || echo ld")
+HOSTLN := $(shell '$(SHELL)' -c "command -v '$(HOSTLN)' || echo ln")
+HOSTNM := $(shell '$(SHELL)' -c "command -v '$(HOSTNM)' || echo nm")
+HOSTOBJCOPY := $(shell '$(SHELL)' -c "command -v '$(HOSTOBJCOPY)' || echo objcopy")
+HOSTRANLIB := $(shell '$(SHELL)' -c "command -v '$(HOSTRANLIB)' || echo ranlib")
+SED := $(shell $(SHELL) -c "command -v sed") -i -e
export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
diff --git a/package/Makefile.in b/package/Makefile.in
index 2ba4d8b381..4e993ecd5f 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -4,7 +4,7 @@ endif
ifndef HOSTMAKE
HOSTMAKE = $(MAKE)
endif
-HOSTMAKE := $(shell $(SHELL) -c "command -v '$(HOSTMAKE)' || type -p '$(HOSTMAKE)' || echo make")
+HOSTMAKE := $(shell $(SHELL) -c "command -v '$(HOSTMAKE)' || echo make")
# If BR2_JLEVEL is 0, scale the maximum concurrency with the number of
# CPUs. An additional job is used in order to keep processors busy
@@ -222,8 +222,8 @@ else
TARGET_STRIP = /bin/true
STRIPCMD = $(TARGET_STRIP)
endif
-INSTALL := $(shell $(SHELL) -c "command -v install || type -p install")
-UNZIP := $(shell $(SHELL) -c "command -v unzip || type -p unzip") -q
+INSTALL := $(shell $(SHELL) -c "command -v install")
+UNZIP := $(shell $(SHELL) -c "command -v unzip") -q
APPLY_PATCHES = PATH=$(HOST_DIR)/bin:$$PATH support/scripts/apply-patches.sh $(if $(QUIET),-s)
--
2.33.0
More information about the buildroot
mailing list