Created make file to make testing easier

This commit is contained in:
2021-07-02 21:59:12 -04:00
parent 5cf20b539a
commit e377f4d585
2 changed files with 46 additions and 0 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,7 @@
#Ignore the Visual Studio Code settings
.vscode/*
#Ignore the executables
bin/
*.exe
#Ignore all build logs
logs/

43
makefile Normal file
View File

@@ -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)