## Process this fill with automake to generate Makefile.in
# 
#  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
#   Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

AUTOMAKE_OPTIONS = dejagnu -Wno-portability

abs_topbuilddir=$(shell cd $(top_builddir); pwd)

check_SCRIPTS = \
	run_swfdec_testsuite_a \
	run_swfdec_testsuite_b \
	run_swfdec_testsuite_c \
	run_swfdec_testsuite_d \
	run_swfdec_testsuite_e \
	run_swfdec_testsuite_f \
	run_swfdec_testsuite_g \
	run_swfdec_testsuite_h \
	run_swfdec_testsuite_i \
	run_swfdec_testsuite_j \
	run_swfdec_testsuite_k \
	run_swfdec_testsuite_l \
	run_swfdec_testsuite_m \
	run_swfdec_testsuite_n \
	run_swfdec_testsuite_o \
	run_swfdec_testsuite_p \
	run_swfdec_testsuite_q \
	run_swfdec_testsuite_r \
	run_swfdec_testsuite_s \
	run_swfdec_testsuite_t \
	run_swfdec_testsuite_u \
	run_swfdec_testsuite_v \
	run_swfdec_testsuite_w \
	run_swfdec_testsuite_x \
	run_swfdec_testsuite_y \
	run_swfdec_testsuite_z 

clean-local: 
	rm -f $(check_SCRIPTS)
	rm -f *.log 
	rm -f *.out
	rm -f *.err
	rm -f *.trace-gnash \
		site.bak site.exp site.exp.bak testrun.sum \
		gnash.sum 
	rm -rf src

run_swfdec_testsuite_a: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace aA > $@
	chmod 755 $@

run_swfdec_testsuite_b: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace bB > $@
	chmod 755 $@

run_swfdec_testsuite_c: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace cC > $@
	chmod 755 $@

run_swfdec_testsuite_d: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace dD > $@
	chmod 755 $@

run_swfdec_testsuite_e: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace eE > $@
	chmod 755 $@

run_swfdec_testsuite_f: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace fF > $@
	chmod 755 $@

run_swfdec_testsuite_g: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace gG > $@
	chmod 755 $@

run_swfdec_testsuite_h: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace hH > $@
	chmod 755 $@

run_swfdec_testsuite_i: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace iI > $@
	chmod 755 $@

run_swfdec_testsuite_j: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace jJ > $@
	chmod 755 $@

run_swfdec_testsuite_k: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace kK > $@
	chmod 755 $@

run_swfdec_testsuite_l: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace lL > $@
	chmod 755 $@

run_swfdec_testsuite_m: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace mM > $@
	chmod 755 $@

run_swfdec_testsuite_n: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace nN > $@
	chmod 755 $@

run_swfdec_testsuite_o: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace oO > $@
	chmod 755 $@

run_swfdec_testsuite_p: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace pP > $@
	chmod 755 $@

run_swfdec_testsuite_q: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace qQ > $@
	chmod 755 $@

run_swfdec_testsuite_r: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace rR > $@
	chmod 755 $@

run_swfdec_testsuite_s: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace sS > $@
	chmod 755 $@

run_swfdec_testsuite_t: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace tT > $@
	chmod 755 $@

run_swfdec_testsuite_u: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace uU > $@
	chmod 755 $@

run_swfdec_testsuite_v: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace vV > $@
	chmod 755 $@

run_swfdec_testsuite_w: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace wW > $@
	chmod 755 $@

run_swfdec_testsuite_x: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace xX > $@
	chmod 755 $@

run_swfdec_testsuite_y: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace yY > $@
	chmod 755 $@

run_swfdec_testsuite_z: gen_run_swfdec_testsuite.sh Makefile
	sh $(srcdir)/gen_run_swfdec_testsuite.sh $(abs_topbuilddir) $(srcdir) $(SWFDEC_TESTSUITE)/trace zZ > $@
	chmod 755 $@

TEST_DRIVERS = ../simple.exp
TEST_CASES = ${check_SCRIPTS}

check-DEJAGNU: site-update $(check_PROGRAMS)
	@runtest=$(RUNTEST); \
	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
	    GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $$runtest $(RUNTESTFLAGS) $(TEST_DRIVERS); true; \
	else \
	  echo "WARNING: could not find \`runtest'" 1>&2; \
          for i in "$(TEST_CASES)"; do \
	    GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $(SHELL) $$i; \
	  done; \
	fi; \
	echo "Number of discrepant lines (for information only): `LC_ALL=C grep -e "^-\|^+" *.log | wc -l`"

site-update: site.exp
	@rm -fr site.exp.bak
	@cp site.exp site.exp.bak
	@sed -e '/testcases/d' site.exp.bak > site.exp
	@echo "# This is a list of the pre-compiled testcases" >> site.exp
	@echo "set testcases \"$(TEST_CASES)\"" >> site.exp

EXTRA_DIST = gen_run_swfdec_testsuite.sh
