muse1.7b4/
muse1.7b4/config/
muse1.7b4/doc/
muse1.7b4/run/
muse1.7b4/run/db/
muse1.7b4/src/
muse1.7b4/src/db/
muse1.7b4/src/files/
muse1.7b4/src/io/
muse1.7b4/src/prog/
muse1.7b4/src/util/
#!/usr/local/bin/bash
# $Id: domakefile,v 1.4 1993/10/09 16:20:43 nils Exp $
# create 'Makefile' out of 'makedefs'

rm -f Makefile

exec 1>Makefile

. makedefs
. $topdir/config/global.makedefs

echo '# Automatically generated from "domakefile" script. Do not edit by hand.'
echo '#'

echo 'CC = ' $cc
echo 'CFLAGS = '$cflags' -I'$topdir'/src/hdrs -I'$topdir'/config'
echo 'TOPDIR = '$topdir
echo 'LIBS = -L/usr/local/lib '$clibs
if [ "x$makedepend" != "x" ]; then
  echo 'MKDEP = '$makedepend
fi

allthings=

if [ "x$subdirs" != "x" ]; then
  # we have to create makefiles for all the subdirs, and also run
  # make all in all the subdirs
  allthings="$allthings makefiles suball"
fi

if [ "x$main" != "x" ]; then
  # we have to compile a large program
  allthings="$allthings $main"
fi

if [ "x$lib" != "x" ]; then
  # we have to create a library.
  allthings="$allthings $lib"
fi

if [ "x$utils" != "x" ]; then
  # we have to compile small utility programs.
  allthings="$allthings $utils"
fi

echo
echo 'all: ' $allthings
echo
echo 'install: all'

if [ "x$subdirs" != "x" ]; then
  # we have to run make install in all the subdirs
  for i in $subdirs
  do
    echo '	cd '$i';${MAKE} install'
  done
fi

if [ "x$main" != "x" ]; then
  # install the main program in the bin directory.
  if [ ! -d $topdir/bin ]; then mkdir $topdir/bin; fi
  echo '	-mv -f '$topdir/bin/$main $topdir/bin/$main'~'
  echo '	'$install $main $topdir/bin
fi

if [ "x$utils" != "x" ]; then
  # install the util programs in the bin directory.
  if [ ! -d $topdir/bin ]; then mkdir $topdir/bin; fi
  for i in $utils
  do
    echo '	-mv -f '$topdir/bin/$i $topdir/bin/$i'~'
    echo '	'$install $i $topdir/bin
  done
fi

echo

# now for the miscelaneous targets

if [ "x$main" != "x" ]; then
  echo $main: $objs $libfiles
  echo '	$(CC) -o '$main $cflags $objs $libfiles $libs
  echo
fi

if [ "x$lib" != "x" ]; then
  echo $lib: $objs
  echo '	'rm -f $lib
  echo '	'$ar $lib $objs
  if [ "x$ranlib" != "x" ]; then
    echo '	'$ranlib $lib
  fi
fi

if [ "x$subdirs" != "x" ]; then
  subdeflist=
  for i in $subdirs; do
    subdeflist="$subdeflist $i/Makefile"
  done
  echo 'makefiles: '$subdeflist
  echo

  for i in $subdirs; do
    echo $i/Makefile: $topdir'/src/domakefile '$topdir'/config/global.makedefs '$i/makedefs
    echo '	cd '$i';../'$topdir'/src/domakefile'
    echo
  done
fi

if [ "x$subdirs" != "x" ]
then
  echo 'suball:'
  for i in $subdirs; do
    echo '	cd '$i';${MAKE} all'
  done
fi

if [ "x$srcs" != "x" -a "x$mkdep" != "x" ]
then
  eval $mkdep $srcs
fi