c64-livecoding/wip-duuqnd/user-side-compiler/binary-test-build.lisp

32 lines
1.2 KiB
Common Lisp

(in-package #:user-side-compiler)
(defun batch-parse-options (arguments)
(let ((options '()))
(loop :with outputp := nil
:for arg :in arguments
:do (cond (outputp
(setf (getf options :output) arg
outputp nil))
((or (string= arg "-o") (string= arg "--output"))
(setf outputp t))
((or (string= arg "-h") (string= arg "--help"))
(setf (getf options :show-help-p) t))
(t
(setf (getf options :input) arg))))
options))
(defun batch-main ()
(destructuring-bind (&key input output show-help-p)
(batch-parse-options (uiop:command-line-arguments))
(if show-help-p
(progn
(format t "Usage: c6lc [-o <output file>] <input file>~%")
(sb-ext:exit :code -1))
(batch-compile input output))))
(defun build ()
(assert (not (member :swank *features*)))
(sb-ext:save-lisp-and-die "c6lc" :toplevel #'batch-main :executable t
:save-runtime-options t
:root-structures 'batch-main
:compression t))