# 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
#$ifdef(tables)
  $iffile (iraf$bin/libtbtables.a)
    $call update
    $ifeq (hostid, unix)  !(date)  $endif
  $else
    $echo " "
    $echo " "
    $echo "***You need to build the tables package first"
    $echo "   before building st4gem"
  $endif
#$else
#  $echo " "
#  $echo " "
#  $echo "*** You need to build the tables package first"
#  $echo "    before building st4gem"
#$endif

$exit


linkonly:
	$call pkg

	$purge st4gembin$
	;


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

	$purge st4gembin$
	;

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.st4gem
	;

# 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
	;

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)
	;

linux:					# install PC Linux binaries
        $ifnfile (bin.linux)
            !mkdir bin.linux
        $endif
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh linux -d $(DIRS)
	;
linux64:					# install PC Linux binaries
        $ifnfile (bin.linux64)
            !mkdir bin.linux64
        $endif
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh linux64 -d $(DIRS)
	;
macosx:					# install MacOSX (Apple) binaries
macos64:				# install MacOSX (alt) binaries
        $ifnfile (bin.macosx)
            !mkdir bin.macosx
        $endif
	$verbose off
	$set DIRS = "lib pkg"
	!$(hlib)/mkfloat.csh macosx -d $(DIRS)
        $ifnfile (bin.macos64)
            !ln -s bin.macosx bin.macos64
        $endif
	;
macintel:                               # install MacOSX (Intel) binaries
        $ifnfile (bin.macintel)
            !mkdir bin.macintel
        $endif
        $verbose off
        $set DIRS = "lib pkg"
        !$(hlib)/mkfloat.csh macintel -d $(DIRS)
        ;
