Skip to content

Commit

Permalink
Improve Makefile readability
Browse files Browse the repository at this point in the history
This is supposed to make the Makefile somewhat easier to understand --
but NOT intended to change its behavior/result.

Separate the Emacs and Racket targets.

Replace the `test-x-rkt-files` intermediate variable with two distinct
targets `test-racket-submod` and `test-racket-plain`.

Use more explicit form of `raco test -x`.
  • Loading branch information
greghendershott committed Jan 22, 2025
1 parent 88e71af commit 7ef5580
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY : help show-versions clean compile deps minimal-racket-deps test test-elisp test-racket test-slow
.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"
Expand All @@ -14,6 +14,11 @@ show-versions:
@echo `which $(EMACS)`
@$(EMACS) --version

test: test-racket test-elisp

######################################################################
# Emacs

batch-emacs := \
$(EMACS) --batch -Q -L . \
--eval '(require (quote package))' \
Expand Down Expand Up @@ -55,31 +60,41 @@ deps:
--eval '(package-install (quote faceup))' \
--eval '(package-install (quote paredit))'

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: 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)
######################################################################
# 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 in `test` submodules of ordinary source files,
#
# 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-racket-submod:
$(RACKET) -l raco test --submodule test --no-run-if-absent \
$(filter-out ./racket-hash-lang.rkt, \
$(wildcard ./racket/*.rkt) \
$(wildcard ./racket/commands/*.rkt))

# We do have some files in a special directory that consist solely of
# tests.
test-racket-plain:
$(RACKET) -l raco test ./test/racket/

test-slow:
# 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

0 comments on commit 7ef5580

Please sign in to comment.