Created
December 15, 2009 13:50
-
-
Save luontola/256946 to your computer and use it in GitHub Desktop.
Commands for easily compiling and testing Go programs in Gedit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
get_topmost_makefile() { | |
dir=$1 | |
while test "$dir" != "/"; do | |
makefile=`get_makefile $dir` | |
if [ "$makefile" != "" ]; then | |
topmost=$makefile | |
else | |
echo "$topmost" | |
exit | |
fi | |
dir=`dirname "$dir"` | |
done | |
} | |
get_makefile() { | |
dir=$1 | |
for m in GNUmakefile makefile Makefile; do | |
if [ -f "${dir}/${m}" ]; then | |
echo "${dir}/${m}" | |
exit | |
fi | |
done | |
} | |
makefile=`get_topmost_makefile $GEDIT_CURRENT_DOCUMENT_DIR` | |
if [ "$makefile" == "" ]; then | |
echo "No Makefile found!" > /dev/stderr | |
exit 1 | |
fi | |
echo "Using makefile:" | |
echo "$makefile" | |
dir=`dirname "$makefile"` | |
make -C "$dir" -s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
get_topmost_makefile() { | |
dir=$1 | |
while test "$dir" != "/"; do | |
makefile=`get_makefile $dir` | |
if [ "$makefile" != "" ]; then | |
topmost=$makefile | |
else | |
echo "$topmost" | |
exit | |
fi | |
dir=`dirname "$dir"` | |
done | |
} | |
get_makefile() { | |
dir=$1 | |
for m in GNUmakefile makefile Makefile; do | |
if [ -f "${dir}/${m}" ]; then | |
echo "${dir}/${m}" | |
exit | |
fi | |
done | |
} | |
makefile=`get_topmost_makefile $GEDIT_CURRENT_DOCUMENT_DIR` | |
if [ "$makefile" == "" ]; then | |
echo "No Makefile found!" > /dev/stderr | |
exit 1 | |
fi | |
echo "Using makefile:" | |
echo "$makefile" | |
echo | |
dir=`dirname "$makefile"` | |
make -C "$dir" -s test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment