#!/bin/sh
#
# Syntax: make_modules target modules...
#
#   "target" is the make target, i.e. "install", "doc", or "clean"
#   "modules" are the directories containing the modules, separated
#   by spaces.
#
# Simple shell script to step thru all directories given in the
# command line, and invoke "make target" on all of them.
#
# If make fails for a directory, echo a failure list and return
# an error code. Note that even if a module fails to compile, the
# remaining modules will be compiled anyway.
#
# (C) 1997 Patrick Schemitz
#

target=$1
shift
failures=""
for i in $*; do
  echo "Making $target in $i ..."
  cd ./$i && make $target
  if [ "$?" != "0" ]; then
	failures="$failures $i"
  fi
  cd -
done
if [ "$failures" != "" ]; then
  echo "The following modules failed to compile:"
  echo $failures
  exit 1
fi
exit 0
