--- a/.hgignore Wed Dec 19 10:16:08 2018 -0500
+++ b/.hgignore Sun Dec 23 23:41:05 2018 -0500
@@ -5,3 +5,4 @@
cacl-sbcl
cacl-ecl
cacl-ccl
+build
--- a/Makefile Wed Dec 19 10:16:08 2018 -0500
+++ b/Makefile Sun Dec 23 23:41:05 2018 -0500
@@ -1,6 +1,6 @@
-.PHONY: vendor binaries
+.PHONY: all vendor
-all: vendor binaries
+all: vendor build/cacl-sbcl build/cacl-ccl build/cacl-abcl build/cacl-ecl build/cacl.1
# Vendor ----------------------------------------------------------------------
vendor/quickutils.lisp: vendor/make-quickutils.lisp
@@ -11,18 +11,21 @@
# Build -----------------------------------------------------------------------
lisps := $(shell ffind '\.(asd|lisp)$$')
-binaries: cacl-sbcl cacl-ccl cacl-ecl cacl-abcl
+build:
+ mkdir -p build
-cacl-sbcl: $(lisps)
- sbcl --load "src/build.lisp"
- mv cacl cacl-sbcl
+build/cacl-sbcl: build $(lisps)
+ sbcl --load "src/build-binary.lisp"
-cacl-ccl: $(lisps)
- ccl --load "src/build.lisp"
- mv cacl cacl-ccl
+build/cacl-ccl: build $(lisps) bin/cacl-ccl
+ ccl --load "src/build-binary.lisp"
+ cp bin/cacl-ccl build/
-cacl-ecl: $(lisps) bin/cacl-ecl
- cp bin/cacl-ecl cacl-ecl
+build/cacl-ecl: build $(lisps) bin/cacl-ecl
+ cp bin/cacl-ecl build/
-cacl-abcl: $(lisps) bin/cacl-abcl
- cp bin/cacl-abcl cacl-abcl
+build/cacl-abcl: build $(lisps) bin/cacl-abcl
+ cp bin/cacl-abcl build/
+
+build/cacl.1: build $(lisps)
+ sbcl --load "src/build-manual.lisp" --quit
--- a/src/base.lisp Wed Dec 19 10:16:08 2018 -0500
+++ b/src/base.lisp Sun Dec 23 23:41:05 2018 -0500
@@ -400,45 +400,57 @@
;;;; Command Line -------------------------------------------------------------
+(adopt:define-string *documentation*
+ "CACL is a TUI RPN calculator.~@
+ ~@
+ Documentation about the command-line options to the CACL binary follows. ~
+ For information about how to use CACL itself type help when running in interactive mode.")
+
(adopt:define-interface *ui*
- "[OPTIONS] [VALUES...]"
- (format nil "CACL is a TUI RPN calculator written (and configurable) in Common Lisp.~@
- ~@
- Documentation about the command-line options to the CACL binary follows. ~
- For information about how to use CACL itself type help when running in interactive mode.")
+ (:name "cacl"
+ :usage "[OPTIONS]"
+ :summary "A TUI RPN calculator written and customizable in Common Lisp."
+ :documentation *documentation*)
- ((help) "display help and exit"
+ ((help)
+ :documentation "display help and exit"
:long "help"
:short #\h
:reduce (constantly t))
- ((rcfile) "path to the custom initialization file (default ~/.caclrc)"
+ ((rcfile)
+ :documentation "path to the custom initialization file (default ~/.caclrc)"
:long "rcfile"
:parameter "PATH"
:initial-value "~/.caclrc"
:reduce #'adopt:newest)
- ((rcfile no-rcfile) "disable loading of any rcfile"
+ ((rcfile no-rcfile)
+ :documentation "disable loading of any rcfile"
:long "no-rcfile"
:reduce (constantly nil))
- ((interactive mode) "run in interactive mode (the default)"
+ ((interactive mode)
+ :documentation "run in interactive mode (the default)"
:long "interactive"
:short #\i
:initial-value 'interactive
:reduce (constantly 'interactive))
- ((batch mode) "run in batch processing mode"
+ ((batch mode)
+ :documentation "run in batch processing mode"
:long "batch"
:short #\b
:reduce (constantly 'batch))
- ((inform) "print informational message at startup (the default)"
+ ((inform)
+ :documentation "print informational message at startup (the default)"
:long "inform"
:initial-value t
:reduce (constantly t))
- ((no-inform inform) "suppress printing of informational message at startup"
+ ((no-inform inform)
+ :documentation "suppress printing of informational message at startup"
:long "no-inform"
:reduce (constantly nil)))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build-binary.lisp Sun Dec 23 23:41:05 2018 -0500
@@ -0,0 +1,28 @@
+(ql:quickload :cacl)
+
+;; Run these generic functions once now so their bodies will get compiled at
+;; build time, instead of delaying it until the first time the user runs
+;; a command. In SBCL at least, compiling the generic function for the first
+;; time takes a noticeable amount of time (somewhere around a quarter of
+;; a second), so let's not be annoying.
+
+(cacl::command 'cacl::nop)
+(cacl::command-documentation 'cacl::nop)
+
+#+sbcl
+(progn
+ (sb-ext:gc :full t)
+ (sb-ext:save-lisp-and-die
+ "build/cacl-sbcl"
+ :executable t
+ :compression nil
+ :toplevel #'cacl:toplevel
+ :save-runtime-options t))
+
+#+ccl
+(progn
+ (ccl:gc)
+ (ccl:save-application
+ "build/cacl-ccl.image"
+ :toplevel-function #'cacl:toplevel
+ :purify t))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build-manual.lisp Sun Dec 23 23:41:05 2018 -0500
@@ -0,0 +1,4 @@
+(ql:quickload :cacl)
+
+(with-open-file (stream "build/cacl.1" :direction :output :if-exists :supersede)
+ (adopt:print-manual cacl::*ui* :stream stream))
--- a/src/build.lisp Wed Dec 19 10:16:08 2018 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-(ql:quickload :cacl)
-
-;; Run these generic functions once now so their bodies will get compiled at
-;; build time, instead of delaying it until the first time the user runs
-;; a command. In SBCL at least, compiling the generic function for the first
-;; time takes a noticeable amount of time (somewhere around a quarter of
-;; a second), so let's not be annoying.
-
-(cacl::command 'cacl::nop)
-(cacl::command-documentation 'cacl::nop)
-
-#+sbcl
-(progn
- (sb-ext:gc :full t)
- (sb-ext:save-lisp-and-die
- "cacl"
- :executable t
- :compression nil
- :toplevel #'cacl:toplevel
- :save-runtime-options t))
-
-#+ccl
-(progn
- (ccl:gc)
- (ccl:save-application
- "cacl"
- :toplevel-function #'cacl:toplevel
- :purify t
- :prepend-kernel t))