在Makefile'foreach'循环中添加换行符 [英] Add a newline in Makefile 'foreach' loop

查看:726
本文介绍了在Makefile'foreach'循环中添加换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to insert a new-line to be executed within a foreach loop in a Makefile?

当前,我有以下内容:

$(foreach my_lib,$(MY_LIBS),$(call my_func,results,boxer,$(my_lib)))

现在,假设我有:

MY_LIBS = lib1 \
          lib2

上面的foreach循环的计算结果为:

The above foreach loop would evaluate to:

lib1 lib2

我希望此评估为:

lib1
lib2

是否可以在foreach循环中插入换行符来完成此操作?

Is it possible to insert a newline in the foreach loop to accomplish this?

谢谢.

推荐答案

define \n


endef

$(error Here is a message${\n}with embedded${\n}newlines.${\n}${\n}hooray!)

您可以在$(subst...)之类的东西中使用${\n}.

You can use ${\n} in things like $(subst...).

这篇关于在Makefile'foreach'循环中添加换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆