1 (in-package :smake-user)
3 (defvar *asciidoc-root* #P"/usr/local/etc/asciidoc/")
7 (defun static-file (name &optional source destination)
11 (setf source (source-pathname name)))
13 (setf source (source-pathname source))))
17 (setf destination (build-pathname name)))
18 ((stringp destination)
19 (setf destination (build-pathname destination))))
21 (target* `(static-file ,name) ()
22 (when (file-newer-p source destination)
23 (path:cp source destination :overwrite t))))
25 (static-file "asciidoc.css" (path:catfile *asciidoc-root* "stylesheets/" "asciidoc.css"))
27 (static-file "asciidoc.js" (path:catfile *asciidoc-root* "javascripts/" "asciidoc.js"))
29 (static-file "fiveam.css")
31 (target (static-directory "asciidoc/images") ()
32 (ensure-directories-exist (build-pathname "images/icons/callouts/"))
33 (dolist (src (directory (path:catfile *asciidoc-root* "images/" "icons/" "callouts/" "*.png")))
34 (let ((dst (build-pathname (path:catfile "images/icons/callouts/" (path:basename src)))))
35 (when (file-newer-p src dst)
38 (defun asciidoc.html (source &optional requires)
39 (target* `(asciidoc ,source) (:requires (append requires
40 '((program "asciidoc")
41 (static-file "asciidoc.js")
42 (static-file "asciidoc.css")
43 (static-file "fiveam.css")
44 (static-directory "asciidoc/images"))))
45 (when (file-newer-p (source-pathname source) (build-pathname source :type "html"))
46 (unless (path:-e (build-pathname source))
47 (sys `(ln -s ,(source-pathname source) ,(build-pathname source))))
48 (sys `(asciidoc -o ,(build-pathname source :type "html") ,(build-pathname source))))))
50 (target "docstrings" ()
51 (unless (path:-d (build-pathname "docstrings/"))
52 (sys `(ccl64 --load ../extract-docstrings.lisp))
53 (sys `(rm -f ,(build-pathname "manual.html") ,(build-pathname "tutorial.html")))))
55 (asciidoc.html "manual.txt" '("docstrings"))
56 (asciidoc.html "tutorial.txt" '((asciidoc "manual.txt")))
58 (target "documentation" (:requires '((asciidoc "manual.txt")
59 (asciidoc "tutorial.txt"))))
61 (target "all" (:requires '("documentation")))