Next: The defsystem grammar, Previous: The defsystem form, Up: Defining systems with defsystem [Contents][Index]
Let’s illustrate some more involved uses of defsystem
via a
slightly convoluted example:
(defsystem "foo" :version "1.0" :components ((:module "mod" :components ((:file "bar") (:file"baz") (:file "quux")) :perform (compile-op :after (op c) (do-something c)) :explain (compile-op :after (op c) (explain-something c))) (:file "blah")))
The :module
component named "mod"
is a collection of three files,
which will be located in a subdirectory of the main code directory named
mod (this location can be overridden; see the discussion of the
:pathname
option in The defsystem grammar).
The method-form tokens provide a shorthand for defining methods on particular components. This part
:perform (compile-op :after (op c) (do-something c)) :explain (compile-op :after (op c) (explain-something c))
has the effect of
(defmethod perform :after ((op compile-op) (c (eql ...))) (do-something c)) (defmethod explain :after ((op compile-op) (c (eql ...))) (explain-something c))
where ...
is the component in question.
In this case ...
would expand to something like
(find-component (find-system "foo") "mod")
For more details on the syntax of such forms, see The defsystem grammar. For more details on what these methods do, see Operations in The object model of ASDF.