
AM_FCFLAGS = $(FC_MODINC). $(FC_MODINC)$(top_srcdir)/include $(AM_FC_MODINC)
AM_LDFLAGS = @LIBGFORTRAN@ @LIBGCC@
ldir = $(top_srcdir)/lib
FITSADD = $(ldir)/libtitsio.a $(LIBCFITSIO)

if BUNDLE
  photmetrydir = $(prefix)/share/munipack
else
  photmetrydir = $(pkgdatadir)
endif

pkglibexec_PROGRAMS = find aphot gphot phcal phfotran pphot
noinst_PROGRAMS = aphottester

find_SOURCES = daosky.f95 daofind.f95 fitsfind.f08 find.f08
find_LDADD   = $(ldir)/libsort.a $(LIBOAKLEAF) $(FITSADD)

aphot_SOURCES = daosky.f95 daofotometr.f08 fitsaphot.f08 aphot.f08
aphot_LDADD   = $(LIBOAKLEAF) $(FITSADD)

aphottester_SOURCES = daofotometr.f08 fitsaphot.f08 aphottester.f08
aphottester_LDADD   = $(LIBOAKLEAF) $(FITSADD)

gphot_SOURCES = growinit.f95 growmodel.f95 growfit.f95\
                growreport.f95 growcurve.f95 fitsgphot.f08 gphot.f08
gphot_LDADD   = $(ldir)/liblmin.a $(ldir)/libpppack.a $(ldir)/libminpacks.a \
                $(ldir)/libfmm.a $(LIBOAKLEAF) $(LIBMINPACK) $(FITSADD)

phcal_SOURCES =  fitsfotran.f95 rational.f95 rplane.f95 \
                 fotran.f95 mfits.f08 calibre.f95 jam.f95 colorex.f95 \
                 sfits.f08 phcal.f08
phcal_LDADD = $(ldir)/liblmin.a $(ldir)/libsort.a $(ldir)/libastrotrafo.a \
              $(ldir)/libphotometry.a $(ldir)/libphio.a \
              $(ldir)/libastrosphere.a $(LIBOAKLEAF) $(FITSADD)

phfotran_SOURCES = mfits.f08 jam.f95 fitsfotran.f95 rplane.f95 \
                   rational.f95 fotran.f95 phfotran.f95
phfotran_LDADD   = $(ldir)/libastrotrafo.a $(ldir)/libphotometry.a \
                   $(ldir)/libminpacks.a $(ldir)/liblmin.a $(ldir)/libphio.a \
                   $(ldir)/libastrosphere.a \
                   $(LIBOAKLEAF) $(LIBMINPACK) $(FITSADD)

pphot_SOURCES = psf.f08 fitspphot.f08 pphot.f95
pphot_LDADD   = $(ldir)/liblmin.a $(FITSADD)

dist_photmetry_DATA = photosystems.fits
dist_html_DATA = grow_report.sh grow_report.py

photosystems.fits: photosystems.lst
	echo -e "MODE = 'RESTORE'\nFILE = 'photosystems.lst' 'photosystems.fits'\n" | ../fits/fits

CLEANFILES = photosystems.fits
