-
Notifications
You must be signed in to change notification settings - Fork 145
/
Makefile
114 lines (92 loc) · 2.94 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
### Makefile for SLY
#
# This file is in the public domain.
# Variables
#
EMACS=emacs
LISP=sbcl
LOAD_PATH=-L . -L contrib/
ELFILES := sly.el sly-autoloads.el $(wildcard lib/*.el)
ELCFILES := $(ELFILES:.el=.elc)
CONTRIBS = $(patsubst contrib/sly-%.el,%,$(wildcard contrib/sly-*.el))
CONTRIB_ELFILES := $(wildcard contrib/*.el)
CONTRIB_ELCFILES := $(CONTRIB_ELFILES:.el=.elc)
TEST_ELFILES := $(wildcard test/*.el)
TEST_ELCFILES := $(TEST_ELFILES:.el=.elc)
all: compile compile-contrib
# Compilation
#
sly.elc: sly.el lib/hyperspec.elc
%.elc: %.el
$(EMACS) -Q $(LOAD_PATH) --batch -f batch-byte-compile $<
compile: $(ELCFILES)
compile-contrib: $(CONTRIB_ELCFILES)
compile-test: $(TEST_ELCFILES)
# Automated tests
#
check: check-core check-fancy
check-core: SELECTOR=t
check-core: compile
$(EMACS) -Q --batch $(LOAD_PATH) \
--eval "(require 'sly-tests \"lib/sly-tests\")" \
--eval "(setq inferior-lisp-program \"$(LISP)\")" \
--eval '(sly-batch-test (quote $(SELECTOR)))'
check-%: CONTRIB_NAME=$(patsubst check-%,sly-%,$@)
check-%: SELECTOR=(tag contrib)
check-%: compile contrib/sly-%.elc test/sly-%-tests.elc
$(EMACS) -Q --batch $(LOAD_PATH) -L test \
--eval "(require (quote sly))" \
--eval "(setq sly-contribs (quote ($(CONTRIB_NAME))))" \
--eval "(require \
(intern \
(format \
\"%s-tests\" (quote $(CONTRIB_NAME)))))" \
--eval "(setq inferior-lisp-program \"$(LISP)\")" \
--eval '(sly-batch-test (quote $(SELECTOR)))'
check-fancy: SELECTOR=(tag contrib)
check-fancy: compile compile-contrib
$(EMACS) -Q --batch $(LOAD_PATH) -L test \
--eval "(require (quote sly))" \
--eval "(sly-setup (quote (sly-fancy)))" \
--eval "(mapc (lambda (sym) \
(require \
(intern (format \"%s-tests\" sym)) \
nil t)) \
(sly-contrib--all-dependencies \
(quote sly-fancy)))" \
--eval '(setq inferior-lisp-program "$(LISP)")' \
--eval '(sly-batch-test (quote $(SELECTOR)))'
# Cleanup
#
FASLREGEX = .*\.\(fasl\|ufasl\|sse2f\|lx32fsl\|abcl\|fas\|lib\|trace\)$$
clean-fasls:
find . -regex '$(FASLREGEX)' -exec rm -v {} \;
[ -d ~/.sly/fasl ] && rm -rf ~/.sly/fasl || true
clean: clean-fasls
find . -iname '*.elc' -exec rm {} \;
# Doc
#
doc-%:
$(MAKE) -C doc $(@:doc-%=%)
doc: doc-help
# Help
#
help:
@printf "\
Main targets\n\
all -- compile all .el files\n\
compile -- compile just core SLY\n\
compile-contrib -- compile just contribs\n\
check -- run tests in batch mode\n\
clean -- delete generated files\n\
doc-help -- print help about doc targets\n\
help-vars -- print info about variables\n\
help -- print this message\n"
help-vars:
@printf "\
Main make variables:\n\
EMACS -- program to start Emacs ($(EMACS))\n\
LISP -- program to start Lisp ($(LISP))\n\
SELECTOR -- selector for ERT tests ($(SELECTOR))\n"
.PHONY: all clean compile compile-contrib check check-core \
check-fancy dochelp help-vars