MK-DEFSYSTEM is a system definition utility; it fills a similar role for CL as make(1) does for C.

The current version (3.9.1) was released on January 21, 2023, and is available in Quicklisp.


Are there any documents for mk-defsystem out there? How does one add a path to its search path?

The CLOCC version of mk-defsystem has some TeX/DVI/PS documentation. As to the specific question, the magical variable you're looking to push things onto is mk:*central-registry*.

Just to clarify: the CLOCC documentation is limited and needs to be updated. As per the specific question, both MK3 and MK4 now have a new function

(mk:add-registry-location ...)

which does the PUSH in a more meaningful way.

Portability notes

The y-or-n-p-wait function (which is also provided by text-query) uses a technique of busy-waiting on listen (or read-char-no-hang) that doesn't work everywhere. For example, it works in the LispWorks IDE for Windows, but doesn't work in the Windows Terminal. To disable the use of timeouts, you can do this:

(setf mk::*use-timeouts* nil)

ACL warns because some export forms are non-top-level. This is one of those things that changed when CLtL2 came around. Things like export (and proclaim, shadow, etc.) are supposed to be wrapped in an eval-when, or find another way to suppress the warnings. The variable *cltl1-compile-file-toplevel-compatibility-p* controls this behavior:

CG-USER(3): compiler:*cltl1-compile-file-toplevel-compatibility-p* WARN

MK-DEFSYSTEM has its own (conditionalized) implementation of provide and require, because those functions were at risk of being deleted from ANSI Common Lisp, but they got deprecated instead. The definitions of these functions within defsystem.lisp caused MKCL to crash upon loading the FASL. So it's essential that the read-time conditionalization prevents that code from being read at all.

Foreign files

Did you know? You can also load foreign files with defsystem. For example, to define that C components are compiled by calling out to "make" and loaded using the foreign loader, try something like this example (originally from db-sockets):

(defparameter *make-program* "make") (defun c-make-file (filename &rest args &key output-file error-file) ;; make foo.o (declare (ignore args error-file)) (make::run-unix-program *make-program* (list output-file))) (make:define-language :c :compiler #'c-make-file :loader #+:lucid #'load-foreign-files #+cmu #'alien::load-foreign #+sbcl #'sb-alien::load-foreign #+:allegro #'load #-(or :cmu :sbcl :lucid :allegro) #'load :source-extension "c" :binary-extension "o")

then you define the relevant component like this:

(:file "get_h_errno.c" :language :c :source-extension "c" :binary-extension "o")

Older versions