I have a definitions.mk file with some definitions:
define some-method
if [ ! -f <some file> ] ; then
MYVAR += text_to_append
开发者_开发知识库
It is the line with MYVAR that is my problem. It thinks MYVAR is a command. How can I make it realize that it is the variable MYVAR (which also exists in other make files) that I am referring to?
Thanks in advance for any input!
You can't use a shell-style "if" statement in a Makefile. You need to use the GNU make conditional syntax.
Something like:
ifneq ($(wildcard some_file),)
# File exists
MYVAR += text_to_append
endif
Also, do not use tabs for indentation in your Makefile, they have special meaning to Make.
精彩评论