问题
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