makefile 中的变量目标
我正在尝试编译一组目标。然而它似乎只做了第一个。下面是显示错误的我的 makefile 的删减。
OBJECTS = abc def ghi
SOURCES = abc.c def.c ghi.c
$(OBJECTS): $(SOURCES)
@echo target is $@, source is $<
在 shell 中,
$ touch abc.c def.c ghi.c
$ make
当我运行 make 时,我得到以下输出:
target is abc, source is abc.c
所以它似乎只运行第一个目标。
如果我替换 $<使用 $^,输出为:
target is abc, source is abc.c def.c ghi.c
我的问题,是否可以像 (%: %) 模式那样对变量执行扩展?
I am trying to compile set of targets. However it only seems to do the first one. Below is a cut down of the my makefile that shows the error.
OBJECTS = abc def ghi
SOURCES = abc.c def.c ghi.c
$(OBJECTS): $(SOURCES)
@echo target is $@, source is lt;
In shell,
$ touch abc.c def.c ghi.c
$ make
When I run make I get the following output:
target is abc, source is abc.c
So it only seems to be running the first target.
If I replace $< with $^, the output is:
target is abc, source is abc.c def.c ghi.c
My question, is it possible to perform expansions on variables like with the (%: %) pattern?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
问题是
Try this:
The trouble was