Chinaunix

标题: Makefile调用shell命令错误 [打印本页]

作者: mildrengong    时间: 2017-09-30 20:25
标题: Makefile调用shell命令错误
大神,我在Makefile中调用了一段shell命令,如下:
APPS += $(foreach i, $(shell cat config.mk.test | grep "=y"| grep -v "^#" | cut -d '#' -f1| sed 's/=y//g' | sed 's/CONFIG/MODULE/g' ), $(i))
结果提示错误:
*** unterminated call to function `foreach': missing `)'.  Stop.
但是shell命令在命令行中能够正确执行,请问在Makefile中该怎么处理这段shell命令?
config.mk.test:
CONFIG_AAAAA=y #sdjfsdkfsd
#CONFIG_TEE=y
CONFIG_AAAAB=y

目的是将其中的CONFIG_XXXX=y ...处理成MODULE_XXXX 不出来首字符为# 和 行字符串中#号之后的字符。

作者: mildrengong    时间: 2017-10-01 09:05
解决了, #在Makefile中属于特殊字符,需要加转移符\
作者: nswcfd    时间: 2017-10-10 15:29
嗯,学习了。

貌似是国庆期间唯一的帖子?




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2