In make, if I want to capture the output of a shell command, I do something like this
RESULT:=$(shell $(COMMAND))
If I want to check if a command executed properly, I do this
RETURN_CODE := $(shell $(COMMAND); echo $$?)
How can I do both simultaneously, i.e. execute the command once, store the output, but also check the return code?
EDIT Duplicate here although his solution is not pleasant: Makefile: Output and Exitcode to variable?