前导“@”是什么?根据 makefile 的配方
在 eclipse 生成的 makefile 中,我看到以下规则:
./Cores/$(TARGET).core.3.srec : ../$(TARGET).core.3/Debug/$(TARGET).core.3.elf
@mkdir -p ./Cores/
@e-objcopy --srec-forceS3 --output-target srec "$<" "$@".temp
@echo Creating srec file for CoreID\<0x826\>
@head --lines=1 "$@".temp | sed 's/0000/0826/' > "$@"
@tail --lines=+2 "$@".temp >> "$@"
配方行开头的“@”的用途是什么?
通读 GNU Make 用户手册,我找不到对 @ 的使用的引用。然后我假设它实际上按原样转移到外壳。
因此,在阅读 BASH 手册时,我唯一能想到这种用法的地方是设置 extglob 选项时的命令替换。但是,在命令行中尝试此操作给了我一个错误。
In a makefile that is generated by eclipse, I see the following rules:
./Cores/$(TARGET).core.3.srec : ../$(TARGET).core.3/Debug/$(TARGET).core.3.elf
@mkdir -p ./Cores/
@e-objcopy --srec-forceS3 --output-target srec "lt;" "$@".temp
@echo Creating srec file for CoreID\<0x826\>
@head --lines=1 "$@".temp | sed 's/0000/0826/' > "$@"
@tail --lines=+2 "$@".temp >> "$@"
What is the purpose of the "@" at the beginning of the recipe lines?
Reading through the GNU Make user's manual I could not find a reference to this use of @. I then assumed that it is actually transferred as-is to the shell.
So, reading the BASH manual, the only place I could relate to this use is in command substitution when the extglob
option is set. However, trying this in the command line gave me an error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@
前缀使 make 以静默方式运行该命令。请参阅GNU make 手册的这一部分。The
@
prefix causes make to run the command silently. See this section of the GNU make manual.@ 会在运行配方时抑制回显命令,请参阅 https://stackoverflow.com/a/867093/60462。
The @ suppresses echoing the command when running the recipe, see https://stackoverflow.com/a/867093/60462.