lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Lake [1] is a modern cross-platform build tool with support for parallel builds, implemented entirely in one 3.4KLoc Lua file [6] plus luafilesystem. (You will need in addition either luaposix or winapi to do parallel builds and set environment variables however). Full ldoc documentation is available here [0].

Despite the consensus of the wise [5] I still think it's useful to have a self-contained build tool that works on all major operating systems, with the two major compilers, MSVC and GCC. Lake directly executes dependency rules, and it is now getting pretty fast at doing this.  There are some advantages to not generating makefiles: the actions can be _functions_, and the targets can be _objects_.

Lake can compile and run simple programs directly:

    $> lake hello.c one two "three 3"
    gcc -c -O1 -Wall -MMD  hello.c -o hello.o
    gcc hello.o  -Wl,-s -o hello.exe
    hello.exe one two three
    hello, world!
    0 hello.exe
    1 one
    2 two
    3 three 3

(If you then ran the same command in a MSVC prompt on Windows, it would use cl.exe instead)

But generally everything is done with lakefiles:

c.program{'hello',src="" utils',needs='math'}

Underneath this specialized machinery is a classic dependency-resolver using explicit targets, so one can do very make-ish things:

    ccmd = 'cp $(DEPENDS) $(TARGET)'
    target('all','sgm.bak, test.bak')

This release now comes with a plugin system (since even I realized that one big file was not going to scale :)).  For instance, on Windows you can download support for C# and thereafter can compile & run at will, just as with the built-in C/C++ support.

$> lake -install get:clr.lang.lua
$> lake MyClass.cs
csc -nologo  -optimize MyClass.cs
hello frodo

This is a release candidate, so any comments are welcome.  I appreciate that this is a Lua _application_ and not necessarily a reusable component, so this will be the last release announced here; afterwards it's on its own.

Get it through LuaRocks through [2]; once the release is stablized it will end up in the main LuaRocks repo. There's a .deb package [4] for Debian/Ubuntu systems, and a complete standalone Windows 32-bit executable [3] courtesy of the luabuild project.  (This is a useful tool to have around in Windows-land; a complete little mini Lua 5.2 installation with luafilesystem and winapi that's about 340Kb)

(If someone can lend me shell access to a OS X box I can make a binary for the Others)

steve d.

[6] Note for newbies: this really isn't a good idea. One day I might go on a refactoring orgy.