# DAOPHOT libraries

$call relink
$exit

update:
	$call relink
	$call install
	;

relink:
	$omake x_daophot.x
	$ifdef (tables)
	    !mkpkg -p noao -p tables trelink XF="$(XFLAGS)" LF="$(LFLAGS)"
	$else
	    $call tundefined
	$endif
	;

linkonly:
	$ifdef (tables)
	    !mkpkg -p noao -p tables trelink XF="$(XFLAGS)" LF="$(LFLAGS)"
	$else
	    $call tundefined
	$call install
	;

install:
	$move xx_daophot.e noaobin$x_daophot.e
	;

trelink:
	$set LIBS = "-lncar -lgks -ltbtables -lxtools"
        $set XFLAGS = "$(XFLAGS) $(XF)"
        $set LFLAGS = "$(LFLAGS) $(LF)"
	$update libpkg.a
	$link x_daophot.o libpkg.a ../lib/libpttables.a $(LIBS) -o xx_daophot.e
	;

tundefined:
	$echo "cannot find file tbset.h"
	$echo "tbtables library is not defined"
	$echo "cannot build xx_daophot.e"
	;

libpkg.a:
	@allstar
	@addstar
	@daoedit
	@daolib
	@group
	@select
	@nstar
	@peak
	@psf
	@seepsf
	@substar
	;
