Subject: Re: request comments: simple c program builder in lisp
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 15 Jun 2008 05:53:24 -0500
Newsgroups: comp.lang.lisp
Message-ID: <OOydncp6db45acnVnZ2dnUVZ_sLinZ2d@speakeasy.net>
<parth.malwankar@gmail.com> wrote:
+---------------
| I am fairly new to Lisp and am trying to write a simple build tool
| for C files in order to learn lisp. I am not really interested in any
| advanced features for the build system yet as the main intent is to
| learn Lisp.
+---------------

Understood, and *welcome*!

That said, at some point [though probably not now!] you should
take a look at the various packages/libraries listed here:

    http://www.cliki.net/development

and especially at these:

    http://www.cliki.net/asdf          [currently quite popular]
    Another System Definition Facility

    http://www.cliki.net/mk-defsystem  [much older, but still used by some]
    MK-defsystem is a system definition utility; it fills a similar
    role for CL Development as make(1) does for C. ...

Note that ASDF (and possibly MK-DEFSYSTEM?) already has some hooks for
C source files, though you will have to define your own specializations
of the PERFORM method for the COMPILE-OP and LOAD-OP operations, as it
tends to be very application- and/or platform- and/or implementation-
dependent. [E.g. What do you want to *do* with your compiled C code?
Run it?  Build a DSO & link to it?] But several of the readily-available
CL libraries have useful examples in their ".asd" files:

    http://www.cliki.net/Osicat
    http://www.cliki.net/Linedit
    http://www.cliki.net/db-sockets
    http://www.cliki.net/CL-Ncurses

They're all pretty similar in their handling of C files. The main
thing you might have to do is tweak the RUN-SHELL-COMMAND calls
[and/or extend the definition of RUN-SHELL-COMMAND in "asdf.lisp"
if your platform or CL implementation isn't supported].


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607