# Make the STSDAS system
#
# Author: L. Willard, 6-June-1989 from the NOAO mkpkg
#


$echo "This software was prepared by Space Telescope Science Institute under"
$echo "U.S. Government contract NAS5-26555. Users shall not, without prior"
$echo "written permission of the U.S. Government, establish a claim to"
$echo "statutory copyright.  The Government and others acting on its behalf,"
$echo "shall have a royalty-free, non-exclusive, irrevocable, worldwide"
$echo "license for Government purposes to publish, distribute, translate,"
$echo "copy, exhibit, and perform such material."
$ifeq (hostid, unix)  !(date)  $endif
$ifeq (hostid, vms)  !(show time)  $endif
$ifdef(tables)
  $iffile (tables$lib/libtbtables.a)
    $call update
    $ifeq (hostid, unix)  !(date)  $endif
    $ifeq (hostid, vms)  !(show time)  $endif
  $else
    $echo " "
    $echo " "
    $echo "***You need to build the tables package first"
    $echo "   before building stsdas"
  $endif
$else
  $echo " "
  $echo " "
  $echo "*** You need to build the tables package first"
  $echo "    before building stsdas"
$endif

$exit


linkonly:
	$call pkg

	$ifeq (HOSTID, vms) $purge [...] $endif
	$purge stsdasbin$
	;


update:
	$iffile (/tmp/mkfloat.lock)
		!sleep 10
		$goto update:
	$endif
	$call lib
	$call pkg

	$ifeq (host, /usr/stsci/irafx/unix/)
		$ifeq(MACH, sparc)
	    !/usr/stsci/stsdasx/local/hseat/mkhs.csh 
		$endif
	$endif

	$ifeq (HOSTID, vms) $purge [...] $endif
	$purge stsdasbin$
	;

lib:
	$echo "===================== LIB ========================="
	$echo ""
	$call update@lib
	;
pkg:
	$echo "===================== PKG ========================="
	$echo ""
	$call update@pkg
	;

# STRIP -- Strip the STSDAS directories of all sources and other files not
# required to run the system, or for user programming.

strip:
	!rmfiles -f lib/strip.stsdas
	;

# SUMMARY -- [UNIX] mkpkg summary: output a summary of the spooled mkpkg
# output, omitting most of the mundane chatter.  Used to scan large spool
# files for errors.

summary:
	$ifeq (HOSTID, unix)
	    ! grep -v ':$$' spool | grep -v '^xc' | grep -v '^ar'\
	    | grep -v '^check file'
	$else
	    $echo "mkpkg summary only available on a UNIX system"
	$endif
	;

SUN/IRAF multiple architecture support.
# ----------------------------------------

arch:
showfloat:				# show current float option
	$verbose off
	!$(hlib)/mkfloat.csh
	;
generic:				# make architecture indep. (no bins)
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh generic -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.generic data/scidata
	;
sparc:					# install sparc binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh sparc -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.sparc data/scidata
	;
ssun:					# install ssun (Solaris) binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh ssun -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.ssun data/scidata
	;
i386:					# install i386 binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh i386 -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.i386 data/scidata
	;
f68881:					# install f68881 binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh f68881 -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.f68881 data/scidata
	;
ffpa:					# install ffpa binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh ffpa -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.ffpa data/scidata
	;
fswitch:				# install fswitch binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh fswitch -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.fswitch data/scidata
	;
fsoft:					# install fsoft binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh fsoft -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.fsoft data/scidata
	;
linux:					# install PC Linux binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh linux -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.linux data/scidata
	;
macosx:					# install MacOSX binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh macosx -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.macosx data/scidata
	;
freebsd:					# install PC Linux binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh freebsd -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.freebsd data/scidata
	;
redhat:					# install PC Linux binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh redhat -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.redhat data/scidata
	;
suse:                                   # install Suse binaries
        $verbose off
        $set DIRS = "lib pkg"
        !$(hlib)/mkfloat.csh suse -d $(DIRS)
        !rm -f data/scidata; ln -s scidata.suse data/scidata
        ;
pg:					# install -pg -f68881 binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh pg -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.pg data/scidata
	;
rs6000:					# install IBM Risc binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh rs6000 -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.risc data/scidata
	;
irix:					# install irix binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh irix -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.irix data/scidata
	;
mips:					# install mips binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh mips -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.mips data/scidata
	;
ddec:					# install DECstation/Ultrix binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh ddec -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.ddec data/scidata
	;
dmip:					# install DECstation/MIP binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh dmip -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.dmip data/scidata
	;
alpha:					# install OSF/1 Alpha binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh alpha -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.alpha data/scidata
	;
hp700:					# install HP binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh hp700 -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.hp700 data/scidata
	;
vax:					# install vax binaries
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh vax -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.vax data/scidata
	;
f2c:					# install architectures without Fortran
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh f2c -d $(DIRS)
	!rm -f data/scidata; ln -s scidata.f2c data/scidata
	;
macintel:                               # install MacOSX (Intel) binaries
        $verbose off
        $set DIRS = "lib pkg"
        !$(hlib)/mkfloat.csh macintel -d $(DIRS)
        !rm -f data/scidata; ln -s scidata.macintel data/scidata
        ;

