# calstis0

# When invoking mkpkg from the cs0 directory, the default action is to
# update the object library, update cs0.o, and link.  This is equivalent
# to the relink entry point.  NOTE that this should not be done unless the
# calstis object library has already been updated in the lib subdirectory.
#
# To do these steps and also install the executable, use "mkpkg update",
# or use two steps "mkpkg" and "mkpkg install".
#
# Use the linkonly entry point in order to link without updating the
# object library.
#
# When invoking this mkpkg from ../mkpkg, the calstis.a, relink, and
# install entry points are called.  LFLAGS will be assigned for linking,
# but XFLAGS will not be reset by this mkpkg file.
#
#   Entry points recognized by this mkpkg file:
#
#	mkpkg relink	update object library, update cs0.o and link
#	mkpkg update	update object library, update cs0.o, link, and
#			    move executable to stsdas$bin
#	mkpkg linkonly	update cs0.o and link
#			    note: XFLAGS is modified
#	mkpkg install	move executable to stsdas$bin
#
#	linkonly2	same as linkonly except that XFLAGS is not modified,
#			    it's assumed to already include "-Inolibc"

$call relink
$exit

update:
	$call relink
	$call install
	;

relink:
	$set XFLAGS = "-Inolibc $(XFLAGS)"
	$checkout calstis.a ../
	$update calstis.a
	$checkin calstis.a ../

	$call linkonly2
	;

linkonly:
	$set XFLAGS = "-Inolibc $(XFLAGS)"
linkonly2:
	$ifeq (MACH, alpha) then
	$set LFLAGS = "-H -z -/non_shared $(LFLAGS)"
	$else
	$set LFLAGS = "-H -z $(LFLAGS)"
	$endif

	$omake cs0.c <c_iraf.h> <ximio.h> ../stis.h calstis0.h ../stiserr.h

	$link cs0.o ../calstis.a \
		-lhstio -lcvos -lsynphot -lstxtools -lapplib -ltbtables \
		-o cs0.e
	;

install:
	$move cs0.e stsdasbin$cs0.e
	;

calstis.a:
	calstis0.c	<hstio.h> ../stis.h calstis0.h ../stiserr.h \
				../cs2.h ../cs12.h
	checkwav.c	<hstio.h> ../stis.h calstis0.h ../stiserr.h \
				../stisdef.h
	compfiles.c	../stis.h calstis0.h
	getflags.c	<c_iraf.h> <hstio.h> ../stis.h calstis0.h ../stiserr.h \
				../stisdef.h
	getnewref.c	<c_iraf.h> <hstio.h> ../stis.h ../stiserr.h ../stisdef.h
	getsciinfo.c	<c_iraf.h> <hstio.h> ../stis.h calstis0.h ../stiserr.h \
			../stisdef.h
	getwavinfo.c	<c_iraf.h> <hstio.h> ../stis.h calstis0.h ../stiserr.h \
				../stisshutter.h ../stisdef.h
	refexist.c	<c_iraf.h> <xtables.h> \
				../stis.h calstis0.h ../stiserr.h
	savename.c	../stiserr.h
	sciflags.c	<hstio.h> ../stis.h calstis0.h
	stisinit.c	../stis.h calstis0.h ../stiserr.h
	wavflags.c	<hstio.h> ../stis.h calstis0.h
	;
