Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 2.14 KB
/
Copy pathMakefile
File metadata and controls
65 lines (50 loc) · 2.14 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
EMACS ?= emacs
BATCH = $(EMACS) -Q --batch -L . -L $(TEST_DIR)
EL_MAIN = elinit.el
EL_MODULES = elinit-core.el elinit-log.el elinit-overrides.el elinit-libexec.el elinit-sandbox.el elinit-units.el elinit-timer.el elinit-pid1.el elinit-dashboard.el elinit-cli.el
EL_ALL = $(EL_MODULES) $(EL_MAIN)
TEST_DIR = tests
TEST_HELPERS = $(TEST_DIR)/elinit-test-helpers.el
TEST_ELS = $(TEST_HELPERS) $(sort $(filter-out $(TEST_HELPERS), \
$(wildcard $(TEST_DIR)/elinit-test-*.el)))
.PHONY: all check lint test byte-compile checkdoc package-lint \
libexec-check sbin-check pid1-check clean
all: check
check: lint test libexec-check sbin-check pid1-check
lint: byte-compile checkdoc package-lint
byte-compile: $(EL_ALL)
@echo "=== byte-compile ==="
@$(BATCH) --eval "(setq byte-compile-error-on-warn t)" \
-f batch-byte-compile $(EL_MODULES)
@$(BATCH) --eval "(setq byte-compile-error-on-warn t)" \
-f batch-byte-compile $(EL_MAIN)
@rm -f *.elc
checkdoc: $(EL_ALL)
@echo "=== checkdoc ==="
@for f in $(EL_ALL); do \
output=$$($(BATCH) --eval "(checkdoc-file \"$$f\")" 2>&1); \
if [ -n "$$output" ]; then echo "$$f:"; echo "$$output"; exit 1; fi; \
done
package-lint: $(EL_MAIN)
@echo "=== package-lint ==="
@$(BATCH) --eval "(progn (package-initialize) (require 'package-lint))" \
--eval "(let ((errs (with-current-buffer (find-file-noselect \"$(EL_MAIN)\") (package-lint-buffer)))) \
(dolist (e errs) (message \"%d:%d: %s\" (nth 0 e) (nth 1 e) (nth 3 e))) \
(kill-emacs (if errs 1 0)))"
test: $(EL_ALL) $(TEST_ELS)
@echo "=== ERT tests ==="
@$(BATCH) -l $(EL_MAIN) $(foreach f,$(TEST_ELS),-l $(f)) -f ert-run-tests-batch-and-exit
test-verbose: $(EL_ALL) $(TEST_ELS)
@$(BATCH) -l $(EL_MAIN) $(foreach f,$(TEST_ELS),-l $(f)) --eval "(ert-run-tests-batch-and-exit t)"
# Run a single test: make test-one TEST=test-name
test-one: $(EL_ALL) $(TEST_ELS)
@$(BATCH) -l $(EL_MAIN) $(foreach f,$(TEST_ELS),-l $(f)) --eval "(ert-run-tests-batch-and-exit '$(TEST))"
libexec-check:
@$(MAKE) -C libexec check
sbin-check:
@$(MAKE) -C sbin check
pid1-check:
@$(MAKE) -C static-builds check
clean:
rm -f *.elc tests/*.elc
@$(MAKE) -C libexec clean