Script lake

Lake – a build framework in Lua.

Freely distributable for any purpose, as long as copyright notice is retained.

Lake version 1.4  A Lua-based Build Engine
  lake <flags> <assigments> <target(s)>
    -v verbose
    -t test (show but don't execute commands)
    -n don't synthesize target
    -d initial directory
    -b basic print (don't show full commands)
    -s don't compile strictly
    -g debug build  (also DEBUG=1)
    -j N run jobs in parallel where possible. (requires winapi or luaposix)
    -f FILE read a named lakefile
    -e EXPR evaluate a lakefile expression
    -l FILE build a shared library/DLL
    -lua FILE build a Lua C extension
    -p FILE build a program
    -w write out unsatisfied needs to lakeconfig.lua
    -lua FILE build a Lua binary extension
    -install FILE install a new need or language
    -C really clean a directory tree!

  assignments: arguments of the form VAR=STRING assign the string
    to the global VAR. The env variable LAKE_PARMS may contain
    extra assignments, which occur before any other configuration file is loaded.

  target(s): any targets of the lakefile; if a file with a recognized
    extension, build and run, passing any remaining arguments, unless -n
    is specified. Lua scripts are run directly using Lake and have access
    to all defined libraries.

Without target arguments, use a file called 'lakefile' or 'lakefile.lua'

configuration: loads ‘~/.lake/config.lua’ and ‘./lakeconfig.lua’ if it exists. Will then load LAKE_CONFIG_FILE if defined. require path is extended to also start at ~/.lake. Plugins are loaded into this module path:

  • lake.lang.FOO defines a new language FOO
  • lake.needs.BOO defines a new need BOO

Installing a language plugin causes it to be required from ~/.lake/config.lua; needs plugins are loaded when resolving unknown needs.


  • Copyright: Steve Donovan, 2007-2013
  • License: X11/MIT (And remember my dog did not eat your homework)


configuration_globals Globals understood by Lake
globals Globals provided by Lake
program_fields Fields understood by library and program, etc.


Globals understood by Lake


  • LAKE_CONFIG_FILE extra configuration file
  • CC the C compiler (gcc unless cl is available)
  • CXX the C++ compiler (g++ unless cl is available)
  • STRICT do not compile strictly (also -s command-line flag)
  • DEBUG debug build (also -g command-line flag)
  • PREFIX (empty string). e.g. PREFIX=arm-linux makes CC become arm-linux-gcc etc
  • NEEDS (nil) any additional needs for the build
  • M32 (false) do a 32-bit build on 64-bit platform if possible (-m32)
  • FULL_OUTPUTNAME (false) build a unique output name for targets from their name and dir
  • LUA_INCLUDE_DIR (deduced) Lua include directory for ‘lua’ need
  • IGNORE_LUAROCKS (false) don’t use Lua configuration from luarocks if installed.
  • LUA_LIB_DIR (deduced) Lua library directory
  • WINDOWS true for Windows builds
  • BUILD_PLAT build platform deduced from uname if not windows, ‘Windows’ otherwise
  • PLAT actual target platform, usually the same as BUILD_PLAT
  • MSVC true if we're using cl.exe
  • COMBINE allow the compiler to compile multiple files at once (if it is capable)
  • NODEPS don’t do automatic dependency generation or checking
  • REMOTE_LAKE_URL Default download location for ‘get’ pseudo-protocol
  • NEW_HOME (nil) overrides default for path.expanduser ‘~’
  • _DEBUG (false) don’t suppress Lua stack trace – useful for debugging Lake.
Globals provided by Lake


  • PWD current working directory
  • LOCAL_EXEC how to execute local programs (is ./ on Unix)
  • EXE_EXT extension of programs on this platform
  • DLL_EXT extension of shared libraries on this platform
  • DIRSEP directory separator on this platform
Fields understood by library and program, etc.


  • name name of target (or first value of table)
  • lua build against Lua libs (rather use needs='lua')
  • args any default arguments (works like lang.defaults, doesn’t override)
  • needs higher-level specification of target link requirements
  • libdir list of lib directories
  • libs list of libraries
  • libflags list of flags for linking
  • subsystem (Windows) GUI application (default false)
  • def (Windows) explicit .def file
  • strip strip symbols from output (default true)
  • inputs explicit set of compile targets
  • shared a DLL or .so (with lang.library)
  • dll a DLL or .so (with lang.library)
  • deps explicit dependencies of a target (or subsequent values in table)
  • compile_deps explicit dependencies of source files
  • export this executable exports its symbols
  • dynamic link dynamically against runtime (default true for GCC, override for MSVC)
  • static statically link this target
  • headers explicit list of header files (not usually needed with auto deps)
  • odir output directory; if true then use ‘debug’ or ‘release’; if non-nil use it as output directory directly; prepends PREFIX
  • output_directory same as odir
  • src src files, may contain directories or wildcards (extension deduced from lang or ext)
  • exclude a similar list that should be excluded from the source list (e.g. when src='*')
  • recurse recursively find source files specified in src=wildcard
  • ext extension of source, if not the usual. E.g. ext='.cxx'
  • defines C preprocessor defines
  • incdir list of include directories
  • flags extra compile flags
  • cflags same as flags
  • cdir run tool in this directory
  • compile_directory same as cdir
  • debug override global default set by -g or DEBUG variable
  • optimize override global default set by OPTIMIZE variable
  • strict strict compilation of files (default true)
  • base base directory for source and includes
  • precompiled_header provide a header to be precompiled and used
  • llua name of Lua module being built
  • m32 32-bit build on 64-bit platform
  • framework (OS X) link against framework
  • framework_dir (OS X) provide framework path
  • universal (OS X) universal 32bit/64bit Intel binary
  • min_version (OS X) minimum OS X version (default 10.5)
generated by LDoc 1.3.12