I’ve been reading on Makefiles, but I’m still clueless about how to go about writing the following commands into a Makefile.
gcc -std=c89 A.c -c
gcc -std=c89 B.c -c
gcc -std=c89 C.c -c
gcc -std=c89 A.o B.o -o A
gcc -std=c89 C.o B.o -o C
A and C are dependent on B, but are separate programs.
This is what I came up with which doesnt work:
CC = gcc -std=c89
FILES = A.c B.c C.c
OUT = out
build: $(FILES)
$(CC) -o $(OUT) $(Files)
clean:
rm -f *.o core
This is a no gimmicks makefile, and what is before gcc and rm must be the ‘tab’ character, they are not spaces.