From bf4af82bde0a08823b001e731629391904f93281 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 19 Jun 2013 04:50:24 +0200
Subject: [PATCH] Made Makefile more maintainable.

---
 Makefile | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 176bd68..2107e08 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
-roguelike:
-	cc -Wall -g -o windows.o -c windows.c
-	cc -Wall -g -o draw_wins.o -c draw_wins.c
-	cc -Wall -g -o keybindings.o -c keybindings.c
-	cc -Wall -g -o readwrite.o -c readwrite.c
-	cc -Wall -g -o roguelike.o -c roguelike.c
-	cc -Wall -g -o roguelike windows.o draw_wins.o keybindings.o readwrite.o roguelike.o -lncurses
+CC=cc
+CFLAGS=-Wall -g
+TARGET=roguelike
+OBJECTS=windows.o draw_wins.o keybindings.o readwrite.o roguelike.o
+
+roguelike: $(OBJECTS)
+	$(CC) $(CFLAGS) -o roguelike $(OBJECTS) -lncurses
+
+%.o: %.c
+	$(CC) $(CFLAGS) -c $< -o $@
 
 clean:
-	rm *.o; rm roguelike
+	rm $(OBJECTS); rm roguelike
-- 
2.30.2