Reimplementation of Pijul in C, for education, fun and absolutely no profit
# Based quite a bit on https://nullprogram.com/blog/2017/08/20/

.POSIX:
.SUFFIXES:

# Set our default programs
RM = rm -rf
FIND = find
ETAGS = etags
NINJA = samu
MESON = muon
B = build

build:
	@$(NINJA) -C $(B) ani
setup:
	@$(MESON) setup $(B)
clean:
	@$(NINJA) -C $(B) -t clean
graph:
	@$(NINJA) -t graph ani | dot -Tpng -o depgraph.png

fmt:
	@$(NINJA) -C $(B) clang-format

check:
	@cd $(B) && $(MESON) test

check2: build
	build/ani change YM2LC6QP2D7TK3JUKOXWUWTQEGMCEGQDGPTOZPWC3BRDFNRKSZWQC # this one has file additions

etags:
	$(FIND) . \
		\( -name .git -type d -prune \) \
		\( -name .pijul -type d -prune \) \
		-o \( -name build -type d -prune \) \
		-o \( -name '*.[hc]' -type f -print \) \
		| sed -e 's|^\./||' \
		| xargs $(ETAGS) -a -o TAGS

.PHONY: clean fmt build graph check etags