From 9173f51b8709908369a43655d578a83c0907bfab Mon Sep 17 00:00:00 2001
From: Or Almog <almogo@mcmaster.ca>
Date: Mon, 24 Oct 2016 17:46:58 -0400
Subject: [PATCH] Things almost work in the makefile world

---
 src/.recall                                   |  5 +--
 src/.srcmv                                    |  2 +
 src/makefile                                  | 42 ++++++++++++-------
 src/test/{armor.test.cpp => test.armor.cpp}   |  2 +-
 src/test/{main.test.cpp => test.main.cpp}     |  4 +-
 .../{testable.test.cpp => test.testable.cpp}  |  0
 6 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100755 src/.srcmv
 rename src/test/{armor.test.cpp => test.armor.cpp} (92%)
 rename src/test/{main.test.cpp => test.main.cpp} (76%)
 rename src/test/{testable.test.cpp => test.testable.cpp} (100%)

diff --git a/src/.recall b/src/.recall
index db634d2..43779ee 100755
--- a/src/.recall
+++ b/src/.recall
@@ -1,6 +1,5 @@
 #!/bin/bash
-if [ -d "temp" ]; then
+if [ -d ".srcstore" ]; then
 	rm -f *.cpp
-	cp temp/*.cpp .
-	rm -rf temp/
+	cp .srcstore/*.cpp .
 fi
diff --git a/src/.srcmv b/src/.srcmv
new file mode 100755
index 0000000..c50de1c
--- /dev/null
+++ b/src/.srcmv
@@ -0,0 +1,2 @@
+#!/bin/bash
+for FILENAME in *.cpp; do mv $FILENAME src.$FILENAME; done
diff --git a/src/makefile b/src/makefile
index d0e4e34..c58368a 100644
--- a/src/makefile
+++ b/src/makefile
@@ -1,37 +1,51 @@
-source: *.cpp
+
+.PHONY: default clean recall link compile ready
+
+default: link
+
+ready:
 
 	#Setting up...
 
+	@#Bring over the libtcod reqs
 	@cp ./libtcod/*.so .
 
-	@rm -rf temp/
-	@mkdir temp
-	@cp *.cpp temp/
+	@#Copy to the srcstore
+	@rm -rf .srcstore/
+	@mkdir .srcstore
+	@cp *.cpp .srcstore/
 
-	@bash .hiddenmv
+	@#Rename to src.*
+	@bash .srcmv
 
+	@#Bring over the tests
 	@cp test/*.cpp .
 
+compile: ready
+
 	#Compiling...
 	@g++ -g -c *.cpp -I./libtcod/include -L. -ltcod -ltcodxx -Wl,-rpath=. -Wall -std=c++11
 
+	@# Remove *.cpp and bring back the old ones (could also just rename src.*.cpp -> *.cpp)
+	@rm -f *.cpp
+	@cp .srcstore/*.cpp .
+
+link: compile
+
 	#Linking source...
-	@g++ -g -o RogueReborn.exe zz.*.o *.so -I./libtcod/include -L. -ltcod -ltcodxx -Wl,-rpath=. -Wall -std=c++11
+	@g++ -g -o RogueReborn.exe src.*.o *.so -I./libtcod/include -L. -ltcod -ltcodxx -Wl,-rpath=. -Wall -std=c++11
 
-	@rm -f zz.main.o
+	@rm -f src.main.o
 
 	#Linking tests...
 	@g++ -g -o Test.exe *.o *.so -I./libtcod/include -L. -ltcod -ltcodxx -Wl,-rpath=. -Wall -std=c++11
 
-	#Cleaning up...
-	@rm -f *.o *.cpp
-	@cp temp/*.cpp .
+	#Removing objects
+	@rm -f *.o
+
 
 recall:
 	@bash .recall
 
 clean:
-	@rm -f *.exe *.so *.o
-	@rm -f scores.txt
-
-default: source
\ No newline at end of file
+	@rm -f *.exe *.so *.o scores.txt
\ No newline at end of file
diff --git a/src/test/armor.test.cpp b/src/test/test.armor.cpp
similarity index 92%
rename from src/test/armor.test.cpp
rename to src/test/test.armor.cpp
index 17ede42..5c6742c 100644
--- a/src/test/armor.test.cpp
+++ b/src/test/test.armor.cpp
@@ -7,7 +7,7 @@
 #include <iostream>
 
 #include "include/armor.h"
-#include "testable.test.cpp"
+#include "test.testable.cpp"
 
 class ArmorTest : public Testable {
 	public:
diff --git a/src/test/main.test.cpp b/src/test/test.main.cpp
similarity index 76%
rename from src/test/main.test.cpp
rename to src/test/test.main.cpp
index ff085bf..093b11f 100644
--- a/src/test/main.test.cpp
+++ b/src/test/test.main.cpp
@@ -5,8 +5,8 @@
 #include <vector>
 #include <iostream>
 
-#include "armor.test.cpp"
-#include "testable.test.cpp"
+#include "test.armor.cpp"
+#include "test.testable.cpp"
 
 
 int main(){
diff --git a/src/test/testable.test.cpp b/src/test/test.testable.cpp
similarity index 100%
rename from src/test/testable.test.cpp
rename to src/test/test.testable.cpp
-- 
GitLab