smake

Artifact [585479a1e3]
Login

Artifact 585479a1e336c942c95cc19808f81f032da22900:

Wiki page [smake] by anonymous 2011-06-14 18:05:48.
D 2011-06-14T18:05:48.386
L smake
P ed5ed49b352cad3b1833db58fef7ac2ddcea4efe
U anonymous
W 2180
<code>smake</code> is an easy to use utility that allows developers to build makefiles with a fully capable, yet extremely easy to use script language, [http://www.tcl.tk|Tcl]. This allows one to use all the facilities that Tcl provides to deal with large projects like namespaces, packages, database access etc. With the traditional UNIX <code>make</code> this is difficult and often ugly hacks are involved. Plus, with Tcl you can easily replace the dependency checking routines to suit the needs of the project (f.ex. to automatically check and fetch new versions of the file from the net, without having to specify the operation for each target). smake includes a fairly sophisticated but easy to understand rule system, which (unlike make) offers the possibility to specify general rules and more specific exceptions to these rules

Tcl is a syntactically simple, portable but powerful language which is easy to learn and expand. It takes less than an hour to learn enough to be able to create sophisticated makefiles for <code>smake</code> (a simple example is included in the documentation). Basic <code>make</code> style makefiles can be built with <code>smake</code> without even that knowledge, as the <code>smake</code> syntax is extremely straightforward and clear to understand.

<h2>Example</h2>

This is a very simple dislay of a Smakefile. It specifies targets, with code to execute if the dependencies have been updated. Note that the code within each target block is executed every time a target is checked, while the <code>depend</code> block is executed only if one of the dependencies have changed. By default, the target is marked as 'changed' if its dependency block is run, but this can be overridden.

<pre>
target hello.o { 
  depend {foo.h main.c} {
    compile main.c 
  }
}
target foo.o {
  depend {foo.c foo.h} {
    compile foo.c
  }
}
target testiprg {
  depend {foo.o main.o} {
    link testiprg {foo.o main.o} Tcl8.0
  }
}
target all {
  depend testiprg {}
}
</pre>

<hr><div id="d86646156f288bc2"><i>On 2011-06-14 18:05:48 UTC anonymous added:</i><br />
This looks amazing. Good luck to ya.</div id="d86646156f288bc2">
Z 52191a00f9638f431429228fee1a1ae8