Next: , Previous: , Up: Issues with using and extending ASDF to define systems   [Contents][Index]


13.6.4 “I want to put my module’s files at the top level. How do I do this?”

By default, the files contained in an asdf module go in a subdirectory with the same name as the module. However, this can be overridden by adding a :pathname "" argument to the module description. For example, here is how it could be done in the spatial-trees ASDF system definition for ASDF 2 or later:

(asdf:defsystem "spatial-trees"
  :components
  ((:module "base"
            :pathname ""
            :components
            ((:file "package")
             (:file "basedefs" :depends-on ("package"))
             (:file "rectangles" :depends-on ("package"))))
   (:module tree-impls
            :depends-on ("base")
            :pathname ""
            :components
            ((:file "r-trees")
             (:file "greene-trees" :depends-on ("r-trees"))
             (:file "rstar-trees" :depends-on ("r-trees"))
             (:file "rplus-trees" :depends-on ("r-trees"))
             (:file "x-trees" :depends-on ("r-trees" "rstar-trees"))))
   (:module viz
            :depends-on ("base")
            :pathname ""
            :components
            ((:static-file "spatial-tree-viz.lisp")))
   (:module tests
            :depends-on ("base")
            :pathname ""
            :components
            ((:static-file "spatial-tree-test.lisp")))
   (:static-file "LICENCE")
   (:static-file "TODO")))

All of the files in the tree-impls module are at the top level, instead of in a tree-impls/ subdirectory.

Note that the argument to :pathname can be either a pathname object or a string. A pathname object can be constructed with the #p"foo/bar/" syntax, but this is discouraged because the results of parsing a namestring are not portable. A pathname can only be portably constructed with such syntax as #.(make-pathname :directory '(:relative "foo" "bar")), and similarly the current directory can only be portably specified as #.(make-pathname :directory '(:relative)). However, as of ASDF 2, you can portably use a string to denote a pathname. The string will be parsed as a /-separated path from the current directory, such that the empty string "" denotes the current directory, and "foo/bar" (no trailing / required in the case of modules) portably denotes the same subdirectory as above. When files are specified, the last /-separated component is interpreted either as the name component of a pathname (if the component class specifies a pathname type), or as a name component plus optional dot-separated type component (if the component class doesn’t specifies a pathname type).


Next: How do I create a system definition where all the source files have a .cl extension?, Previous: “How can I maintain non-Lisp (e.g. C) source files?”, Up: Issues with using and extending ASDF to define systems   [Contents][Index]