Domain changed to archive.palanq.win . Feb 14-25 still awaits import.
[7 / 1 / ?]

How am I supposed to use Makefiles?

No.733035 View ViewReplyOriginalReport
I know how to use them but I feel like I don't yet get what their main purpose is.

FLAGS=-Wall
PROG=prog

build: src/main.c
mkdir -p obj/
gcc $(FLAGS) -c -o obj/main.o src/main.c

link: obj/main.o
gcc $(FLAGS) -o $(PROG) obj/main.o

clean:
if [ -d obj/ ]; then rm -r obj/; fi
if [ -f $(PROG) ]; then rm $(PROG); fi


Is this how I'm supposed to do it or is there a better way?