From 2947dae6055a763bf1e6b569e501afdfbf5dd05b Mon Sep 17 00:00:00 2001 From: xinkong <2954085068@qq.com> Date: Mon, 2 Jun 2025 11:14:39 +0800 Subject: [PATCH] ADD file via upload --- Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bdcc07b --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +CC = clang +CXX = clang++ +CFLAGS = -fprofile-instr-generate -fcoverage-mapping -fcoverage-mcdc +CXXFLAGS = -std=c++17 -isystem /usr/include/gtest -pthread -fprofile-instr-generate -fcoverage-mapping +LDFLAGS = -pthread +LIBS = /usr/local/lib/libgtest.a /usr/local/lib/libgtest_main.a + +all: html + +clean: + rm -rf test default.profraw math_functions.o test.profdata output + +html: test + ./test + llvm-profdata merge -sparse default.profraw -o test.profdata + llvm-cov report ./test -instr-profile=test.profdata -show-mcdc-summary + llvm-cov show ./test -instr-profile=test.profdata -show-mcdc-summary -format=html -output-dir=./output + +test: math_functions.o test.cpp + $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@ + +math_functions.o: math_functions.c math_functions.h + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY: all clean html \ No newline at end of file