summaryrefslogtreecommitdiff
path: root/Makefile
blob: 549802400406b765db62f18d50e928b19f5dd82f (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
EMACS = emacs -Q --batch
CURL = curl --silent
name = bog
main_el :=  $(name).el
main_elc =  $(main_el)c
AUTOLOADS_FILE := $(name)-autoloads.el

DASH_URL = https://raw.githubusercontent.com/magnars/dash.el/master/dash.el

all: elc autoloads

.PHONY: autoloads
autoloads: $(AUTOLOADS_FILE)

$(AUTOLOADS_FILE): $(main_el) .downloads
	@$(EMACS) -L . --eval \
	"(let (make-backup-files) \
	  (update-file-autoloads \"$(CURDIR)/$<\" t \"$(CURDIR)/$@\"))"

.PHONY: clean
clean:
	$(RM) $(main_elc) $(AUTOLOADS_FILE)

.PHONY: elc
elc: $(main_elc)

.PHONY: help
help:
	@printf "\nMain targets:\n\n"
	@printf "  all                Byte compile and generate autoloads.\n"
	@printf "  autoloads          Generate $(AUTOLOADS_FILE).\n"
	@printf "  elc                Byte compile $(main_el).\n"
	@printf "\nOther:\n\n"
	@printf "  clean              Remove generated files.\n"
	@printf "  help               Print this message.\n"
	@printf "  test               Run tests.\n"

.PHONY: test
test: .downloads
	@$(EMACS) -L . -l bog-tests \
	--eval "(ert-run-tests-batch-and-exit '(not (tag interactive)))"

%.elc: %.el .downloads
	@$(EMACS) -L . -f batch-byte-compile $<


.downloads:
	$(CURL) $(DASH_URL) > dash.el
	touch .downloads