#!/bin/csh
#The following files are used by NoImake:
#     NoImake.cpp contains variable definitions and machine specific flags
#     NoImake.m4  contains Imake-rules in form of m4 macro definitions
#
# Martin Karrenbach  8-25-92

echo "You are running an Imake substitute to create: Makefile"
if ( "$1" == "" ) then 
echo "You can give the optional argument: SUN4, RS6000, HP700 or DEC3100"
endif
echo "You may have to edit the file:"
echo "      NoImake.cpp"
echo "to set machine specific flags and rerun NoImake."


if ( "$1" == "" ) then 
cat NoImake.cpp Imakefile | /lib/cpp      > Makefile.tmp
else
cat NoImake.cpp Imakefile | /lib/cpp -D$1 > Makefile.tmp
endif
m4 NoImake.m4 Makefile.tmp > Makefile
rm -f Makefile.tmp

foreach dir ( generator help )
  echo making  Makefile in $dir
  cd $dir;
  if ( "$1" == "" ) then
    cat ../NoImake.cpp Imakefile | /lib/cpp      > Makefile.tmp
  else
    cat ../NoImake.cpp Imakefile | /lib/cpp -D$1 > Makefile.tmp
  endif
  m4 ../NoImake.m4 Makefile.tmp > Makefile
  rm -f Makefile.tmp
  cd ..
end

foreach dir ( examples )
  echo making  Makefile in $dir
  cd $dir;
  if ( "$1" == "" ) then
    cat ../NoImake.cpp Imakefile | /lib/cpp      > Makefile.tmp
  else
    cat ../NoImake.cpp Imakefile | /lib/cpp -D$1 > Makefile.tmp
  endif
  m4 ../NoImake.m4 Makefile.tmp > Makefile
  rm -f Makefile.tmp

  foreach subdir ( commandline script )
  echo making  Makefile in $dir/$subdir
  cd $subdir;
  if ( "$1" == "" ) then
    cat ../../NoImake.cpp Imakefile | /lib/cpp      > Makefile.tmp
  else
    cat ../../NoImake.cpp Imakefile | /lib/cpp -D$1 > Makefile.tmp
  endif
  m4 ../../NoImake.m4 Makefile.tmp > Makefile
  rm -f Makefile.tmp
  cd ..
  end
  cd ..
end

