summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-08-06 00:46:50 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-08-06 00:46:50 +0100
commit477a1ca6d086b9ee783a0465acf443d4211bc073 (patch)
treee9c6db2c4e2e1814e496a60d67b80f4ebbf8df5d
parente2bfa9c2ac08a5ae5ae0b151a744b2e35c70993b (diff)
god_hands_solver: use the new version of the Makefile
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--Makefile38
1 files changed, 21 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index f96eb32..a571f6c 100644
--- a/Makefile
+++ b/Makefile
@@ -14,33 +14,37 @@
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-CC ?= gcc
-CFLAGS += -W -Wall -std=gnu99 -Wextra
-LDFLAGS +=
-NAME = god_hands_solver
-SRC = god_hands.c
+NAME = god_hands_solver
+SRC = $(wildcard *.c)
-all: depend $(NAME)
+CPPFLAGS =
+LDFLAGS =
+CFLAGS = -W -Wall -Wextra -std=gnu99
-depend: .depend
+CC = gcc
-.depend: $(SRC)
- @$(RM) .depend
- @$(CC) $(CFLAGS) -MM $^ > .depend
+OBJ = $(SRC:.c=.o)
+DEP = $(SRC:.c=.d)
--include .depend
-
-OBJ = $(SRC:.c=.o)
+all: $(NAME)
$(NAME): $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
+-include $(DEP)
+
+%.d: %.c
+ $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT "$*.o $@"
+
clean:
$(RM) $(OBJ)
-
-fclean: clean
$(RM) $(NAME)
-re: fclean all
+mrproper: clean
+ $(RM) $(DEP)
+
+distclean: mrproper
+ $(RM) $(addsuffix ~,$(SRC))
+ $(RM) $(wildcard $(addsuffix .sw*,$(addprefix .,$(SRC))))
-.PHONY: all depend clean fclean all re
+.PHONY: all clean mrproper distclean