#
# Makefile for unhtml test suite
#

CC     = gcc
MAKE   = make
RM     = rm -f
CFLAGS = -Wall
# CFLAGS = -Wall -DDEBUG

all: check

check: clean test1 test2 test3 test4 test5
	@( val=`diff -q expected.results results` ; \
	  if [ "$$val" ] ; \
	  then \
	     echo "one or more tests failed" ; \
	     exit 1 ; \
	  else  \
	     echo "all tests passed" ; \
	  fi ; )

test1:
	@echo "   running test1 ..."
	@../unhtml test1.html > tmp1
	@( diff -q tmp1 test1.out && echo test1 >> results )

test2:
	@echo "   running test2 ..."
	@../unhtml test2.html > tmp2
	@( diff -q tmp2 test2.out && echo test2 >> results )

test3:
	@echo "   running test3 ..."
	@../unhtml test3.html > tmp3
	@( diff -q tmp3 test3.out && echo test3 >> results )

test4:
	@echo "   running test4 ..."
	@../unhtml test4.html > tmp4
	@( diff -q tmp4 test4.out && echo test4 >> results )

test5:
	@echo "   running test5 ..."
	@../unhtml test5.html > tmp5
	@( diff -q tmp5 test5.out && echo test5 >> results )

clean:
	@$(RM) core *.o unhtml results
	@$(RM) tmp1 tmp2 tmp3 tmp4 tmp5

