I've made minimum reproducible example to learn Makefile syntax but I still receive syntax error
Makefile:16: *** missing separator. Stop.
I've tried a number of examples but still receive separator error, over and over again
The minimum reproducible example of the Makefile with separator error looks as follows:
TARGET=ice
CC=gcc
SOURCES = \
src/main.c \
driver/driver.c \
INCLUDES=\
-Iinclude \
OBJECTS = $(SOURCES:.c=.o)
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^
%.o: %.c
$(CC) $(INCLUDES) -c $@ -o $<
clean:
rm $(TARGET)
.PHONY: all good clean
I've made a little progress by writing Makefile in "gedit" rather than "sublime 3"
OK, so the same Makefile syntax but now I have this syntax error
[root][ice] $ make
gcc -Iinclude -c src/main.o -o src/main.c
gcc: error: src/main.o: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Makefile:19: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1
OK I've fixed Just corrected Makefile this way
%.o: %.c
$(CC) $(INCLUDES) -c -o $@ $<
Thanks for the help