#!/bin/csh -f

set rootdir = `pwd`

#
# SING library : lower level APIs for GRAPE-DR chip.
#
cd singutil
make
set s = ${status}
cd ${rootdir}
if (${s} != 0) then
  echo ''
  echo -----------------------
  echo 'Installation failed.'
  echo -----------------------
  exit 1
endif

#
# mkdist : create initial distribution of particles in NEMO stoa format.
#
cd misc/mkdist
make mkdist
set s = ${status}
cd ${rootdir}
if (${s} != 0) then
  echo ''
  echo -----------------------
  echo 'Installation failed.'
  echo -----------------------
  exit 1
endif

#
# snapshots used by sample codes.
#
cd init
set mkdist = ${rootdir}/bin/mkdist
set infile = (pl1k pl2k pl4k pl8k pl16k pl32k pl64k)
set nbody  = (1024 2049 4095 8192 16384 32768 65536)
set i = 1
while (${i} <= ${#infile})
  if (! -f ${infile[${i}]}) then
    ${mkdist} ${nbody[${i}]} 1 ${infile[${i}]}
  endif
  @ i++
end

echo ''
echo done
echo ''
