summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile32
1 files changed, 27 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index fa5f19a..7c9868b 100644
--- a/Makefile
+++ b/Makefile
@@ -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