0

我需要通知 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.
4

1 回答 1

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。

于 2013-11-15T10:38:28.533 回答