-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (46 loc) · 1.48 KB
/
Makefile
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
# Run an arbitrary Emacs version like
# make test emacs="docker run --rm -it -v $PWD:/work -w /work silex/emacs:26 emacs"
emacs := emacs
dependencies := flycheck reformatter
run_emacs = $(emacs) -Q -L . -L $(elpa_dir) -l package \
--eval "(setq package-user-dir (expand-file-name \"$(elpa_dir)\"))" \
--eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)" \
--eval "(package-initialize)"
elpa_dir := elpa
.PHONY: test
test: ## Compile and run unit tests
test: test-compile
$(elpa_dir):
$(run_emacs) \
--eval "(unless (seq-every-p (lambda (e) (require e nil t)) '($(dependencies))) \
(package-refresh-contents) (mapc #'package-install '($(dependencies))))" \
--batch
.PHONY: deps
deps: $(elpa_dir)
.PHONY: test-compile
test-compile: | $(elpa_dir)
$(run_emacs) \
--eval '(setq byte-compile-error-on-warn t)' \
--batch -f batch-byte-compile *.el
.PHONY: clean
clean: ## Clean files
rm -f *.elc
.PHONY: clobber
clobber: ## Remove all generated files
clobber: clean
rm -rf $(elpa_dir)
# Hooks
hooks := $(filter-out %~,$(wildcard hooks/*))
git_dir := $(shell git rev-parse --git-dir)
.PHONY: hooks
hooks: ## Install helpful git hooks
hooks: $(foreach _,$(hooks),$(git_dir)/hooks/$(notdir $(_)))
$(git_dir)/hooks/%: hooks/%
ln -s $(PWD)/$(<) $(@)
.PHONY: help
help: ## Show this help text
$(info usage: make [target])
$(info )
$(info Available targets:)
@awk -F ':.*?## *' '/^[^\t].+?:.*?##/ \
{printf " %-24s %s\n", $$1, $$2}' $(MAKEFILE_LIST)