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
914 B

5 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"
5 years ago
public target 'install', from: BINARY, out: INSTALL_LOC, fn: =>
-install @infile, @outfile
5 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: =>
5 years ago
-luastatic MAIN_LUA, OUT_LUA, '-I/usr/include/lua5.3', '-llua5.3'
target '%.lua', in: '%.moon', out: '%.lua', fn: =>
-moonc @infile