# Configure compiler settings
CXX=clang++
CXXFLAGS=-g
# The object files for the crypto program.
OFILES = 
# UnitTest++ keeps its object files in this directory.
UNITTEST_OFILES = "unittest-cpp/CMakeFiles/UnitTest++.dir/UnitTest++/"

# This prevents Make from deleting our object files after they are built.  This
# isn't necessary, but it helps to avoid rebuilding code that didn't change.
.PRECIOUS: %.o

# This target builds your tests.
tests: unittest-cpp/ tests.o $(OFILES)
	$(CXX) $(CXXFLAGS) -o $@ tests.o $(OFILES) $(UNITTEST_OFILES)/*.o $(UNITTEST_OFILES)/Posix/*.o

# This target describes how to compile a .o file from a .cpp file.
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c -o $@ $<

# This target performs the one-time download and compile of UnitTest++ so we can
# use it in this lab.
unittest-cpp/:
	git clone https://github.com/unittest-cpp/unittest-cpp
	cd unittest-cpp && cmake ./ && $(MAKE)

# This target deletes the temporary files we have built.
.PHONY: clean
clean:
	rm -f *.o
	rm -f ./crypto
	rm -f ./tests
	rm -f ./test_output/*

# This target deletes everything, including the copy of UnitTest++ we
# downloaded.
.PHONY: clean-all
clean-all: clean
	rm -rf unittest-cpp/
