$@ is the name of the file being generated, and $< the first prerequisite (usually the source file). You can find a list of all these special variables in the GNU Make manual.
For example, consider the following declaration:
all: library.cpp main.cpp
In this case:
-----------------------------------------------------------------------------
Automatic Variables
For more details: https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#Automatic-Variables
$@
Target name (目標條件名), the value at the left side of the comma.
foo.o: foo.c
echo $@ Expected Result = foo.o
$<
The first prerequisite (第一條件名), the first value at the right side of the comma.
foo.o: foo.c
echo $< Expected Result = foo.c
$^
All the prerequisites (全個 list). The whole list of values at the right side of the comma.
foo.o: food.c drinks.c life.c
echo $^ Expected Result = food.c drinks.c life.c
|
Sunday, September 1, 2019
常用的 Makefile 自動變數
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment