I have the following makefile:
SHELL += -eu
GREEN=$(shell echo -e "\033[0;32m")
RED=$(shell echo -e "\033[0;31m")
AWS=$(shell command aws --version 2> /dev/null)
all: prereqs
@echo "${GREEN} ✓ Testing our local environment for dependencies."
prereqs:
ifndef "${AWS}"
$(error "${RED} AWS is not available please install aws-cli")
endif
"${AWS}"
How do I change it so that if there is dependancy missing to show a more appropriate error and continue with the check?
I tried:
prereqs:
aws --version || $(error "${RED} AWS is not available please install aws-cli")
@echo
But it does not seem to be working, what am I missing as aws exists!
Any advice is much appreciated.
sh. Make doesn't use bash unless it's told to. Correct your tagging.shwith some non-POSIX-compliant extensions --echo -eisn't allowed to do anything other than print-eon output by the letter of the standard; see in particularly the APPLICATION USAGE section showing how to useprintf '%b\n'instead)./bin/shis provided by bash running in POSIX mode on your system), see how your makefile behaves if run afterexport BASHOPTS=xpg_echo