Re: C-compilation with ASDF.
Daniel Barlow <[email protected]>
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
"Johannes Grødem" <[email protected]> writes: > I did this draft on how C-compilation might be done in ASDF. I'm not > sure this is the Right Way, but you can have a look and tell me what > you think. Nobody else has an opinion? OK, here's my opinion. There are two kinds of information typically found in a Makefile: dependencies, and rules. I think we should use Makefiles for the rules, but continue to put the dependencies in asdf Justification: (1) dependencies in asdf because as you say > but I'm thinking people will mostly be using ASDF to build simple > wrappers that they need to call C-code, not large C-projects. so there's no point in teaching make how to rebuild everything (if people want to do this, they can after all just use make). Also for asdf->cclan-package-translators (e.g. the debian packager) we want to be able to tell what all the files worth packaging are, from lisp. (2) rules (primarily configuration stuff) in Makefiles because > Also, I'm unclear on whether ASDF-files are meant to be edited by the > user or whether they're supposed to just work with no hassle. > (I.e. setting include-paths, library-paths, etc.) Really and ideally, the latter. Putting rules in Makefiles allows people to continue to use all their usual tools for Makefile generation (autoconf, automake, gtk-config --cflags, etc) - cloning all this stuff in asdf would be boring and liable to go out of date very quickly. I suggest something along the lines of (defclass makefile-driven-source-file (source-file) ()) (defclass c-source-file (makefile-driven-source-file) ()) (defmethod output-files ((op compile-op) (c c-source-file)) (list (make-pathname :type "o" :defaults (component-pathname c)))) (defmethod perform ((op compile-op) (c makefile-driven-source-file)) (unless (zerop (run-shell-command "~A ~{~A ~}" (or (getenv "MAKE") "make") (mapcar #'unix-name (output-files op c)))) (error 'operation-error :operation op :component c))) Other kinds of files that make knows how to build can also subclass makefile-driven-source-file, and just need new output-files methods (P.S. This sample code won't actually work as-is because of what-is-the-current-directory issues that I haven't thought about yet. Also, makefile-driven-source-file is a grotesquely ugly name) What do people think? -dan -- http://ww.telent.net/cliki/ - Link farm for free CL-on-Unix resources ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en