diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..75372ac --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +COLITUR := colitur +PREFIX ?= $(HOME)/.local +BINDIR := $(PREFIX)/bin +MANDIR := $(PREFIX)/share/man/man1 + +# The binary locates its calendar data relative to its own path +# (<prefix>/share/colitur/ef), so `dune install` -- not a hand-rolled copy -- +# is what places the four .sexp files where a running colitur will look for +# them. See bin/main.ml's own [data_dir] for the full resolution order. +# +# dune needs the project-local opam switch on PATH. Every recipe that invokes +# dune goes through this, so `make` works from a plain shell with no +# `eval $(opam env)` first -- which is the whole point of having a Makefile +# over documenting the dune commands. +DUNE := opam exec -- + +.PHONY: help build test check install uninstall reinstall clean fmt man doc +help: ## show this help + @grep -hE '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed -E 's/:.*## /\t/' | sort + +build: ## build the binary + $(DUNE) dune build + +test: ## fast suite (~5s): properties sample 200 years + $(DUNE) dune test + +check: ## full gate (~2min): every year 1583-9999, not a sample + COLITUR_EXHAUSTIVE_SWEEP=1 $(DUNE) dune test --force + +install: build ## install binary, calendar data and man page into PREFIX (default ~/.local) + $(DUNE) dune install --prefix $(PREFIX) + @mkdir -p $(MANDIR) + install -m 644 man/colitur.1 $(MANDIR)/colitur.1 + @echo "installed $(BINDIR)/$(COLITUR), data in $(PREFIX)/share/colitur/ef, man page in $(MANDIR)" + @command -v $(COLITUR) >/dev/null 2>&1 || \ + echo "note: $(BINDIR) is not on PATH -- add it, or run $(BINDIR)/$(COLITUR) directly" + +uninstall: ## remove everything install put into PREFIX + -$(DUNE) dune uninstall --prefix $(PREFIX) + rm -f $(MANDIR)/colitur.1 + @echo "removed $(COLITUR) from $(PREFIX)" + +reinstall: uninstall install ## uninstall then install (the installed copy is a snapshot, not a link) + +man: ## preview the man page + man -l man/colitur.1 + +doc: ## lint the man page (groff warnings; silence means clean) + groff -man -Tutf8 -ww -z man/colitur.1 + +fmt: ## format the OCaml sources + $(DUNE) dune build @fmt --auto-promote + +clean: ## remove build artifacts + $(DUNE) dune clean |
