|
1 | 1 | EMACS ?= emacs |
2 | | -ELPA_DIRS := $(shell find ~/.emacs.d/elpa* -maxdepth 0 -type d 2>/dev/null) |
3 | | -LOAD_PATH = -L . $(patsubst %,-L %,$(wildcard $(addsuffix /*,$(ELPA_DIRS)))) |
4 | 2 |
|
5 | | -.PHONY: check compile lint clean |
| 3 | +# A space-separated list of required package names |
| 4 | +DEPS = tree-mode ivy beacon |
6 | 5 |
|
7 | | -check: compile lint |
| 6 | +INIT_PACKAGES="(progn \ |
| 7 | + (require 'package) \ |
| 8 | + (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \ |
| 9 | + (package-initialize) \ |
| 10 | + (dolist (pkg '(PACKAGES)) \ |
| 11 | + (unless (package-installed-p pkg) \ |
| 12 | + (unless (assoc pkg package-archive-contents) \ |
| 13 | + (package-refresh-contents)) \ |
| 14 | + (package-install pkg))) \ |
| 15 | + )" |
8 | 16 |
|
9 | | -compile: clean |
10 | | - $(EMACS) --batch $(LOAD_PATH) \ |
11 | | - -f batch-byte-compile call-graph.el |
| 17 | +all: compile package-lint clean-elc |
12 | 18 |
|
13 | | -lint: |
14 | | - $(EMACS) --batch $(LOAD_PATH) \ |
15 | | - --eval "(require 'checkdoc)" \ |
16 | | - --eval "(require 'package-lint nil t)" \ |
17 | | - --eval "(with-current-buffer (find-file-noselect \"call-graph.el\") \ |
18 | | - (princ (format \"package-lint: %s\n\" (package-lint-buffer))) \ |
19 | | - (princ (format \"checkdoc: %s\n\" (checkdoc-current-buffer t))) \ |
20 | | - (kill-buffer))" |
| 19 | +package-lint: |
| 20 | + ${EMACS} -Q --eval $(subst PACKAGES,package-lint,${INIT_PACKAGES}) -batch -f package-lint-batch-and-exit call-graph.el |
21 | 21 |
|
22 | | -clean: |
| 22 | +compile: clean-elc |
| 23 | + ${EMACS} -Q --eval $(subst PACKAGES,${DEPS},${INIT_PACKAGES}) -L . -batch -f batch-byte-compile *.el |
| 24 | + |
| 25 | +clean-elc: |
23 | 26 | rm -f *.elc |
| 27 | + |
| 28 | +.PHONY: all compile clean-elc package-lint |
0 commit comments