blob: 7d54410f5955ee79e076b70f76694e6674180be7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
EMACS ?= emacs
EMACS_FLAGS = --quick --directory . --directory ..
EMACS_BATCH = "$(EMACS)" --batch $(EMACS_FLAGS)
EMACS_INTERACTIVE = "$(EMACS)" $(EMACS_FLAGS)
EL := $(wildcard *.el)
ELC := $(patsubst %.el,%.elc,$(EL))
ERT := $(filter-out test-helper.el,$(EL))
CHECKDOC_BATCH_EL := ../tools/checkdoc-batch.el
.PHONY: all
all: compile test
%.elc: %.el
$(EMACS_BATCH) --eval "(progn (setq byte-compile-error-on-warn (>= emacs-major-version 25)) (batch-byte-compile))" $<
.PHONY: test
test: test-interactive test-batch
.PHONY: test-interactive
test-interactive: compile
$(EMACS_INTERACTIVE) $(addprefix --load ,$(ERT)) --eval "(ert-run-tests-interactively (quote (tag interactive)))"
.PHONY: test-batch
test-batch: compile
$(EMACS_BATCH) $(addprefix --load ,$(ERT)) --eval "(ert-run-tests-batch-and-exit (quote (not (tag interactive))))"
.PHONY: compile
compile: $(ELC)
.PHONY: clean
clean:
rm -f $(ELC)
.PHONY: distclean
distclean: clean
rm -f $(CHECKDOC_BATCH_EL)
$(CHECKDOC_BATCH_EL):
wget --no-verbose https://download.tuxfamily.org/user42/checkdoc-batch.el --output-document=$(CHECKDOC_BATCH_EL)
.PHONY: checkdoc
checkdoc: $(CHECKDOC_BATCH_EL)
$(EMACS_BATCH) --load $(CHECKDOC_BATCH_EL) --funcall checkdoc-batch-commandline $(EL) | grep -E "el:[0-9]+:[0-9]+:" && exit 1 || exit 0
# Enables `make ledger-fontify/test-003`
define ERTDEFTEST
.PHONY: $(ERTDEF)
$(ERTDEF):
$(EMACS_BATCH) --load $(ERTFILE) --eval "(ert-run-tests-batch-and-exit (quote $(ERTDEF)))"
endef
$(foreach ERTFILE,$(ERT),$(foreach ERTDEF,$(shell grep ert-deftest $(ERTFILE)|cut -d ' ' -f 2),$(eval $(ERTDEFTEST))))
|