commit 0a6f7475a550b18006da931f6b098b6f785bbf2b
parent 900ed3f87ef94e1ba1382ae46241fdd6514ea361
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Sat, 25 Apr 2026 17:07:35 -0700
make: add cloc target for core source line counts
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -25,6 +25,7 @@
# make tools bootstrap M0/hex2-0/catm for ARCH
# make tables regen pre-pruned P1/P1-<arch>.M1 tables
# make tools-native build host-native M1/hex2/m1pp (opt-in)
+# make cloc line counts for the core sources
# make clean rm -rf build/
ARCH ?= aarch64
@@ -61,13 +62,26 @@ PODMAN = podman run --rm --pull=never --platform $(PLATFORM_$(1)) \
# --- Targets --------------------------------------------------------------
.PHONY: all m1pp pokem hello scheme1 run test image tools tables \
- tools-native clean help
+ tools-native cloc clean help
all: m1pp pokem
help:
@sed -n '/^# Common entrypoints:/,/^$$/p' Makefile | sed 's/^# *//'
+CLOC_FILES := M1pp/M1pp.P1 \
+ $(foreach a,$(ALL_ARCHES),P1/P1-$(a).M1pp) \
+ P1/P1.M1pp \
+ scheme1/scheme1.P1pp
+
+cloc:
+ @total=0; for f in $(CLOC_FILES); do \
+ n=$$(grep -v "^ZERO.*" $$f | grep -v "^\s*#.*" | grep -v "^$$" | wc -l); \
+ printf '%6d %s\n' $$n $$f; \
+ total=$$((total + n)); \
+ done; \
+ printf '%6d total\n' $$total
+
clean:
rm -rf build/