summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 12:42:28 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 12:42:28 -0300
commitae9ad8a4c61b793f6859c84dac80b1c1b04b7b68 (patch)
tree62271e7672dfc58f59dda2ea4dc539c89a1ea5ca /Makefile
downloadlisp-ae9ad8a4c61b793f6859c84dac80b1c1b04b7b68.tar.gz
Initial importv0.1.0
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7b8356b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,51 @@
+# 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))