Skip to content

Commit

Permalink
Makefile: replace which(1) with more portable command -v (#6784)
Browse files Browse the repository at this point in the history
The `which(1)` program is not provided by the POSIX base system
and causes the Makefile to misbehave when it is missing on the system.
`command -v` is a portable replacement that is provided by the shell
as a builtin and that is guaranteed to exist by POSIX.
  • Loading branch information
mgorny authored Jun 12, 2022
1 parent 944482f commit 3a41da0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/6784.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the dependency on `which(1)` program in favor of the shell built-in `command -v` whose presence is guaranteed by POSIX.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FORCE:
# check_sum.py works perfectly fine but slow when called for every file from $(ALLS)
# (perhaps even several times for each file).
# That is why much less readable but faster solution exists
ifneq (, $(shell which sha256sum))
ifneq (, $(shell command -v sha256sum))
%.hash: FORCE
$(eval $@_ABS := $(abspath $@))
$(eval $@_NAME := $($@_ABS))
Expand Down

0 comments on commit 3a41da0

Please sign in to comment.