As part of my project to learn common lisp, or at least write more common lisp as part of my day to day work and life, I’ve
This is a total rip off of this blog post, with a few minor changes:
- I hacked some
makefile
goodness so that it will automatically create binaries for all.lisp
files, and means that you can drop a script in the directory and not have to edit the makefile to get the magic to happen. - I switched to using buildapp to rather than cl-launch. Buildapp feels a bit more maintained, and I wanted practice using it. Otherwise, I don’t think it matters.
The makefile
:
TARGETS := $(subst .lisp,,$(wildcard *.lisp))
all:$(TARGETS)
%:%.lisp
@echo [build]: creating $@
@buildapp --load $< --entry script:run --output $@
@echo [build]: created $@
clean:
@rm -f $(TARGETS)
Hello world:
(cl:defpackage #:script
(:use #:cl)
(:export #:run))
(cl:in-package :script)
(defun run (argv)
(format t "hello world~%"))
As an aside, I also updated the buildapp aur package.
Pros:
- Common lisp scripts.
- The ability to integrate writing lisp into your existing Linux/Unix workflow and processes.
- Not having to think about packaging or build architecture for trivial operations.
Cons:
- ~40+ meg executable.
- Only one source file per script.