@@ -19,23 +19,30 @@ ELC := $(FILES:.el=.elc)
1919
2020PACKAGE_INIT := -f package-initialize
2121
22- INSTALL_DEPENDENCIES := ${PACKAGE_INIT} --eval '(progn \
23- (load "seq" nil t) \
24- (load "project" nil t) \
25- (unless (and (fboundp ` seq-contains-p) (fboundp ` project-name)) \
26- (package-refresh-contents) \
27- (package-install (cadr (assoc ` project package-archive-contents))) \
28- (package-install (cadr (assoc ` map package-archive-contents))) \
29- (package-install (cadr (assoc ` seq package-archive-contents)))) \
30- (unless (package-installed-p ` ivy) \
31- (package-refresh-contents) \
22+ INSTALL_DEPENDENCIES := ${PACKAGE_INIT} --eval '(progn \
23+ (load "seq" nil t) \
24+ (load "project" nil t) \
25+ (unless (and (fboundp ` seq-contains-p) \
26+ (fboundp ` project-name) \
27+ (package-installed-p (quote package-lint))) \
28+ (push (quote (" melpa" . " https://melpa.org/packages/" )) package-archives)\
29+ (package-refresh-contents) \
30+ (package-install (quote package-lint)) \
31+ (package-install (cadr (assoc ` project package-archive-contents))) \
32+ (package-install (cadr (assoc ` map package-archive-contents))) \
33+ (package-install (cadr (assoc ` seq package-archive-contents)))) \
34+ (unless (package-installed-p ` ivy) \
35+ (package-refresh-contents) \
3236 (package-install ` ivy)))'
3337
38+ IGNORED_LINT_WARNINGS := \
39+ -e "You should depend on (emacs \"29\\.1\") or the compat package if you need \`take' \\ ." \
40+ -e " warning: \` with-eval-after-load' is for use in configurations," \
41+
3442LIBS := $(patsubst %.el,-l %,${FILES})
3543
3644SELECTOR ?= .*
3745
38- .PHONY: deps
3946deps:
4047 ${emacs} -Q --batch ${INSTALL_DEPENDENCIES}
4148
@@ -50,28 +57,28 @@ check: compile
5057 --eval ' (setq byte-compile-error-on-warn t)' \
5158 -f batch-byte-compile $<
5259
53- lint:
54- set -e; \
55- files=( \
56- asm-data.el \
57- asm-jump.el \
58- asm-x86.el \
59- asm2src.el \
60- bdx.el \
61- binfile.el \
62- compdb.el \
63- untemplatize-cxx.el \
64- ); \
65- for f in $${files[@]}; do \
66- lint=$$(mktemp) \
67- && ${emacs} -Q --batch $$f \
60+ %.lint-checkdoc: %.el
61+ @lint=$$(mktemp); \
62+ ${emacs} -Q --batch $< \
6863 --eval ' (checkdoc-file (buffer-file-name))' 2>&1 | tee $$lint \
69- && test -z "$$(cat $$lint)"; \
70- done; \
71- for f in $${files[@]}; do \
72- sed ' 1{s/.* //}' $$f | grep -n -E "^.{80,}" `# Catch long lines` \
73- | sed -r ' s/^([0-9]+).* /' $$f' :\1 : Too long/; q1' ; \
74- done
64+ && test -z "$$(cat $$lint)"
65+
66+ %.lint-long-lines: %.el
67+ @sed ' 1{s/.* //}' $< | grep -n -E "^.{80,}" `# Catch long lines` \
68+ | sed -r ' s/^([0-9]+).* /' $<' :\1 : Too long/; q1' ;
69+
70+ %.lint-package: %.el
71+ @file=$$(mktemp);result=$$(mktemp); \
72+ ${emacs} -Q --batch ${PACKAGE_INIT} \
73+ -f ' package-lint-batch-and-exit' $< 2>$$file || true \
74+ && sed -i "/^Entering directory/d" $$file \
75+ && grep -v ${IGNORED_LINT_WARNINGS} $$file | tee $$result \
76+ && test -z "$$(cat $$result)"
77+
78+ %.lint: %.el %.lint-checkdoc %.lint-long-lines %.lint-package
79+ @true
80+
81+ lint: $(patsubst %.el,%.lint,$(filter-out %-test.el,$(FILES)))
7582
7683clean:
7784 rm -f *.elc
0 commit comments