What is the leading “@” at the recipe of a makefile

守給你的承諾、 提交于 2019-12-11 03:12:41

问题


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 "$<" "$@".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.


回答1:


The @ prefix causes make to run the command silently. See this section of the GNU make manual.




回答2:


The @ suppresses echoing the command when running the recipe, see https://stackoverflow.com/a/867093/60462.



来源:https://stackoverflow.com/questions/8708537/what-is-the-leading-at-the-recipe-of-a-makefile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!