makefile中多行列表中的注释

Bor*_*aut 2 makefile gnu-make

我想有类似的东西

BROKEN_THINGS = \ 
  thing1 \ # thing1 is completely broken
  thing2 \ # thing2 is broken too, see BUG-123
Run Code Online (Sandbox Code Playgroud)

看起来[g] make是不可能的.

我最终使用warning函数(这是有效的,因为$(warning X)总是返回空字符串):

BROKEN_THINGS = \
  thing1 $(warning "thing1 is completely broken") \
  thing2 $(warning "thing2 is broken too, see BUG-123") \
Run Code Online (Sandbox Code Playgroud)

最后一个并不理想,因为警告会使make的输出变得混乱(并且也是warning特定于gmake的).

有没有更好的解决方案来记录长长的多行列表?

Mad*_*ist 7

您可以使用:

BROKEN_THINGS =
BROKEN_THINGS += thing1  # thing1 is completely broken
BROKEN_THINGS += thing2  # thing2 is broken too, see BUG-123
Run Code Online (Sandbox Code Playgroud)