EMACS := emacs
VERSION = $(shell sed -ne 's/^;; Version: \(.*\)/\1/p' buttercup.el)
DISTFILES = buttercup.el buttercup-compat.el buttercup-pkg.el README.md


.PHONY: test

all: test

test:
	$(EMACS) -batch -L . -l buttercup.el -f buttercup-run-markdown docs/writing-tests.md
	./bin/buttercup -L .

compile:
	$(EMACS) -batch -L . -f batch-byte-compile *.el

release: clean test
	mkdir -p dist
	tar -c $(DISTFILES) --transform "s,^,buttercup-$(VERSION)/," --transform 's/README.md/README.txt/' > "dist/buttercup-$(VERSION).tar"

clean:
	rm -f *.elc
