在Makefile'foreach'循环中添加换行符

Dun*_*Bug 16 makefile

是否可以foreach在Makefile 的循环中插入要执行的换行符?

目前,我有以下内容:

$(foreach my_lib,$(MY_LIBS),$(call my_func,results,boxer,$(my_lib)))
Run Code Online (Sandbox Code Playgroud)

现在,假设我有:

MY_LIBS = lib1 \
          lib2
Run Code Online (Sandbox Code Playgroud)

以上foreach循环将评估为:

lib1 lib2
Run Code Online (Sandbox Code Playgroud)

我希望这个评估为:

lib1
lib2
Run Code Online (Sandbox Code Playgroud)

是否可以在foreach循环中插入换行符来实现此目的?

谢谢.

bob*_*ogo 31

define \n


endef

$(error Here is a message${\n}with embedded${\n}newlines.${\n}${\n}hooray!)
Run Code Online (Sandbox Code Playgroud)

你可以使用${\n}$(subst...).