# calwf3

# When invoking mkpkg from the calwf3 directory, the default action is to
# update the object library, update wf3main.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 calwf3.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 wf3main.o, link, and
#			    move executable to stsdas$bin
#	mkpkg relink	update wf3main.o and link
#			    note: does not update calwf3.a or modify XFLAGS
#	mkpkg linkonly	update wf3main.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 calwf3.a ../
	$update calwf3.a
	$checkin calwf3.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 wf3main.c ../wf3.h ../wf3err.h

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

installdev:
	$move calwf3.e  /user/sosey/wfc3/pipeline/bin/
 
    ;
    
install:
	$move calwf3.e stsdasbin$
	;

calwf3.a:
	calwf3.c	calwf3.h wf3asn.h ../wf3.h ../wf3err.h \
				../wf3rej.h ../wf3corr.h <hstio.h>
	getswitches.c	calwf3.h ../wf3.h ../wf3corr.h ../wf3err.h <hstio.h>
	getnewref.c	../wf3.h ../wf3err.h <hstio.h>
	getinfo.c	calwf3.h ../wf3.h ../wf3corr.h ../wf3err.h <hstio.h>
	procccd.c	calwf3.h wf3asn.h ../wf3.h ../wf3err.h \
				../wf3rej.h ../wf3corr.h <hstio.h>
	procir.c	calwf3.h wf3asn.h ../wf3.h ../wf3err.h \
				../wf3rej.h ../wf3corr.h <hstio.h>
	refexist.c	calwf3.h ../wf3.h <hstio.h> <ximio.h> <xtables.h> \
				<c_iraf_priv.h>
	getreffiles.c	calwf3.h ../wf3.h ../wf3corr.h <hstio.h>
	wf3dth.c	calwf3.h ../wf3.h ../wf3err.h <hstio.h>
	wf3init.c	calwf3.h ../wf3.h ../wf3err.h ../wf3corr.h
	wf3member.c	calwf3.h wf3asn.h ../wf3.h ../wf3err.h <hstio.h>
	wf3table.c	<xtables.h> ../wf3.h ../wf3err.h wf3asn.h <hstio.h> \
				calwf3.h
	;
