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
|
.PHONY : help show-versions clean compile deps minimal-racket-deps test test-elisp test-racket test-racket-submod test-racket-plain test-racket-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
test: test-racket test-elisp
######################################################################
# Emacs
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 '(unless (package-installed-p (quote compat)) (package-install (quote compat)))' \
--eval '(unless (package-installed-p (quote faceup)) (package-install (quote faceup)))' \
--eval '(unless (package-installed-p (quote paredit)) (package-install (quote paredit)))'
test-elisp:
$(batch-emacs) \
-l ert \
-l test/racket-tests.el \
--eval '(setq racket-program "$(RACKET)")' \
-f ert-run-tests-batch-and-exit
######################################################################
# Racket
# This target is for a CI configuration using the Minimal Racket
# distribution. In that case we need some additional Racket packages
# from the main distribution -- as described in our end user docs at
# <https://www.racket-mode.com/#Minimal-Racket>.
minimal-racket-deps:
$(RACKET) -l raco pkg install --auto \
data-lib errortrace-lib macro-debugger-text-lib rackunit-lib \
racket-index scribble-lib drracket-tool-text-lib
test-racket: test-racket-submod test-racket-plain
# Most tests exist inside `test` submodules of ordinary source files.
#
# Exclude racket/hash-lang.rkt because it fails to eval on older
# Rackets. Normally we only dynamic-require it. Furthermore its tests
# are in ./test/racket/hash-lang-test.rkt.
no-test-rkts=./racket/hash-lang.rkt ./racket/keywords.rkt
test-racket-submod:
$(RACKET) -l raco test --submodule test --no-run-if-absent \
$(filter-out $(no-test-rkts), $(wildcard ./racket/*.rkt)) \
$(wildcard ./racket/commands/*.rkt)
# Plus we do have some files in a special directory that consist of
# tests in the file's root module.
test-racket-plain:
$(RACKET) -l raco test ./test/racket/
# Some very slow tests segregated in `slow-test` submodules so that
# they're not run by default.
test-racket-slow:
$(RACKET) -l raco test --submodule slow-test ./racket/imports.rkt
$(RACKET) -l raco test --submodule slow-test ./racket/commands/check-syntax.rkt
|