November 16, 2005 Archives

Wed Nov 16 15:28:05 CST 2005

Auto-generating ASDF defsystems given a bunch of .lisp files

I hacked together a really simple ASDF defsystem generator. What it does is scan through a set of source files for any DEF* form, assuming that when it sees (defblargh foo) it's defining a "blargh" named foo, and anytime it subsequently sees "foo" it knows which .lisp file "foo" was defined in, and thus adds it as a :depends-on clause to the .lisp file which used "foo".

It has a lot of shortcomings. Firstly, it simply uses the Lisp reader, which tries to intern symbols it sees - but into which package? If it sees, for instance, clsql:connect, then it will bork unless CLSQL has been loaded first. Which is why the first thing make-asdf does is load all the systems your new system depends on, which should really be ASDF's job. By the same token, if your system uses multiple packages then it won't work at all because the defpackage forms will never be evaluated before they're needed.

Anyway, here is the first rudimentary version of the code.

Posted by a1k0n | Permanent Link | Categories: Lisp