A compromise between the speed of make and the ease of use of a build script
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
moonbuild/Build.moon

21 lines
699 B

SOURCES_MOON = wildcard 'moonbuild/**.moon'
BINARY = 'bin/moonbuild.moon'
OUT_LUA = patsubst SOURCES_MOON, '%.moon', '%.lua'
BINARY_LUA = patsubst BINARY, '%.moon', '%.lua'
OUT_AMALG = 'moonbuild.lua'
public target 'clean', fn: =>
-rm '-f', OUT_LUA
public target 'info', fn: =>
#echo "Moonscript sources:", SOURCES_MOON
#echo "Compiled lua:", OUT_LUA
default target 'compile', from: OUT_AMALG
target OUT_AMALG, from: {BINARY_LUA, OUT_LUA}, out: OUT_AMALG, fn: =>
modules = foreach (patsubst OUT_LUA, '%.lua', '%'), => @gsub '/', '.'
-Command 'amalg.lua', '-o', @outfile, '-s', 'bin/moonbuild.lua', modules
target '%.lua', in: '%.moon', out: '%.lua', fn: =>
-moonc @infile