# calacs

# When invoking mkpkg from the calacs directory, the default action is to
# update the object library, update acsmain.o, and link.  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.  Don't use the relink entry point unless XFLAGS already
# includes "-Inolibc".
#
# When invoking this mkpkg from ../mkpkg, the calacs.a, relink, and
# install entry points are called.  LFLAGS will be assigned for linking,
# but XFLAGS will not be reset.
#
#   Entry points recognized by this mkpkg file:
#
#	mkpkg update	update object library, update acsmain.o, link, and
#			    move executable to stsdas$bin
#	mkpkg relink	update acsmain.o and link
#			    note: does not update calacs.a or modify XFLAGS
#	mkpkg linkonly	update acsmain.o and link
#			    note: XFLAGS is modified
#	mkpkg install	move executable to stsdas$bin
#
#	mkpkg debug		compile and link with debug options and move 
#					executable to ../bin
#
#   mkpkg dev       compile, link and move to a development directory for
#                   testing prior to installation (specify installdev)



$call update
$exit

devdebug:
	$set XFLAGS = "-Inolibc -g -q $(XFLAGS)"
	$set LFLAGS = "-H -z -x -p tables -p stsdas"
	$call updatedir
	$call installdev
	;		

dev:
	$set XFLAGS = "-Inolibc $(XFLAGS)"
# Next line contains flag for creating code that contains profile info
#	$set XFLAGS = "-Inolibc -/p $(XFLAGS)"
	$set LFLAGS = "-H -z -p tables -p stsdas $(LFLAGS)"
	$call updatedir
	$call installdev
	;

debug:
	$set XFLAGS = "-Inolibc -g -q $(XFLAGS)"
	$set LFLAGS = "-H -z -x -p tables -p stsdas"
	$call updatedir
	$call install
	;		

update:
	$set XFLAGS = "-Inolibc $(XFLAGS)"
	$set LFLAGS = "-H -z -p tables -p stsdas $(LFLAGS)"
	$call updatedir
	$call install
	;

updatedir:
	$checkout calacs.a ../
	$update calacs.a
	$checkin calacs.a ../

	$call relink
	;

linkonly:
	$set XFLAGS = "-Inolibc $(XFLAGS)"
# Next line contains flag for creating code that contains profile info
#	$set XFLAGS = "-Inolibc -/p $(XFLAGS)"
	$set LFLAGS = "-H -z -p tables -p stsdas $(LFLAGS)"
	
relink:
	$omake acsmain.c <c_iraf.h> <ximio.h> ../acs.h calacs.h ../acserr.h

	$link acsmain.o ../calacs.a\
		-lhstio -lcvos -lsynphot -lstxtools -ltbtables\
		-o calacs.e
	;
# The /p is for compiling in profile information
#		-/p\
#		-lex -lsys -lvops -lboot -los \

installdev:
	$move calacs.e /data/chulak1/dev/stsdas/bin/
    ;
    
install:
	$move calacs.e stsdasbin$
	;

calacs.a:
	calacs.c	 ../acs.h calacs.h ../acserr.h acsasn.h \
				../acsrej.h ../acscorr.h
	acstable.c	 <xtables.h> ../acs.h ../acserr.h acsasn.h calacs.h
	acsmember.c  ../acs.h ../acserr.h acsasn.h calacs.h
	getflags.c	 ../acs.h calacs.h ../acscorr.h ../acserr.h
	acsinit.c	../acs.h calacs.h ../acserr.h ../acscorr.h
	getnewref.c	 ../acs.h ../acserr.h
	sciflags.c	 ../acs.h calacs.h ../acscorr.h
	getsciinfo.c	 ../acs.h ../acscorr.h calacs.h ../acserr.h
	refexist.c	 <ximio.h> <xtables.h> <c_iraf_priv.h> \
				../acs.h calacs.h
	acsdth.c     calacs.h ../acs.h ../acserr.h
	;
