简体   繁体   English

target.SUFFIX 在 Makefile 中是否有任何意义?

[英]Does the target .SUFFIX have any meaning in a Makefile?

In a Makefile I encountered:在 Makefile 我遇到:

.SUFFIX: .c

Is that a misspelling of .SUFFIXES: .c , because I can't find anything about .SUFFIX only.这是.SUFFIXES: .c的拼写错误吗,因为我找不到任何关于.SUFFIX的信息。 Does this do anything at all?这有什么作用吗?

If the Makefile only uses pattern rules, do I even need that hanging around in the Makefile at all?如果 Makefile 只使用模式规则,我什至需要在 Makefile 中徘徊吗?

Assuming you are using GNU make, unless there is really a user target named .SUFFIX , this is probably a misspelling of .SUFFIXES: .c .假设您使用的是 GNU make,除非确实有一个名为.SUFFIX的用户目标,否则这可能是.SUFFIXES: .c的拼写错误。 And if there is no recipe you can safely remove it: without a recipe it's useless.如果没有食谱,您可以安全地删除它:没有食谱,它是无用的。

If it was .SUFFIXES: .c and if it had a recipe it would redefine the implicit rules for:如果它是.SUFFIXES: .c并且如果它有一个配方,它将重新定义以下隐含规则:

%: %.c
    <recipe>

which is:这是:

LINK.c = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)

%: %.c
    $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM