summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cheri/Makefile23
1 files changed, 22 insertions, 1 deletions
diff --git a/cheri/Makefile b/cheri/Makefile
index 419fa4e1..f3a0b7e7 100644
--- a/cheri/Makefile
+++ b/cheri/Makefile
@@ -38,8 +38,18 @@ coverage_report: bisect*.out
cheri.c: $(CHERI_SAILS) $(CHERI_MAIN)
$(SAIL) -memo_z3 -O -c $^ 1> $@
+C_OPT=-O2
+GCOV_FLAGS=
cheri_c: cheri.c ../lib/sail.h Makefile
- gcc -O2 $< ../lib/*.c -lgmp -lz -I ../lib/ -o $@
+ gcc $(C_OPT) $(GCOV_FLAGS) $< ../lib/*.c -lgmp -lz -I ../lib/ -o $@
+
+# Note that for coverage purposes O1 appears optimal. O0 means lots of obviously dead code but O2 risks reducing granularity too much.
+cheri_c_gcov: C_OPT=-O1
+cheri_c_gcov: GCOV_FLAGS=-fprofile-arcs -ftest-coverage
+cheri_c_gcov: cheri_c
+
+gcovr:
+ gcovr -r . --html --html-detail -o index.html
latex_128: $(MIPS_SAIL_DIR)/prelude.sail $(CHERI_SAIL_DIR)/cheri_types.sail $(CHERI_SAIL_DIR)/cheri_prelude_128.sail
rm -rf sail_latexcc
@@ -57,6 +67,17 @@ cheri128: $(CHERI128_SAILS) $(CHERI_MAIN)
cheri128_trace: $(CHERI128_SAILS) $(CHERI_MAIN)
$(SAIL) -ocaml_trace -o $@ $^
+cheri128.c: $(CHERI128_SAILS) $(CHERI_MAIN)
+ $(SAIL) -memo_z3 -O -c $^ 1> $@
+
+cheri128_c: cheri128.c ../lib/sail.h Makefile
+ gcc $(C_OPT) $(GCOV_FLAGS) $< ../lib/*.c -lgmp -lz -I ../lib/ -o $@
+
+# Note that for coverage purposes O1 appears optimal. O0 means lots of obviously dead code but O2 risks reducing granularity too much.
+cheri128_c_gcov: C_OPT=-O1
+cheri128_c_gcov: GCOV_FLAGS=-fprofile-arcs -ftest-coverage
+cheri128_c_gcov: cheri128_c
+
LOC_FILES:=$(CHERI_SAILS) $(CHERI_MAIN)
include ../etc/loc.mk