view misc/mymake.sh @ 652:58c2aea237ad

Fixed spelling.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 26 Mar 2020 17:06:43 +0200
parents 4caff13871e8
children
line wrap: on
line source

#!/bin/bash

shopt -s extglob

opt=
for (( i=2; i <= ${#@}; i++ )); do
  if [[ ${@:$i-1:1} = -f ]]; then
    fname=${@:$i:1}
    break;
  fi
done

execute() {
  echo "** cd $PWD"
  echo "**" "$@"
  exec "$@"
}

dir="$PWD"
while [[ -n "$dir" ]]; do
  cd "$dir"
  if [[ $fname == *[mM]ake* ]]; then
    if [[ -f "$dir"/"$fname" ]]; then
      execute make "$@"
    fi
  fi
  if [[ -f "$dir"/Makefile ]]; then
    execute make "$@"
  fi
  if [[ -f "$dir"/build.xml ]]; then
    execute ant -e "$@"
  fi
  if [[ -f "$dir"/pom.xml ]]; then
    execute mvn "$@"
  fi
  if [[ -f "$dir"/build.gradle ]]; then
    execute gradle "$@"
  fi
  if [[ -f "$dir"/SConstruct ]]; then
    execute scons "$@"
  fi
  if [[ -f "$dir"/Gruntfile.js ]]; then
    execute grunt "$@"
  fi
  dir=${dir%/*}
done

echo "Haven't found any build scripts."
exit 1