Skip to content

Instantly share code, notes, and snippets.

@Milly
Created January 27, 2009 04:19
Show Gist options
  • Save Milly/53175 to your computer and use it in GitHub Desktop.
Save Milly/53175 to your computer and use it in GitHub Desktop.
autorun make or ant
#!/bin/sh
MAKECMD=/usr/bin/make
# ANTCMD=/usr/local/bin/ant
ANTCMD=/cygdrive/c/dev/ant/bin/ant
FILTER="/usr/bin/nkf -Swud"
if [ -r Makefile -o -r makefile ]; then
"$MAKECMD" "$@"
elif [ -r build.xml ]; then
[ -x "$FILTER" ] && filter="2>&1|$FILTER"
case `uname` in
CYGWIN*)
awkprg=$(cat <<-'EOS'
BEGIN {
file="\\<[A-Za-z]:(\\\\[^\\\\/:*?\"<>|]+)+\\\\?"
}
{
if (match($0, file)) {
cmd=("cygpath -u '" substr($0, RSTART, RLENGTH) "'");
cmd |getline cygfile;
close(cmd);
sub(file, cygfile)
}
print
}
EOS)
filter="$filter|awk \"\$awkprg\""
;;
esac
eval "'$ANTCMD' \"\$@\" $filter"
else
echo 'Makefile or build.xml not found.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment