Created
March 30, 2017 15:49
-
-
Save JacobHayes/b98d34300f88fe00f929d0319433f25a to your computer and use it in GitHub Desktop.
`make` wrapper to find `Makefile` in parent directory
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
# Add to shell's profile/rc | |
make() { | |
base_dir="${PWD}" | |
( | |
while [ "${PWD}" != '/' ] && [ ! -e 'Makefile' ]; do | |
cd .. | |
done | |
if [ -e 'Makefile' ]; then | |
command make "${@}" | |
else; | |
echo "Unable to find a Makefile" | |
fi | |
) && cd "${base_dir}" || cd "${base_dir}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment