简体   繁体   中英

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

In a Makefile I encountered:

.SUFFIX: .c

Is that a misspelling of .SUFFIXES: .c , because I can't find anything about .SUFFIX only. 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?

Assuming you are using GNU make, unless there is really a user target named .SUFFIX , this is probably a misspelling of .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:

%: %.c
    <recipe>

which is:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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