All Manuals > LispWorks User Guide and Reference Manual > 16 Common Defsystem and ASDF > 16.2 Defining a system


16.2.5 Examples

Consider an example system, demo , defined as follows:

(defsystem demo (:package "USER")
  :members ("parent"
  :rules ((:in-order-to :compile ("child1" "child2")
           (:caused-by (:compile "parent"))
           (:requires (:load "parent")))))

This system compiles and loads members into the USER package if the members themselves do not specify packages. The system contains three members -- parent , child1 , and child2 -- which may themselves be either files or other systems. There is only one explicit rule in the example. If parent needs to be compiled (for instance, if it has been changed), then this causes child1 and child2 to be compiled as well, irrespective of whether they have themselves changed. In order for them to be compiled, parent must first be loaded.

Implicitly, it is always the case that if any member changes, it needs to be compiled when you compile the system. The explicit rule above means that if the changed member happens to be parent , then every member gets compiled. If the changed member is not parent , then parent must at least be loaded before compiling takes place.

The next example shows a system consisting of three files:

(defsystem my-system 
  (:default-pathname "~/junk/")
            (:requires (:load "a"))







  1. Compile b.lisp .
  2. Load a.lisp .
  3. Compile c.lisp .

This last example shows how to make each fasl get loaded immediately after compiling it:

(defsystem my-system ()
  :members ("foo" "bar" "baz" "quux")
(compile-system my-system :load t)


LispWorks User Guide and Reference Manual - 21 Dec 2011