#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	[ -d mcode/html-orig ] || cp -pr mcode/html mcode/html-orig
	ant -f jarbuild.xml jar7
	./gen-doc.sh
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
	  -o extra/dfa extra/dfa.c -lm
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
	  -o extra/mse extra/mse.c -lm
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
	  -o extra/edr extra/edr.c -lm `wfdb-config --libs`

override_dh_auto_test:
# tests not performed for now (most require network)

override_dh_auto_install:

override_dh_install:
	dh_install -X/mxm.m

override_dh_auto_clean:
	rm -f mcode/*.jar
	rm -rf bin
	rm -f extra/dfa
	rm -f extra/mse
	rm -f extra/edr
	[ ! -d mcode/html-orig ] || ( rm -rf mcode/html; mv mcode/html-orig mcode/html )
