ASDF ?
Hi,
I spent the morning converting over to ASDF:DEFSYSTEM. Along the way, I found some peculiar behavior, no doubt, because I don't really know what I'm doing....
I have a file folder for an application that has many source files separated into sub-folders. I found by trial and error that ASDF will compile those files when the components are shown as (:FILE "./parts/diddly"), but it puts the FASL files into the same folder as the .asd file, and then the Lisp loader would complain that the FASL file doesn't exist -- because it isn't in the specified sub-folder.
Then I found that if I state the components as (:FILE "diddly" :PATHNAME "./parts/diddly") it did the "right thing" by placing the FASL files back into the source folder, and the Lisp loader was happy. But this seems redundant. There must be some design philosophy for this behavior, but I'm seeing an impedance bump between that philosophy and my initial mind-set.
So, with dozens of source files scattered in dozens of sub-folders, this is too much typing, and so I made a mapcar printout from the original component spec, and then copy and pasted back into the ASDF component specs with the :PATHNAME parts now present.
After studying the ASDF source code, I can't say I'm any more enlightened than earlier since the code is fairly dense and intricate. The documentation is meager in this regard.
Does anyone out there have a better way of accomplishing this same kind of thing -- having source files in sub-folders, using ASDF to compile and load from those same sub-folders?
David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZĀ 85750
phone: 1.520.390.3995
Re: ASDF ?
Hi David,
On Sat, 23 Feb 2008 12:48:04 -0700, David McClain <dbm@refined-audiometrics.com> wrote:
> I spent the morning converting over to ASDF:DEFSYSTEM. Along the
> way, I found some peculiar behavior, no doubt, because I don't
> really know what I'm doing....
>
> I have a file folder for an application that has many source files
> separated into sub-folders. I found by trial and error that ASDF
> will compile those files when the components are shown as (:FILE
> "./parts/ diddly"), but it puts the FASL files into the same folder
> as the .asd file, and then the Lisp loader would complain that the
> FASL file doesn't exist -- because it isn't in the specified
> sub-folder.
>
> Then I found that if I state the components as (:FILE "diddly"
> :PATHNAME "./parts/diddly") it did the "right thing" by placing the
> FASL files back into the source folder, and the Lisp loader was
> happy. But this seems redundant. There must be some design
> philosophy for this behavior, but I'm seeing an impedance bump
> between that philosophy and my initial mind-set.
>
> So, with dozens of source files scattered in dozens of sub-folders,
> this is too much typing, and so I made a mapcar printout from the
> original component spec, and then copy and pasted back into the ASDF
> component specs with the :PATHNAME parts now present.
>
> After studying the ASDF source code, I can't say I'm any more
> enlightened than earlier since the code is fairly dense and
> intricate. The documentation is meager in this regard.
>
> Does anyone out there have a better way of accomplishing this same
> kind of thing -- having source files in sub-folders, using ASDF to
> compile and load from those same sub-folders?
ASDF uses "modules" for this. Try something like
((:module :parts
:components
((:file "diddly")
(:file "duddly"))))
for files "diddly.lisp" and "duddly.lisp" in the "parts" folder.
Modules basically take the same arguments as files and systems, so for
example they can also have :DEPENDS-ON parts. And they can have
:PATHNAME parts as well:
((:module :parts
:pathname "parts-folder"
:components
((:file "diddly")
(:file "duddly"))))
That's a module named :PARTS with the files being in the folder
"parts-folder".
For examples of open source libraries which use folders to organize
their ASDF systems see for example CLSQL, UFFI, or CFFI.
HTH,
Edi.
Re: ASDF ?
On Sat, Feb 23, 2008 at 2:48 PM, David McClain
<dbm@refined-audiometrics.com> wrote:
> Hi,
>
> I spent the morning converting over to ASDF:DEFSYSTEM. Along the way, I
> found some peculiar behavior, no doubt, because I don't really know what I'm
> doing....
>
> I have a file folder for an application that has many source files separated
> into sub-folders. I found by trial and error that ASDF will compile those
> files when the components are shown as (:FILE "./parts/diddly"), but it puts
> the FASL files into the same folder as the .asd file, and then the Lisp
> loader would complain that the FASL file doesn't exist -- because it isn't
> in the specified sub-folder.
>
> Then I found that if I state the components as (:FILE "diddly" :PATHNAME
> "./parts/diddly") it did the "right thing" by placing the FASL files back
> into the source folder, and the Lisp loader was happy. But this seems
> redundant. There must be some design philosophy for this behavior, but I'm
> seeing an impedance bump between that philosophy and my initial mind-set.
>
> So, with dozens of source files scattered in dozens of sub-folders, this is
> too much typing, and so I made a mapcar printout from the original component
> spec, and then copy and pasted back into the ASDF component specs with the
> :PATHNAME parts now present.
>
> After studying the ASDF source code, I can't say I'm any more enlightened
> than earlier since the code is fairly dense and intricate. The documentation
> is meager in this regard.
>
> Does anyone out there have a better way of accomplishing this same kind of
> thing -- having source files in sub-folders, using ASDF to compile and load
> from those same sub-folders?
>
> David McClain
In our project, we use the :module construct, which parallels the
filesystem setup. E.g.,
(asdf:defsystem #:name
:components
((:module "dir1"
:components ((:file "file1.1")
(:file "file1.2")))
(:module "dir2"
:components ((:file "file2.1")
(:file "file2.2.")))))
--
=====================
Joshua Taylor
tayloj@cs.rpi.edu, jtaylor@alum.rpi.edu
"A lot of good things went down one time,
back in the goodle days."
John Hartford