Makefile模式规则无扩展名吗? [英] Makefile pattern rule for no extension?
本文介绍了Makefile模式规则无扩展名吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一堆使用相同类型的make规则构建的应用程序:
I have a bunch of applications that are built with the same type of make rule:
apps = foo bar baz
all: $(apps)
foo: foo.o $(objects)
$(link)
bar: bar.o $(objects)
$(link)
baz: baz.o $(objects)
$(link)
如果他们有扩展名(例如.x
),我可以制定一个模式规则,例如:
If they had an extension (for example .x
) I could make a pattern rule like:
%.x: %.o $(objects)
$(link)
,我不必为每个应用程序写出新规则.
and I wouldn't have to write out a new rule for each app.
但是他们没有扩展名,我很确定:
But they don't have an extension, and I'm pretty sure that:
%: %.o $(objects)
$(link)
不起作用(因为它指定要构建任何文件,您可以使用此规则).
won't work (because it specifies that to build any file you can use this rule).
无论如何,是否要指定一条规则来覆盖所有$(apps)
生成规则?
Is there anyway to specify one rule that will cover all the $(apps)
build rules?
推荐答案
这似乎是 查看全文