首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >是否将makefile变量值赋给bash命令结果?

是否将makefile变量值赋给bash命令结果?
EN

Stack Overflow用户
提问于 2010-03-04 00:38:19
回答 3查看 70.7K关注 0票数 48

我尝试将此命令的输出(即在我的makefile中)分配给makefile头变量,如以下代码行所示:

代码语言:javascript
运行
复制
HEADER = $(shell for file in `find . -name *.h`;do echo $file; done)

问题是,如果我在makefile中使用以下命令打印标题:

代码语言:javascript
运行
复制
print:
    @echo $(HEADER)

我得到了

代码语言:javascript
运行
复制
ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile

如果我直接在控制台中运行这个命令,并且直接在makefile所在的位置运行:

代码语言:javascript
运行
复制
myaccount$ for file in `find . -name *.h`;do echo $file; done
./engine/helper/crypto/tomcrypt/headers/._tomcrypt_pk.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_argchk.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_cfg.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_cipher.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_custom.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_hash.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_mac.h
....

所以我得到了我所有的头文件。我这样做是为了避免在makefile中手动指定所有.h文件。

有什么想法吗?

EN

Stack Overflow用户

发布于 2010-03-04 00:48:09

为什么不干脆这么做呢

代码语言:javascript
运行
复制
HEADER = $(shell find . -name '*.h')
票数 19
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2373081

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档