#!/bin/csh

# ################## ArchTOIPipe-With-Sophya #################### 
# ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA #####
#  Script for setting up ArchTOIPipe build/install directory
# ###############################################################  

if( $#argv < 1 ) then
  echo "crerep_pipe <nom des repertoires> [nom_machine-compilateur]"
  echo " - ex: crerep_pipe "\$"GROUP_DIR/PeidaWork HP-UX"
  echo " - possibilites nom_machine-compilateur"
  echo "    [AIX-xlC AIX-g++ HP-UX-aCC HP-UX-g++ OSF1-cxx OSF1-g++ Linux-g++ ...]"
  if($?EROSCXX) then
    echo "    defaut: `uname`-$EROSCXX"
  else
    echo "    pas de defaut donnez explicitement nom_machine-compilateur"
  endif
  exit -1
endif

set dirl = $1
if ( ! -e ${dirl} ) then
  echo ATTENTION REPERTOIRE INEXISTANT:
  echo ${dirl}
  exit -1
endif
echo "rep. de base: ${dirl}"

shift
if( $#argv > 0 ) then
  set diru = $1
  echo "machine-compilateur: ${diru}"
else if ($?EROSCXX) then
  echo uname=`uname` EROSCXX = $EROSCXX
  set diru = `uname`-$EROSCXX
  echo "AUTOMATIQUE machine-compilateur: ${diru}"
else
  echo "precisez nom_machine-compilateur ou EROSCXX"
  exit -1
endif

foreach d ( ${dirl}/${diru} \
            ${dirl}/Include \
            ${dirl}/${diru}/Exec \
            ${dirl}/${diru}/Libs ${dirl}/${diru}/ShLibs \
            ${dirl}/${diru}/Objs )
  if ( -e $d ) then
    echo "rep. existant: $d"
  else
    echo "rep. cree: $d"
    mkdir $d
  endif
end

exit 0

