免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1639 | 回复: 1
打印 上一主题 下一主题

请大家帮忙解析一下这个makefile 文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-08-29 15:18 |只看该作者 |倒序浏览
makefile 文件是这样的:

CC=g++
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.cpp hello.cpp factorial.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello

all: $(SOURCES) $(EXECUTABLE)
       
$(EXECUTABLE): $(OBJECTS)
        $(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
        $(CC) $(CFLAGS) $< -o $@

菜鸟一个,有几个地方看不懂:
1、OBJECTS=$(SOURCES:.cpp=.o)  :SOURCES:.cpp=.o不知道是什么意思。

2、$< -o $@ 是不知道是什么意思,请指点一下。

论坛徽章:
0
2 [报告]
发表于 2010-08-29 17:36 |只看该作者
1.OBJECTS= SOURCES 中的内容吧。cpp替换成。o

2.$< The name of the first prerequisite. If the target got its commands from an
implicit rule, this will be the first prerequisite added by the implicit rule

$@ The file name of the target of the rule. If the target is an archive member, then
‘$@’ is the name of the archive file. In a pattern rule that has multiple targets
‘$@’ is the name
of whichever target caused the rule’s commands to be run.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP