что значит эта переменная? OBJECTS=$(SOURCES: .c=.o) . Что за .с=.о?

CC = gcc
CFLAGS = -c –Wall
EXECUTABLE = prog
SOURCES = main.c foo.c

OBJECTS=$(SOURCES: .c=.o)

all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE) : $(OBJECTS)
        $(CC) $(OBJECTS) –o $@
.c.o:
        $(CC) $(CFLAGS) $< -o $@
clean:
        rm–rf*.o *.exe

про знак < нашел инфу, но что за равно в переменной objects? Мое подозрение, что это задает сразу 2 зависимости одной строчкой(с .с и с .о)


Ответы (1 шт):

Автор решения: Ainar-G

Это замена суффиксов. Из стандарта:

Macro expansions using the forms $(string1[:subst1=[subst2]]) or ${string1[:subst1=[subst2]]} can be used to replace all occurrences of subst1 with subst2 when the macro substitution is performed. The subst1 to be replaced shall be recognized when it is a suffix at the end of a word in string1 (where a word, in this context, is defined to be a string delimited by the beginning of the line, a <blank>, or a <newline>). (…)
→ Ссылка