Created
August 12, 2013 05:12
-
-
Save miekg/6208366 to your computer and use it in GitHub Desktop.
When doing cgo I get confused when to type make (to compile C code) or when to type go build (to compile Go code). Also in Vim you use :make, so to stop any confusing I'm using the following function. This allows me to always use 'make'.
This file contains hidden or 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
make() { | |
if [[ -f Makefile || -f GNUMakefile ]]; then | |
command make "$@" | |
return | |
fi | |
go build | |
# if go build failed with exit code 1, the build env wasn't | |
# correct, in that case, try make again | |
if [[ $? -eq 1 ]]; then | |
command make "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment