-
-
Save iserdmi/395e0406bcfc563a0f1128e1a8055bb5 to your computer and use it in GitHub Desktop.
Call Makefile from child directory
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
m() { | |
findfiledir() { | |
if [ -f "$1" ]; then | |
echo "$PWD" | |
elif [ "$PWD" = / ]; then | |
false | |
else | |
(cd .. && findfiledir "$1") | |
fi | |
} | |
initdir=$(pwd) | |
makefiledir=$(findfiledir Makefile) | |
if [ -n "$makefiledir" ]; then | |
cd "$makefiledir" | |
make "$@" | |
cd "$initdir" | |
else | |
echo "Makefile does not exists in parent directories" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.