X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/122cd9509e433c57e037d2cdc73ac7b295d96636..b0e21f8370fb60321f178572e2b90dfc4e2eb5b6:/src/module-output.lisp diff --git a/src/module-output.lisp b/src/module-output.lisp index c3c61d6..fe04f2b 100644 --- a/src/module-output.lisp +++ b/src/module-output.lisp @@ -222,6 +222,30 @@ (or (get reason 'output-type) (error "Unknown output type `~(~A~)'" reason))) +(export 'module-output-file) +(defgeneric module-output-file (module output-type output-dir) + (:documentation + "Return a pathname to which the output should be written. + + Specifically, if we're processing a MODULE for a particular OUTPUT-TYPE, + and the user has requested that output be written to OUTPUT-DIR (a + pathname), then return the pathname to which the output should be + written. + + The OUTPUT-TYPE can be an `reason' symbol or a raw pathname. (Or + something else, of course.)")) + +(defmethod module-output-file + ((module module) (output-type symbol) output-dir) + (module-output-file module (output-type-pathname output-type) output-dir)) + +(defmethod module-output-file + ((module module) (output-type pathname) output-dir) + (reduce #'merge-pathnames + (list output-dir output-type + (make-pathname :directory nil + :defaults (module-name module))))) + (define-clear-the-decks reset-output-types "Clear out the registered output types." (dolist (reason *output-types*) (remprop reason 'output-type))