From 680acef72a84b1d3810ffd88c06639bafd1d4b3a Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Wed, 9 May 2018 16:30:46 +0100 Subject: Add targets for counting lines in mips, cheri and riscv. Can use either sloccount or cloc. sloccount seems to be reliable but lacks a way to tell it that sail files can be treated like ocaml without renaming the files. cloc has a nicer interface is lower quality in other regards like broken ocaml support in versions shipped with Ubuntu (e.g. treats {...} as comment, no nested comments support). For sail2 syntax this is OK because we use the C parser instead which gives the same results as sloccount. --- etc/loc.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 etc/loc.mk (limited to 'etc') diff --git a/etc/loc.mk b/etc/loc.mk new file mode 100644 index 00000000..bf79a723 --- /dev/null +++ b/etc/loc.mk @@ -0,0 +1,13 @@ +TEMPDIR:=sloc_tmp +loc: $(LOC_FILES) + @rm -rf $(TEMPDIR) + @mkdir -p $(TEMPDIR) + @cp $^ $(TEMPDIR) + @for f in $(TEMPDIR)/*.sail; do mv "$$f" "$${f%.sail}.c"; done + @sloccount --details $(TEMPDIR) | grep ansic + @sloccount $(TEMPDIR) | grep ansic + rm -rf $(TEMPDIR) + +cloc: $(LOC_FILES) + cloc --by-file --force-lang C,sail $^ + -- cgit v1.2.3