2 ":"; exec sbcl --script "$0" "$@" # -*-lisp-*-
4 (require 'sb-executable)
6 (let* ((args (cdr *posix-argv*))
7 (prog (pathname-name *load-pathname*))
9 (labels ((moan (message &rest arguments)
10 (format *error-output* "~A: ~?~%" prog message arguments))
11 (die (message &rest arguments)
12 (apply #'moan message arguments)
16 (format *error-output*
17 "Usage: ~A build SOURCE SOURCE ...~%~
18 ~0~ ~:*~A link OUTPUT FASL FASL ...~%"
21 ((string= cmd "build")
24 (unless (handler-case (compile-file file :verbose nil :print nil)
26 (moan "failed to compile `~A':~%~8T~A" file cond)))
30 (let ((out (pop args)))
31 (handler-case (sb-executable:make-executable out args)
33 (die "failed to make executable:~%~8T~A" cond)))))
35 (die "unknown command `~A'" cmd)))))