user5400132 user5400132 - 1 month ago 11
Linux Question

echo not working from Makefile

I have added code to Makefile something like:

ifeq "$var" "1"
var_1 := 1\
echo "g++ version OK"\
$(info $(var_1))
else
echo "needs to be updated"
endif


I am using tabs everywhere in this part of code. It does not seem to work, nothing echoes at all when I run make, Makefile already contains the object files and flags etc. Does it have something to with the position of the code? I'm unable to identify. Please help.

Answer

echo is a shell command, it only works from within a recipe or $(shell ...) function.

Anywhere else use $(info ...) function.

Comments