AM_CFLAGS = $(PSLIB_CFLAGS)
AM_LDFLAGS = $(PSLIB_LIBS)

pois_CPPFLAGS = $(PSLIB_CFLAGS)
pois_LDFLAGS = $(PSLIB_LIBS)

noinst_HEADERS = pois.h poisErrorCodes.h
bin_PROGRAMS = pois

BUILT_SOURCES = \
	poisErrorCodes.h errorCodes.c

pois_SOURCES = \
	pois.c \
	poisAddPenalty.c \
	poisCalculateDeviations.c \
	poisCalculateEquation.c \
	poisCheckKernel.c \
	poisConvolveImage.c \
	poisExtractKernel.c \
	poisFindStamps.c \
	poisKernelBasisFunctions.c \
	poisMakeMask.c \
	poisReadStamps.c \
	poisRejectStamps.c \
	poisParseConfig.c \
	poisSolveEquation.c \
	poisStamp.c \
	errorCodes.c
###	poisMaskOps.c

#
# Error codes
#
poisErrorCodes.h : errorCodes.dat errorCodes-skl.h
	$(PERL) parseErrorCodes.pl --data=errorCodes.dat --outfile=poisErrorCodes.h \
			errorCodes-skl.h
errorCodes.c : errorCodes.dat errorCodes-skl.c poisErrorCodes.h
	$(PERL) parseErrorCodes.pl --data=errorCodes.dat --outfile=errorCodes.c \
			errorCodes-skl.c

EXTRA_DIST = \
	parseErrorCodes.pl \
	errorCodes.dat \
	errorCodes-skl.h \
	errorCodes-skl.c \
	poisErrorCodes.h

#
# test program
#
test: pois test1.fits test2.fits
	-$(RM) testout.fits stamp*.fits kernel*.fits
	./pois -v test1.fits test2.fits testout.fits

# Tags for emacs
tags:
	etags `find . -name \*.[ch] -print`
