build.zsh/build/script.zsh

62 lines
1015 B
Bash
Raw Normal View History

2014-11-05 13:32:11 +01:00
function script.build {
typeset -l S
if [[ -n "${sources[$target]}" ]]; then
S="${sources[$target]}"
elif [[ -e "${target}.in" ]]; then
S="${target}.in"
fi
2014-11-05 13:32:11 +01:00
write -n "${target}:"
if [[ -n "${S}" ]]; then
write " $S $(dirdep $target)"
write "\t@echo '$(SED "${target}")'"
write -n "\t${Q}sed -e '"
for variable value in ${prefixes[@]} ${variables[@]}; do
write -n "s&@${variable}@&\$(${variable})&;"
done
write "' $S > '${target}'"
write "\t${Q}chmod +x '${target}'"
2014-11-05 13:32:11 +01:00
fi
write "\n"
}
function script.install {
binary.install "$@"
}
function script.uninstall {
binary.uninstall "$@"
}
function script.clean {
typeset -l S
if [[ -n "${sources[$target]}" ]]; then
S="${sources[$target]}"
else
S="${target}.in"
fi
2014-11-05 13:32:11 +01:00
write "${target}.clean:"
if [[ -e "${S%% *}" ]]; then
2014-11-05 13:32:11 +01:00
write "\t@echo '$(RM ${target})'"
write "\t${Q}rm -f ${target}"
fi
write
}
function script.distfiles {
if [[ -e "${target}.in" ]]; then
echo "${target}.in"
else
echo "${target}"
fi
}