General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.3 KiB

3 years ago
3 years ago
  1. CXX= clang++
  2. CXXFLAGS= --std=c++20 -O0 -g -pthread -DGP_TESTS -DFUZZ_STRENGTH=100 -DNO_BENCH=1 -pedantic \
  3. -fprofile-instr-generate -fcoverage-mapping -Wno-unknown-attributes -fno-omit-frame-pointer \
  4. -DCATCH_EXCEPTIONS=1
  5. # -fsanitize=address -fsanitize-blacklist=blacklist.txt
  6. EVERY_USEFUL_FILE= $(shell find include/ -name "*.hpp" -type "f")
  7. EVERY_TEST_FILE= $(shell find tests/ -name "*.cpp" -type "f")
  8. TEST_OBJECTS := $(EVERY_TEST_FILE:%.cpp=bin/obj/%.test.o)
  9. all: tests
  10. bin/obj/%.test.o: %.cpp $(EVERY_USEFUL_FILE)
  11. @mkdir -p $(@D)
  12. $(CXX) $(CXXFLAGS) -DUSE_CATCH -Itests -Iinclude -o $@ -c $<
  13. docs: $(EVERY_USEFUL_FILE)
  14. doxygen doxy.config
  15. tests: bin/tests
  16. LLVM_PROFILE_FILE="./bin/tests.profraw" ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ./bin/tests
  17. @llvm-profdata merge -sparse ./bin/tests.profraw -o ./bin/tests.profdata
  18. @llvm-cov report ./bin/tests -instr-profile=./bin/tests.profdata $(EVERY_USEFUL_FILE)
  19. @llvm-cov report ./bin/tests -instr-profile=./bin/tests.profdata $(EVERY_USEFUL_FILE) | tail -n 1 | tr -s " " | sed -e 's/ /,/g' -- | awk -F "," '{print $$9}' | sed -e 's/^/Untested lines: /g'
  20. bin/tests: tests.cpp $(TEST_OBJECTS) $(EVERY_USEFUL_FILE) ./tests/test_scaffold.h
  21. @mkdir -p $(@D)
  22. $(CXX) $(CXXFLAGS) -Itests -Iinclude tests.cpp $(TEST_OBJECTS) -o $@
  23. clean: ./bin
  24. @rm -rf $<