请解释$ @ $^$在makefile下面makefile文件别名
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
# (This should be the actual list of C files)
SRC=$(wildcard '*.c')
test: $(SRC)
gcc -o [email protected] $^ $(CFLAGS) $(LIBS)
请解释$ @ $^$在makefile下面makefile文件别名
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
# (This should be the actual list of C files)
SRC=$(wildcard '*.c')
test: $(SRC)
gcc -o [email protected] $^ $(CFLAGS) $(LIBS)
这就是这两个符号的意思是:
test
SRC=$(wildcard '*.c')
中指定的扩展通配符列表)所有这些变量都在GNU make手册的Automatic variables page中解释。
什么是'扩展在SRC = $(通配符'* .c')中指定的通配符列表是什么意思?它只是导致''* .c''? – naught101 2014-04-07 06:21:48
啊,它是[文件匹配通配符](https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html#Wildcard-Function)。 – naught101 2014-04-07 12:19:37
@ naught101它在答案*通配符列表*中明确陈述,想象一下通配符的shell glob ... :) – t0mm13b 2014-04-07 12:21:52
SRC=$(wildcard '*.c')
这只是所有的源文件名中
test: $(SRC)
gcc -o [email protected] $^ $(CFLAGS) $(LIBS)
$以.c即在file1.c,file2.c中file3.c中等等
结束是一种定义变量在Makefile中
$ @是你的目标,在你的情况下它是“测试”。
$ ^是规则的所有先决条件,包括在他们被发现
$ <是所有依赖的列表目录的名称列表
裁判:https://www.gnu.org/software/make/manual/make.html#Automatic-Variables
可能重复的[makefile符号$ @和$ <是什么意思?](http://stackoverflow.com/questions/3220277/what-do-the-makefile-symbols-and-mean) – 2015-05-26 13:58:30