# Create src directory.

# if (-e src) then
#    mv src osrc
# endif

mkdir src

chmod 755 src

pushd src > /dev/null

#set list = (rlisp rend arith alg poly mathpr matrix hephys solve    \
#    ezgcd factor int algint rcref rprint pretty cedit arnum \
#    gentran dipoly groebnr2 groebner roots compact scope    \
#    specfaux specfn specfn2 spde  taylor tps misc odesolve   \
#    avector orthovec excalc)

set list = (rlisp rend arith alg poly mathpr matrix hephys solve    \
    ezgcd factor int algint rcref rprint pretty cedit arnum \
    gentran dipoly groebnr2 groebner roots compact scope    \
    specfaux specfn   taylor tps misc odesolve   \
    avector orthovec )


# rm -f $reduce/log/mksrcdist.log

/silo/cons/reduce35/snake/binary/redu35  << EOF
symbolic;
load ftr;
off msg;
make!-dist!-files '($list);
bye;
EOF

expand $reduce/src/build/boot.sl > boot.sl
cp $reduce/src/build/entry.red entry.red
cp $reduce/src/build/cslentry.red cslentry.red
cp $reduce/src/rlisp/module34.red module.red
cp $reduce/src/rlisp/prolog.red prolog.red
cp $reduce/src/build/clrend.red clrend.red

cp $reduce/src/build/cslrend.red cslrend.red
cat $reduce/src/build/csl.red >> cslrend.red

# Remove tabs and check for long lines
echo Processing boot.sl ... 
foreach file ($list entry cslentry module prolog clrend cslrend)
   echo Processing ${file} ... 
   expand ${file}.red > ${file}.tmp
   mv ${file}.tmp ${file}.red
end

ln entry.red pslentry.red
ln rend.red pslrend.red

chmod 644 *

popd > /dev/null
