# Make the FITSUTIL package

$call relink
$call install
$exit

update:
	$call relink
	$call install
	;

relink:
	$update libpkg.a
	$omake x_fxutil.x

	$link x_fxutil.o libpkg.a -lmef  -ldbc -lxtools -o xx_fitsutil.e
        !cc -c $(HSI_CF) fgwrite.c fgread.c checksum.c kwdb.c
	!cc fgwrite.o kwdb.o -o fgwrite.e
	!cc fgread.o kwdb.o checksum.o -o fgread.e
	!rm fgwrite.o fgread.o kwdb.o checksum.o
	;

install:
	$move xx_fitsutil.e fitsutilbin$x_fitsutil.e
	$move fgread.e fitsutilbin$fgread.e
	$move fgwrite.e fitsutilbin$fgwrite.e
	;

libpkg.a:
#$set XFLAGS='-cfgq -p fitsutil'
	catprhdr.x	 <error.h> <mef.h> "dfits.h" "dfits.com"
	dfits.x		 <ctype.h> "dfits.h" "dfits.com" <ctype.h>
	fxcopy.x	 <imio.h> <imhdr.h> <mef.h> <ctype.h>
	fxconvert.x	 <imhdr.h>
	fxdelete.x	 <imio.h> <imhdr.h> <ctype.h> <fset.h> <mach.h> <mef.h>
	fxextract.x      <imio.h> <imhdr.h> <ctype.h> <error.h>
	fxdummyh.x	 <imio.h> <imhdr.h> <mef.h>
	fxheader.x	 <error.h> <fset.h>
	fxsplit.x	 <imio.h> <imhdr.h> <mef.h> <ctype.h>
	fxinsert.x	 <imio.h> <imhdr.h> <mef.h> <mach.h>
	fxplf.x		 <syserr.h> <imhdr.h> <imio.h> <pmset.h> <plio.h> \
			 <mef.h>
        nhedit.x         <lexnum.h> <ctype.h> <imset.h> <evexpr.h> <error.h>
	;
