Next: A more involved example, Previous: Defining systems with defsystem, Up: Defining systems with defsystem
Systems can be constructed programmatically by instantiating
components using make-instance. Most of the time, however, it is much
more practical to use a static defsystem
form. This section
begins with an example of a system definition, then gives the full
grammar of defsystem
.
Let's look at a simple system. This is a complete file that would usually be saved as hello-lisp.asd:
(defpackage hello-lisp-system (:use :common-lisp :asdf)) (in-package :hello-lisp-system) (defsystem "hello-lisp" :description "hello-lisp: a sample Lisp system." :version "0.2" :author "Joe User <joe@example.com>" :licence "Public Domain" :components ((:file "packages") (:file "macros" :depends-on ("packages")) (:file "hello" :depends-on ("macros"))))
Some notes about this example:
defpackage
and in-package
forms to
make and use a package expressly for defining this system in. This
package is named by taking the system name and suffixing
-system
- note that it is not the same package as you
will use for the application code.
This is not absolutely required by asdf, but helps avoid namespace pollution and so is considered good form.