build.zsh/build/moon.zsh

67 lines
1.1 KiB
Bash

function MOON {
echo "${fg_bold[yellow]} [MOON] ${fg_bold[white]}$@${reset_color}"
}
function moon.build {
write -n "${target}:"
typeset -l S
if [[ -n "${sources[$target]}" ]]; then
S="${sources[$target]}"
elif [[ -e "${target%.lua}.moon" ]]; then
S="${target%.lua}.moon"
fi
if [[ -n "${S}" ]]; then
write " ${S} $(dirdep $target)"
write "\t@echo '$(MOON "${target}")'"
if [[ -z "${install[$target]}" ]]; then
write "\t${Q}echo '#!/usr/bin/env lua' > '${target}'"
write "\t${Q}moonc -p $S >> '${target}'"
write "\t${Q}chmod +x '${target}'"
else
write "\t${Q}moonc -p $S > '${target}'"
fi
fi
write "\n"
}
function moon.install {
binary.install "$@"
}
function moon.uninstall {
binary.uninstall "$@"
}
function moon.clean {
typeset -l S
if [[ -n "${sources[$target]}" ]]; then
S="${sources[$target]}"
else
S="${target%.lua}.moon"
fi
write "${target}.clean:"
if [[ -e "${S%% *}" ]]; then
write "\t@echo '$(RM ${target})'"
write "\t${Q}rm -f ${target}"
fi
write
}
function moon.distfiles {
if [[ -e "${target}.moon" ]]; then
echo "${target}.moon"
else
echo "${target}"
fi
}