I put
@echo "============= $(TOOLPREFIX) ================="
in line 34 of Makefile of xv6 used by many OS courses, in hope of printing out the value of variable TOOLPREFIX. But I always got error
Makefile:37: *** missing separator. Stop.
This line is before any target. I tried everything I could, like adding Tab at the beginning of the command, moving the command to everywhere in Makefile, or deleting the symbol @ before echo, but I always got an error no matter what. But if I comment out this command, there is no error. So, how should I correctly print out a variable in this Makefile?
As a side note, if I add Tab at the beginning of the command, the error I got is "Makefile:37: *** recipe commences before first target. Stop." But if I move the @echo command to the bottom of Makefile, "Makefile:287: *** missing separator. Stop." comes out again.
The environment is Window Subsystem for Linux with ubuntu 20.04 installed.
Your directive can't be outside any rule.
You have to create one:
mydebug:
@echo "============= $(TOOLPREFIX) ================="