#! /bin/csh -f
##############################################################################
#
# File:         PDIST:MAKE-PSLCOMP
# Description:  This file constructs a new PSLCOMP.
# Author:       Leigh Stoller
# Created:      03-Nov-86
# Modified:     
# Mode:         Text
#
# (c) Copyright 1982, University of Utah
# %
# % Redistribution and use in source and binary forms, with or without
# % modification, are permitted provided that the following conditions are met:
# %
# %    * Redistributions of source code must retain the relevant copyright
# %      notice, this list of conditions and the following disclaimer.
# %    * Redistributions in binary form must reproduce the above copyright
# %      notice, this list of conditions and the following disclaimer in the
# %      documentation and/or other materials provided with the distribution.
# %
# % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# % THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
# % CONTRIBUTORS
# % BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# % POSSIBILITY OF SUCH DAMAGE.
#
#
##############################################################################
#
# Revisions:
#
# 03-Mar-87 (Leigh Stoller)
#  Now load pslcomp, which does not use objects or pathnames. See pslcomp.sl
#   in the comp directory.
#
###############################################################################

set imagesize=10000000

if ($MACHINE == Ibmrs) then
  set imagesize=8000000
endif
if ($MACHINE == brock) then
  set imagesize=1000
endif
if ($MACHINE == AMD64) then
  set imagesize=1000
endif
if ($MACHINE == AMD64_ext) then
  set imagesize=1000
endif
if ($MACHINE == macintel64) then
  set imagesize=1000
endif
if ($MACHINE == mingw-w64) then
  set imagesize=1000
endif
if ($MACHINE == freeBSD64) then
  set imagesize=1000
endif
if ($MACHINE == aarch64) then
  set imagesize=1000
endif

pushd $psys
if ( -e $psys/.imago) then
    mv -f $psys/pslcomp.img $psys/old-pslcomp.img
  else
    mv -f $psys/pslcomp $psys/old-pslcomp
endif

setenv SavingPSL yes		# skip user startup before savesystem

$psys/bare-psl << EOF
(setq loaddirectories* '("" "$pl/" "$pll/"))
(on verboseload)
(load get-options compiler str-search init-file)
(load strings common)
(savesystem "PSL 4.2 Compiler" "\$psys/pslcomp"
   '((read-init-file "pslcomp")))
(exitlisp)
EOF

cat > $psys/pslcomp << EOFF
#
\$pxk/bpsl  -td $imagesize -f  \$psys/pslcomp.img \$*
#
EOFF

chmod +x $psys/pslcomp

@ pslcompstatus = $status
popd
if ( -x $psys/sparsify ) then
    if ( -e $psys/.imago) then
        $psys/sparsify $psys/pslcomp.img
      else
        $psys/sparsify $psys/pslcomp
    endif
endif

@ status = $pslcompstatus

# End of file.
