From 7ef55805d0de286e4f77e24c3545eee78483c07c Mon Sep 17 00:00:00 2001 From: Greg Hendershott Date: Tue, 21 Jan 2025 21:47:28 -0500 Subject: [PATCH] Improve Makefile readability 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`. --- Makefile | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b7b1f5f8..21adf938 100644 --- a/Makefile +++ b/Makefile @@ -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" @@ -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))' \ @@ -55,13 +60,6 @@ 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 \ @@ -69,17 +67,34 @@ test-elisp: --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