aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorlectio <lukasz@arcofasiagroup.com>2026-07-28 22:07:21 +0200
committerlectio <lukasz@arcofasiagroup.com>2026-07-28 22:07:45 +0200
commit42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1 (patch)
treeeb135eae4d3374973c08b27956a6e067a95e56bc /Makefile
downloadclectio-42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1.tar.gz
clectio-42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1.zip
clectio: tiny suckless C daily readings, all readings compiled in
clectio prints the Catholic liturgical day and its Mass readings for a date with a single table lookup -- no computation, config file, network, or deps beyond libc. The calendar, reading citations and scripture text are all compiled in; the whole shipped package fits on a 1.44 MB floppy (~1.29 MiB) and the binary is ~0.9 MB (OF) / ~0.3 MB (EF). - suckless config.h: FORM_OF/FORM_EF, SIGLA_ENGLISH/SIGLA_LATIN, COLOR. - Bring your own Bible: `make CORPUS=mybible.tsv` recompiles with any Vulgate-numbered 6-column TSV; only the ~12k cited verses are embedded. - The hard liturgical logic stays in lectio (Go, oracle-validated); its clectio-gen emits the corpus-independent tables in gen/. The scripture text is LZSS-packed (lz.h) to fit; mktext/bin2h resolve+embed it at build time. - Verified byte-identical to lectio's readings; day names match 157/157 over a 3-year sample. Default text: public-domain Latin Vulgate. ISC-licensed. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..fb6d964
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+# clectio -- tiny, fast, suckless daily readings
+# Configure by editing config.h (copied from config.def.h on first build).
+
+CC = cc
+CFLAGS = -std=c99 -Os -Wall -Wextra
+LDFLAGS = -s
+PREFIX = /usr/local
+
+# The form to build is read from config.h so there is one source of truth.
+FORM := $(shell grep -Eq '^[[:space:]]*\#[[:space:]]*define[[:space:]]+FORM_EF' config.h 2>/dev/null && echo ef || echo of)
+# Bring your own Bible: `make CORPUS=/path/to/mybible.tsv` (same 6-column TSV
+# format as gen/, Vulgate-numbered). Empty = use the shipped Vulgate text.
+CORPUS ?=
+
+.PHONY: all clean size install uninstall
+
+all: clectio
+
+config.h:
+ cp config.def.h config.h
+
+mktext: mktext.c lz.h
+ $(CC) $(CFLAGS) -o $@ mktext.c
+
+bin2h: bin2h.c
+ $(CC) $(CFLAGS) -o $@ bin2h.c
+
+# With CORPUS set, repack the text for the chosen form from that corpus;
+# otherwise the shipped text_<form>.lz (default Vulgate) is used as-is. The
+# verse keys ship gzipped (they are only needed here), so unpack them first.
+ifneq ($(CORPUS),)
+gen/verses_$(FORM).keys: gen/verses_$(FORM).keys.gz
+ gzip -dc $< > $@
+text_$(FORM).lz: mktext gen/verses_$(FORM).keys $(CORPUS)
+ ./mktext gen/verses_$(FORM).keys $(CORPUS) $@
+endif
+
+text.lz.h: bin2h text_$(FORM).lz
+ ./bin2h text_$(FORM).lz > $@
+
+clectio: clectio.c config.h text.lz.h gen/liturgy_$(FORM).h lz.h
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ clectio.c
+
+size: clectio
+ @ls -l clectio | awk '{printf "clectio (%s): %d bytes = %.0f KB\n","$(FORM)",$$5,$$5/1024}'
+
+install: clectio
+ install -Dm755 clectio $(DESTDIR)$(PREFIX)/bin/clectio
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/clectio
+
+clean:
+ rm -f clectio mktext bin2h text.lz.h gen/verses_of.keys gen/verses_ef.keys