diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2014-03-05 18:33:58 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2014-03-05 18:39:20 +0100 |
commit | 52d3c1ee76061fc6ca767ac7a5521a12f6ec84b1 (patch) | |
tree | b317fbb09ae438e474fdb68ca99a86d7d4fcd33c | |
parent | c14c190414c1336643cd7d0c29f0626ccc7dea6d (diff) |
Rewrite the Makefile to make it more reusable
-rw-r--r-- | Makefile | 32 |
1 files changed, 27 insertions, 5 deletions
@@ -1,9 +1,31 @@ -CC = gcc -CFLAGS = -Wall -W -std=c99 -g -god_hands_solver: god_hands.o +CC ?= gcc +CFLAGS += -W -Wall -std=gnu99 -Wextra +LDFLAGS += +NAME = god_hands_solver +SRC = god_hands.c + +all: depend $(NAME) + +depend: .depend + +.depend: $(SRC) + @$(RM) .depend + @$(CC) $(CFLAGS) -MM $^ > .depend + +include .depend + +OBJ = $(SRC:.c=.o) + +$(NAME): $(OBJ) $(CC) -o $@ $^ $(LDFLAGS) -god_hands.o: god_hands.c - $(CC) -o $@ -c $< $(CFLAGS) +clean: + $(RM) $(OBJ) + +fclean: clean + $(RM) $(NAME) + +re: fclean all +.PHONY: all depend clean fclean all re |