bin_PROGRAMS = \
	caltool \
	camtool \
	chiptool \
	detselect \
	dettool \
	difftool \
	flatcorr \
	magictool \
	pstamptool \
	pxadmin \
	pxinject \
	faketool \
	pzgetexp \
	pzgetimfiles \
	pztool \
	regtool \
	stacktool \
	warptool


bin_SCRIPTS = \
	fakemagic

pkginclude_HEADERS = \
	pxadmin.h \
	pxcam.h \
	pxchip.h \
	pxconfig.h \
	pxdata.h \
	pxfake.h \
	pxregister.h \
	pxtag.h \
	pxtools.h \
	pxtoolsErrorCodes.h \
	pxtree.h \
	pxwarp.h

noinst_HEADERS = \
	caltool.h \
	camtool.h \
	chiptool.h \
	detselect.h \
	dettool.h \
	difftool.h \
	flatcorr.h \
	faketool.h \
	magictool.h \
	pstamptool.h \
	pxinject.h \
	pzgetexp.h \
	pzgetimfiles.h \
	pztool.h \
	regtool.h \
	stacktool.h \
	warptool.h

lib_LTLIBRARIES = libpxtools.la
libpxtools_la_CFLAGS	= $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
libpxtools_la_LIBS      = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS)
libpxtools_la_LDFLAGS   = -release $(PACKAGE_VERSION)
libpxtools_la_SOURCES   = \
	pxcam.c \
	pxchip.c \
	pxconfig.c \
	pxdata.c \
	pxerrors.c \
	pxfake.c \
	pxfault.c \
	pxregister.c \
	pxtag.c \
	pxtools.c \
	pxtoolsErrorCodes.c \
	pxtree.c \
	pxwarp.c

# for pxtools.h
AM_CPPFLAGS = -I$(top_srcdir)/src$

pztool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS) 
pztool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pztool_SOURCES = \
    pztool.c \
    pztoolConfig.c

pstamptool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS) 
pstamptool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pstamptool_SOURCES = \
    pstamptool.c \
    pstamptoolConfig.c

caltool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
caltool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
caltool_SOURCES = \
    caltool.c \
    caltoolConfig.c

flatcorr_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
flatcorr_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
flatcorr_SOURCES = \
    flatcorr.c \
    flatcorrConfig.c

regtool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
regtool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
regtool_SOURCES = \
    regtool.c \
    regtoolConfig.c

chiptool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
chiptool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
chiptool_SOURCES = \
    chiptool.c \
    chiptoolConfig.c

camtool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
camtool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
camtool_SOURCES = \
    camtool.c \
    camtoolConfig.c

faketool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
faketool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
faketool_SOURCES = \
    faketool.c \
    faketoolConfig.c

magictool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
magictool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
magictool_SOURCES = \
    magictool.c \
    magictoolConfig.c

warptool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
warptool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
warptool_SOURCES = \
    warptool.c \
    warptoolConfig.c

difftool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
difftool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
difftool_SOURCES = \
    difftool.c \
    difftoolConfig.c

stacktool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
stacktool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
stacktool_SOURCES = \
    stacktool.c \
    stacktoolConfig.c

pxadmin_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
pxadmin_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pxadmin_SOURCES = \
    pxadmin.c \
    pxadminConfig.c

pzgetexp_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
pzgetexp_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pzgetexp_SOURCES = \
    pzgetexp.c \
    pzgetexpConfig.c

pzgetimfiles_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
pzgetimfiles_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pzgetimfiles_SOURCES = \
    pzgetimfiles.c \
    pzgetimfilesConfig.c

dettool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
dettool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
dettool_SOURCES = \
    dettool.c \
    dettoolConfig.c \
    dettool_correction.c

detselect_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
detselect_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
detselect_SOURCES = \
    detselect.c \
    detselectConfig.c

pxinject_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
pxinject_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
pxinject_SOURCES = \
    pxinject.c \
    pxinjectConfig.c

clean-local:
	-rm -f TAGS
# Tags for emacs
tags:
	etags `find . -name \*.[ch] -print`

# Error codes.
BUILT_SOURCES = pxtoolsErrorCodes.h pxtoolsErrorCodes.c
CLEANFILES = pxtoolsErrorCodes.h pxtoolsErrorCodes.c
EXTRA_DIST = pxtoolsErrorCodes.dat pxtoolsErrorCodes.c.in pxtoolsErrorCodes.h.in fakemagic

pxtoolsErrorCodes.h : pxtoolsErrorCodes.dat pxtoolsErrorCodes.h.in
	$(ERRORCODES) --data=pxtoolsErrorCodes.dat --outdir=. pxtoolsErrorCodes.h

pxtoolsErrorCodes.c : pxtoolsErrorCodes.dat pxtoolsErrorCodes.c.in pxtoolsErrorCodes.h
	$(ERRORCODES) --data=pxtoolsErrorCodes.dat --outdir=. pxtoolsErrorCodes.c

BUILT_SOURCES += pxdata.c
EXTRA_DIST += pxdata.c.template

pxdata.c: $(srcdir)/pxdata.c.template $(srcdir)/Makefile
	$(PERL) -pe 's|\@PKGDATADIR\@|$(pkgdatadir)|' $< > $@

