1.2. System definition files

A System Definition File, or just system, is the lisp equivalent of a makefile in the Unix world: it contains a list of source files which are to be loaded or compiled, and dependencies among them ("load source file1.lsp before compiling file2.lsp", etc).

It is difficult to tell about the Lisp Machines history, but probably the first most popular system definition format was called mk-defsystem or simply defsystem. Written by Mark Kantrowitz [mk-defsystem], this library now lives in the CLOCC repository and is actively maintained. ECL ships with a copy of the version 3.x which fortunately has no customizations. You can load this copy by issuing (require 'defsystem) from the lisp toplevel.

However, in the last years, Another System Definition Facility known as ASDF has become even more popular in the Common Lisp world. This new format simplifies writing extensions to handle new kind of source files and integrates very well with the package management utility known as ASDF-install. ASDF has a slightly different syntax from mk-defsystem 3.0, but because of reasons of popularity and better integration with ECL, in this manual we have focused on this particular library.

A simple ASDF definition looks as follows:

(defsystem test
  :source-pathname "~/src/test/"
  :source-extension "lisp"
  :components ((:module file1
                        :source-pathname "")
               (:module file2
                        :source-pathname ""
                        :depends-on (file1))))

This example consists of two files, file1.lisp and file2.lisp, located in ~/src/test/. When compiling these files, file1.lisp will be processed before file2.lisp, because the second depends on the former one. There are more complex rules that allow a system to depend on others, and to contain other kind of files, such as C or Java binaries. For further information we recommend reading the online manual.

You can load ASDF on a running ECL using a single lisp statement (require 'asdf). Once loaded, ASDF will extend the function require to recognize and load libraries that are placed in standard locations or which have been registered with ASDF itself. The following sections describe other features of ASDF which are specific to ECL and related to the code building and shipping mechanisms introduced before.