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

31 lines
905 B

4 years ago
SOURCES_MOON = wildcard '*.moon'
exclude SOURCES_MOON, 'Build.moon'
OUT_LUA = patsubst SOURCES_MOON, '%.moon', '%.lua'
BINARY = 'moonbuild'
MAIN = "#{BINARY}.moon"
MAIN_LUA = patsubst MAIN, '%.moon', '%.lua'
OUT_C = patsubst MAIN, '%.moon', '%.lua.c'
PREFIX = env 'PREFIX', '/usr/local'
INSTALL_LOC = "#{PREFIX}/bin"
4 years ago
public target 'install', from: BINARY, out: INSTALL_LOC, fn: =>
-install @infile, @outfile
4 years ago
public target 'clean', fn: =>
-rm '-f', OUT_LUA
-rm '-f', OUT_C
public target 'mrproper', deps: 'clean', fn: =>
-rm '-f', BINARY
public target 'info', fn: =>
#echo "Moonscript sources:", SOURCES_MOON
#echo "Compiled lua:", OUT_LUA
#echo "Binary:", BINARY
default target BINARY, out: {BINARY, OUT_C}, from: OUT_LUA, fn: =>
-luastatic MAIN_LUA, OUT_LUA, (findclib 'lua5.3', 'all')
4 years ago
target '%.lua', in: '%.moon', out: '%.lua', fn: =>
-moonc @infile