All Articles

サブディレクトリからもmakeしたい

#!/bin/sh
MPATH=$PWD
MAKECOMMAND=$(which make)
if [ "${MAKECOMMAND}" = "" ]; then
echo "make command could't find in your \$PATH. Did you install it?"
exit 1
fi
while :; do
if [ -f "${MPATH}/Makefile" ]; then
break
elif [ "${MPATH}" = "/" ]; then
echo "Couldn't find up Makefile."
exit 1
fi
MPATH=$(cd "$(dirname "${MPATH}")"; pwd) || exit
done
cd "${MPATH}" && make "$@"
view raw fumake hosted with ❤ by GitHub

そういうこと。