forked from greghendershott/racket-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (66 loc) · 2.6 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
.PHONY : help show-versions clean compile deps test test-elisp test-racket test-slow
help:
@echo "Targets: show-versions, clean, compile, deps, test, test-elisp, test-racket, test-slow"
# Allow running with an emacs or racket executable other than the
# default on PATH. e.g. `EMACS=/path/to/emacs make`.
EMACS ?= emacs
RACKET ?= racket
show-versions:
@echo `which $(RACKET)`
@$(RACKET) --version
@echo `which $(EMACS)`
@$(EMACS) --version
batch-emacs := \
$(EMACS) --batch -Q -L . \
--eval '(require (quote package))' \
--eval '(package-initialize)'
byte-compile := \
$(batch-emacs) \
-l bytecomp \
--eval '(setq byte-compile-warnings (quote (not obsolete)))' \
--eval '(setq byte-compile-error-on-warn t)' \
-f batch-byte-compile
%.elc : %.el
$(byte-compile) $<
# Build an .elc file for every .el file in the top dir.
elc-files := $(patsubst %.el,%.elc,$(wildcard *.el))
clean:
-rm $(elc-files) 2> /dev/null
compile: check-declares $(elc-files)
check-declares:
$(batch-emacs) \
-l check-declare \
--eval '(unless (eq system-type (quote windows-nt)) (when (check-declare-directory default-directory) (kill-emacs 1)))'
# Install Emacs packages we depend on for development and/or testing.
# Intended to be run once per machine by developers, as well as by CI.
# (Normal users get a subset of these deps automatically as a result
# of our Package-Requires in racket-mode.el.)
melpa-url := https://melpa.org/packages/
deps:
$(batch-emacs) \
--eval '(add-to-list (quote package-archives) (cons "melpa" "$(melpa-url)"))' \
--eval '(unless (fboundp (quote lisp-data-mode)) (defalias (quote lisp-data-mode) (quote emacs-lisp-mode)))' \
--eval '(package-refresh-contents)' \
--eval '(package-install (quote faceup))' \
--eval '(package-install (quote paredit))'
test: test-racket test-elisp
test-elisp:
$(batch-emacs) \
-l ert \
-l test/racket-tests.el \
--eval '(setq racket-program "$(RACKET)")' \
-f ert-run-tests-batch-and-exit
# Files to test using `raco test -x`.
test-x-rkt-files := \
$(wildcard ./racket/*.rkt) \
$(wildcard ./racket/commands/*.rkt) \
$(wildcard ./test/racket/*.rkt)
# Exclude hash-lang.rkt because it will fail to eval on older Rackets;
# normally we only dynamic-require it. Furthermore its tests are in
# ./test/racket/hash-lang-test.rkt.
test-x-rkt-files := $(filter-out ./racket/hash-lang.rkt, $(test-x-rkt-files))
test-racket:
$(RACKET) -l raco test -x $(test-x-rkt-files)
test-slow:
$(RACKET) -l raco test --submodule slow-test ./racket/imports.rkt
$(RACKET) -l raco test --submodule slow-test ./racket/commands/check-syntax.rkt