Skip to content

Instantly share code, notes, and snippets.

@JacobHayes
Created March 30, 2017 15:49
Show Gist options
  • Save JacobHayes/b98d34300f88fe00f929d0319433f25a to your computer and use it in GitHub Desktop.
Save JacobHayes/b98d34300f88fe00f929d0319433f25a to your computer and use it in GitHub Desktop.
`make` wrapper to find `Makefile` in parent directory
# 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