home · contact · privacy
Made Makefile more maintainable.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 19 Jun 2013 02:50:24 +0000 (04:50 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 19 Jun 2013 02:50:24 +0000 (04:50 +0200)
Makefile

index 176bd688eea9ba5e10acc06eb4d4dce5413383ba..2107e0844173524c8d4cf5cc1ce07a21bbe2e517 100644 (file)
--- 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