While working on allowing uutils to be the system coreutils in Gentoo, I ended up successfully building uutils without the Tier1 or common_core tools. This happened because tr was not available at build time, so that $(shell sed -n '/feat_Tier1 = \[/,/\]/p' Cargo.toml | sed '1d;2d' |tr -d '],"\n') returned an empty string.
I would have expected the make process to stop when a command like this fails. I know that detecting failed shell commands in make can be verbose, but it's worth considering ?
As an aside, even if it's perfectly fine to rely on coreutils in the Makefile, those particular commands could be turned into a single sed invocation, removing that unlikely source of failure and saving a tiny bit of CPU:
# Possible programs
PROGS := \
$(shell sed -n '/feat_Tier1 = \[/,/\]/{s/[,"]//g;/common_core/d;/^ /p}' Cargo.toml) \
$(shell sed -n '/feat_common_core = \[/,/\]/{s/[,"]//g;/^ /p}' Cargo.toml)
UNIX_PROGS := \
$(shell sed -n '/feat_require_unix_core = \[/,/\]/{s/[,"]//g;/^ /p}' Cargo.toml) \
hostid \
pinky \
stdbuf \
uptime \
users \
who
While working on allowing uutils to be the system coreutils in Gentoo, I ended up successfully building uutils without the
Tier1orcommon_coretools. This happened becausetrwas not available at build time, so that$(shell sed -n '/feat_Tier1 = \[/,/\]/p' Cargo.toml | sed '1d;2d' |tr -d '],"\n')returned an empty string.I would have expected the make process to stop when a command like this fails. I know that detecting failed shell commands in make can be verbose, but it's worth considering ?
As an aside, even if it's perfectly fine to rely on coreutils in the Makefile, those particular commands could be turned into a single
sedinvocation, removing that unlikely source of failure and saving a tiny bit of CPU: