1##  Makefile.am -- an automake template for Makefile.in file
2##  Copyright (C) 2009 Chris Bagwell and Sane Developers.
3##
4##  This file is part of the "Sane" build infra-structure.  See
5##  included LICENSE file for license information.
6
7SUBDIRS = backend sanei tools
8
9SCANIMAGE = ../frontend/scanimage$(EXEEXT)
10TESTFILE  = $(srcdir)/testfile.pnm
11OUTFILE   = outfile.pnm
12DEVICE    = test
13OPTIONS   = --mode Color --depth 16 --test-picture "Color pattern" --resolution 50 -y 20 -x 20 > $(OUTFILE)
14
15EXTRA_DIST = README testfile.pnm
16CLEANFILES = $(OUTFILE)
17
18all: help
19
20help:
21	@echo "Use 'make test' to run the tests."
22
23test: test.local
24
25test.local:
26	@echo "**** Testing $(SCANIMAGE) with device $(DEVICE)"
27	@if echo "---> Trying flatbed scanner" && \
28	  $(SCANIMAGE) -d $(DEVICE) -T && \
29	  echo "<--- Flatbed scanner succeeded" && \
30	  echo "---> Trying three pass flatbed scanner" && \
31	  $(SCANIMAGE) -d $(DEVICE) --mode Color --three-pass=yes   -T && \
32	  echo "<--- Three pass scanner succeeded" && \
33	  echo "---> Trying hand scanner" && \
34	  $(SCANIMAGE) -d $(DEVICE) --hand-scanner=yes -T && \
35	  echo "<--- Hand scanner succeeded" && \
36	  echo "---> Checking 16 bit color mode" && \
37	  $(SCANIMAGE) -d $(DEVICE) $(OPTIONS) && \
38	  cmp -s $(TESTFILE) $(OUTFILE) && \
39	  echo "<--- 16 bit color mode succeeded" && \
40	  rm $(OUTFILE) ; \
41	then echo ; echo ; echo "**** All tests passed" ; \
42	else echo ; echo; \
43	echo "**** Something failed (maybe test backend not enabled by configure?)";\
44	exit 1; \
45	fi
46