Commit f162026

mo khan <mo@mokhan.ca>
2015-01-03 23:20:49
tease apart the make test target.
1 parent 4301811
Changed files (2)
.gitignore
@@ -1,3 +1,4 @@
 *.out
 *.dSYM
+*.o
 bin
Makefile
@@ -1,16 +1,27 @@
-CFLAGS=-Wall -g
+SHELL=/bin/sh
+CFLAGS=-Wall -g -std=c99
 
-default: src/*.c src/*.h
+all: src/*.c src/*.h
 	rm -fr bin
 	mkdir -p bin
-	gcc -std=c99 -o bin/game_of_life src/main.c src/world.c src/cell.c
+	$(CC) $(CFLAGS) -std=c99 -o bin/game_of_life src/main.c src/world.c src/cell.c
 	./bin/game_of_life
 
 clean:
 	rm -fr bin
 
-test: src/*.c src/*.h
-	rm -fr bin
+init:
 	mkdir -p bin
-	gcc -std=c99 -o bin/test_game_of_life src/world_test.c src/world.c src/cell.c
+
+test: cell.o world.o world_test.o
+	$(CC) $(CFLAGS) -o bin/test_game_of_life src/world.o src/cell.o src/world_test.o
 	./bin/test_game_of_life
+
+cell.o: src/cell.c src/cell.h
+	$(CC) $(CFLAGS) -c src/cell.c
+
+world.o: src/world.c src/world.h
+	$(CC) $(CFLAGS) -c src/world.c
+
+world_test.o: src/world_test.c src/world.h
+	$(CC) $(CFLAGS) -c src/world_test.c