I am searching for a way to get the output and the exit code of a command to variables in a makefile.
Basicly I want this: (bash)
If you are going to use eval
anyway, make it print things you can eval
directly.
$(eval $(shell echo OUTPUT_RC=`whoami`; echo $$?))
OUTPUT=$(word 1,$(OUTPUT_RC))
RC=$(word 2,$(OUTPUT_RC))
GNU make offers the shell
function, as in:
OUTPUT=$(shell whoami)
OUTPUT_RC=$(shell whoami; echo $$?)