我需要告知用户我的Makefile,他必须设置一个环境变量。
target: dependency
@if test ! -f $(FILE) ; then\
echo Vitally needed $(FILE) is missed. ;\
echo You can change the path to the file by setting $(get_var_name $(FILE)) environment variable.;\
fi
那么,有没有办法获取$(FILE)的名称(我称之为$(get_var_name ...)make函数),以便用户看到以下输出?
Vitally needed very.very.important.file is missed.
You can change the path to the file by setting FILE environment variable.
答案 0 :(得分:0)
像这样:
target: dependency
@if test ! -f $(FILE) ; then\
echo Vitally needed $(FILE) is missed. ;\
echo You can change the path to the file by setting FILE environment variable.;\
fi
因为FILE变量的名称是FILE。