#! /bin/csh -f
# script to make directories and links for an architecture
# modified from the Ptolemy MAKEARCH script
#
# Author: Brian L. Evans
# Version: @(#)MAKEARCH	1.2	01/08/98

if (! $?PTARCH ) then
	echo The environment variable PTARCH must be set.
	exit 1
endif

# optmkdir -- make a directory if it does not exist
alias optmkdir \
'if ( ! -d \!:1 ) echo making directory $cwd/\!:1 ; if ( ! -d \!:1 ) mkdir \!:1'

# optlink -- make a symbolic link if it does not exist, from a file in a
# different directory to the same name in this directory.  args: dir filename

alias optlink \
'if ( ! -e \!:2 ) echo making link \!:1/\!:2 ; if ( ! -e \!:2 ) ln -s \!:1/\!:2 .'

# optdifflink -- make a symbolic link if it does not exist, with a different
# name

alias optdifflink \
'if ( ! -e \!:2 ) echo `pwd`: making link \!:1 \!:2 ; if ( ! -e \!:2 ) ln -s \!:1 \!:2 '

# Quiet versions of pushd and popd.
alias pushd 'pushd \!* > /dev/null'
alias popd 'popd \!* > /dev/null'

# Make the top-level directories
optmkdir bin.$PTARCH
optmkdir obj.$PTARCH

# Now, make stuff under obj.$PTARCH

cd obj.$PTARCH
optlink ../src makefile

# This is for the top-level makefile
touch obj.$PTARCH
