variables - 如何从 shell 命令的输出中分配 Makefile 变量
问题描述
我正在尝试从文件中提取字符串并将其分配给变量。我有一个名为 tool_vaersions.env 的文件,它包含以下内容:
armcc install_dir /tools/compiler/armcc
gcc intall_dir /tools/compiler/gcc
Makefile 有以下内容:
TOOL1 := gcc
TOOL2 := armcc
TOOL_VER1 := $(shell "grep -i $(TOOL1) tool_versions.env" )
TOOL_INFO:
$(eval TOOL_VER2=$(shell "grep -i $(TOOL2) tool_versions.env" ))
@(echo TOOL_VER1 is $(TOOL_VER1))
@(echo TOOL_VER2 is $(TOOL_VER2))
我不确定我在这里做错了什么,但 TOOL_VER1 和 TOOL_VER2 的回声没有返回任何内容。我希望这两个变量都只有路径 /tools/compiler/gcc 和 /tools/compiler/armcc 但在我引入条带和字符串操作之前我似乎无法完成这项工作。
谢谢你帮助我。
解决方案
推荐阅读
- javafx - 通过辅助应用程序更改标签值 - JavaFX
- oauth2-playground - 进行 API 调用时出现“projectNotLinked”错误
- php - 无法通过php将值插入mysql
- python - 正则表达式中可用的整数操作
- javascript - Angular 没有向 firebase 发送正确的数据
- azure - Azure 功能高级/消费计划的扩展标准
- gradle - 找不到插件 [id: 'com.github.johnrengelman.shadow', 版本: '5.2.0']
- powershell - 如何指定我想要来自 Get-WinEvent 的 Microsoft Office 警报消息?
- html - 桌面和 iPhone 的 Safari 浏览器上的空白图像,但在其他手机和 Windows 浏览器上可以正常打开
- sql - SQL 中的硬编码值(复杂查询)