diff --git a/.gitignore b/.gitignore index 09609c0..1145e15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ #Ignore the Visual Studio Code settings .vscode/* #Ignore the executables +bin/ *.exe +#Ignore all build logs +logs/ diff --git a/makefile b/makefile new file mode 100644 index 0000000..5580a57 --- /dev/null +++ b/makefile @@ -0,0 +1,43 @@ +NUMCORES = $(shell grep -c "^processor" /proc/cpuinfo) +NUMCORESWIN = ${NUMBER_OF_PROCESSORS} +TESTFLAGS = -O2 -std=c++20 -Wall -fcoroutines +LINKEDLIBS = -lgmp -lgmpxx +INCLUDE_DIR = ./headers/mee +TESTDIR = ./test/mee +BINDIR = ./bin +LOGDIR = ./logs + + +all: testMulti +test: directory testAlgorithms testStopwatch testDice +testAlgorithms: testNumberAlgorithms testStringAlgorithms testVectorAlgorithms +testMulti: directory + $(MAKE) testAlgorithms testStopwatch testDice -j $(NUMCORESWIN) + @echo 'All tests completed successfully' + + +#Non-build jobs +directory: + mkdir -p $(BINDIR) $(LOGDIR) + +#Algorithms +test%Algorithms: $(TESTDIR)/test%Algorithms.cpp + $(CXX) $(TESTFLAGS) -o $(BINDIR)/$@.exe $< -I $(INCLUDE_DIR) $(LINKEDLIBS) + $(BINDIR)/$@.exe > $(LOGDIR)/$@.txt + +#Stopwatch +testStopwatch: $(TESTDIR)/testStopwatch.cpp + $(CXX) $(TESTFLAGS) -o $(BINDIR)/$@.exe $< -I $(INCLUDE_DIR) $(LINKEDLIBS) + $(BINDIR)/$@.exe > $(LOGDIR)/$@.txt + +#Dice +testDice: $(TESTDIR)/testDice.cpp + $(CXX) $(TESTFLAGS) -o $(BINDIR)/$@.exe $< -I $(INCLUDE_DIR) $(LINKEDLIBS) + $(BINDIR)/$@.exe > $(LOGDIR)/$@.txt + +#Clean up/Remove all files and folders created +.PHONY: clean + +clean: + rm -f $(BINDIR)/* $(LOGDIR)/* + rmdir $(BINDIR) $(LOGDIR)