# Development tasks. Everything runs through SBCL in script mode; Quicklisp # resolves the dependencies, so it must be installed and loaded by your # ~/.sbclrc (which is what `(ql:add-to-init-file)` does). # # make list the targets # make test run the suite against a local HTTP server # make lint compile everything from scratch, fail on any warning # make build compile and load the library SBCL ?= sbcl DEPS := "dexador" "com.inuoe.jzon" "babel" "fiveam" "usocket" "bordeaux-threads" LISP := $(SBCL) --non-interactive \ --eval '(require :asdf)' \ --eval '(push (uiop:getcwd) asdf:*central-registry*)' CACHE := $(HOME)/.cache/common-lisp .DEFAULT_GOAL := help .PHONY: help test lint build check clean help: @echo 'Targets:' @echo ' test run the test suite' @echo ' lint recompile from scratch, failing on any warning (read-only)' @echo ' build compile and load the library' @echo ' check lint + test + build, in that order' @echo ' clean remove compiled files and this project'"'"'s ASDF cache' test: $(LISP) \ --eval '(ql:quickload "cepis/tests" :silent t)' \ --eval '(uiop:quit (if (cepis/tests:run-tests) 0 1))' # The dependencies are loaded outside the handler so that their own warnings, # on the first compile of a fresh Quicklisp, are not counted as ours. The # redefinition warnings that are skipped are the ones SBCL emits for a macro # compiled and then loaded in the same image, which say nothing about the code. LINT_FORM := (let ((warnings 0)) (handler-bind ((warning (lambda (condition) (unless (typep condition (quote sb-kernel:redefinition-warning)) (incf warnings) (format *error-output* "~&~a~%" condition))))) (asdf:load-system "cepis/tests" :force (list "cepis" "cepis/tests"))) (uiop:quit (if (plusp warnings) 1 0))) lint: $(LISP) --eval '(ql:quickload (list $(DEPS)) :silent t)' --eval '$(LINT_FORM)' build: $(LISP) --eval '(ql:quickload "cepis" :silent t)' --eval '(asdf:make "cepis")' check: lint test build clean: find . \( -name '*.fasl' -o -name '*.fas' -o -name '*.lib' \) -delete rm -rf $(CACHE)/*/$(patsubst /%,%,$(CURDIR))