A question about makefile

Plotto 2002-09-05 04:58:17
What is the meaning of $@ and $^ in the makefile?
Thx
...全文
40 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
liubear 2002-09-07
  • 打赏
  • 举报
回复
上位讲得很清楚了
greysky123 2002-09-05
  • 打赏
  • 举报
回复
举个例子吧:
CC=gcc
CFLAGS=-Wall
COMPILE=$(CC) $(CFLAGS) -c

all: myprogram

myprogram: test.o
$(CC) -o myprogram test.o
%.o: %.c
$(COMPILE) -o $@ $<

//这里“$@”代替了目标文件名即test.o,“$<”代替了要编译的文件名即test.c,这样清楚么?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧