brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 2a256f0 Raw
97 lines · plain
1# This is for developers' convenience and not expected to be in build steps.2#3# Usage:4#   cd /path/to/llvm-project/llvm/test/tools/llvm-cov/Inputs5#   PATH=/path/to/build/bin:$PATH make -f yaml.makefile6 7CFLAGS_COVMAP	= -fcoverage-compilation-dir=. \8		  -mllvm -runtime-counter-relocation=true \9		  -mllvm -conditional-counter-update=true \10		  -mllvm -enable-name-compression=false \11		  -fprofile-instr-generate -fcoverage-mapping \12		  $(if $(filter mcdc-%, $*), $(CFLAGS_MCDC))13 14CFLAGS_MCDC	= -fcoverage-mcdc15 16%.o: %.cpp17	clang++ $< -c -o $@ $(CFLAGS_COVMAP)18 19%.o: %.c20	clang $< -c -o $@ $(CFLAGS_COVMAP)21 22%-single.o: %.cpp23	clang++ $< -c -o $@ \24		-mllvm -enable-single-byte-coverage=true \25		$(CFLAGS_COVMAP)26 27%-single.o: %.c28	clang $< -c -o $@ \29		-mllvm -enable-single-byte-coverage=true \30		$(CFLAGS_COVMAP)31 32%.covmap.o: %.o33	llvm-objcopy \34		--only-section=__llvm_covfun \35		--only-section=__llvm_covmap \36		--only-section=__llvm_prf_names \37		--strip-unneeded \38		$< $@39 40%.yaml: %.covmap.o41	obj2yaml $< > $@42 43%.exe: %.o44	clang++ -fprofile-instr-generate $^ -o $@45 46ARGS_branch-logical-mixed := \47	0 0; \48	0 1; \49	1 0; \50	1 151 52ARGS_branch-macros := \53	0 1; \54	1 0; \55	1 156 57ARGS_branch-showBranchPercentage := \58	0 1; \59	1 1; \60	2 2; \61	4 0; \62	5 0; \63	164 65ARGS_showLineExecutionCounts := $(patsubst %,%;,$(shell seq 161))66 67ARGS_mcdc-const-folding := \68	0 1; \69	1 0; \70	1 1; \71	1 172 73%.profdata: %.exe74	-find -name '$*.*.profraw' | xargs rm -fv75	@if [ "$(ARGS_$(patsubst %-single,%,$*))" = "" ]; then \76	  echo "Executing: $<"; \77	  LLVM_PROFILE_FILE=$*.%p%c.profraw ./$<; \78	else \79	  LLVM_PROFILE_FILE=$*.%p%c.profraw; \80	  export LLVM_PROFILE_FILE; \81	  for xcmd in $(shell echo "$(ARGS_$(patsubst %-single,%,$*))" | tr ';[:blank:]' ' %'); do \82	    cmd=$$(echo "$$xcmd" | tr '%' ' '); \83	    echo "Executing series: $< $$cmd"; \84	    eval "./$< $$cmd"; \85	  done; \86	fi87	find -name '$*.*.profraw' | xargs llvm-profdata merge --sparse -o $@88 89%.proftext: %.profdata90	llvm-profdata merge --text -o $@ $<91 92.PHONY: all93all:	\94	$(patsubst %.yaml,%.proftext, $(wildcard *.yaml)) \95	$(wildcard *.yaml)96	-find -name '*.profraw' | xargs rm -f97