Yet another Defsystem
-Introduction

There is in ANSI Common Lisp no standard way of defining, compiling and loading a multi-file Lisp program. As a result, various utilities to organise Lisp projects in modules, submodules and subsystems, to sort out source-file dependencies and to recompile and load changed files as necessary have been developed. They are often called DEFSYSTEM utilities and correspond with the MAKE facilities in other development environments.

One of the more portable solutions is Mark Kantrowitz' DEFSYSTEM, inspired by and modeled after an older system. Although excellent, it is fairly substantial in size and also has not been updated for some time. Also, it does not support logical hosts reliably and is difficult to extend.

YADS -- YET ANOTHER DEFSYSTEM -- has a very similar user interface, but it correctly supports Macintosh file names, pathnames, logical hosts and hierarchical source folders. It also has some nice extra features. YADS is also much smaller (25K) and is designed to be easily extended with functionality for things like file search and replace, printing, etc. The following is an example of a simple system definition:

  (defsystem :palettes
    :package :ccl
    :source-directory "ccl:projects;Palettes;"
    :binary-directory "ccl:projects;Palettes;"
    :required :quickdraw
    :components ("Palettes"
                 "Avoidance"))
System definitions are usually longer than in this example, which only has two components, both source files. Components can be nested to any depth, they can be dependent on other components and subsystems, etc. YADS will always sort out the interdependencies and recompile and load changed files as necessary and in the correct order.

Here is another, more complex system definition:

  (defsystem :myapp
    :package :cl-user
    :source-directory "myapp:sources;"
    :binary-directory "myapp:binaries;"
    :required (:oou :some-module :some-other-module)
    :depends-on (:palettes :some-other-system)
    :initially-do (print "I'm starting now...")

    :components ("Constants"
                 "Global-vars"
                 "Data-types"
                 "Classes"

                 (:module :macros
                  :components ("Conditionals"
                               "Memoization"
                               "IO"))

                 (:module :abstractions
                  :source-extension ".lsp"
                  :depends-on :macros
                  :components ("Foo" "Bar" "Baz")))

:finally-do (print "I'm done!"))

Sources and binaries are kept in different folder hierarchies. It also ensures that the systems :PALETTES and :SOME-OTHER-SYSTEM are loaded before the system's own components are processed. The components are six in number: four source files and two submodules named :MACROS and :ABSTRACTIONS, respectively. The latter is dependent on :MACROS, which means that it too will be recompiled if any changes are made to the :MACROS module.
    back to Defsystem mainpage