+ -
当前位置:首页 → 问答吧 → makefile初学者问题:依赖文件与依赖目录

makefile初学者问题:依赖文件与依赖目录

时间:2011-10-22

来源:互联网

SUBDIRS:= tools dirs mm
target:=trs
objs=$(foreach dir,$(SUBDIRS),$(wildcard $(dir)/*.o)) #这里用到了递归赋值
.PHONY:$(SUBDIRS)
$(target):$(SUBDIRS)
  gcc -I./inc $(objs) -o $@

请问
$(target):$(SUBDIRS)
  gcc -I./inc $(objs) -o $@
展开后是不是
trs:tools dirs mm
  用gcc命令产生.o文件
请问tools dirs mm应该是依赖文件名称,对吗?单其实tools dirs mm是文件的目录,所以理解不了。请高手指点。

target ... : prerequisites ...
command
prerequisites 就是,要生成那个 target 所需要的文件或是目标,但是上列中是目录?

作者: clleady   发布时间: 2011-10-22

是目标,但是不是最终目标。

但是command可以正确执行,所以是可以的。

作者: linwhwylb   发布时间: 2011-10-22

mark

作者: delphiwcdj   发布时间: 2011-10-22

热门下载

更多