# $Id: Makefile.in,v 1.5 2004/10/05 14:29:47 ortschae Exp $
# vim:tabstop=8:shiftwidth=8:textwidth=72

LANG=C
LC_ALL=C

prefix=/usr
datadir=${prefix}/share
docdir=${datadir}/doc/faumachine
examplesdir=${docdir}/examples


thisexdir=$(examplesdir)/install-Debian-3.0r0-serial

all: experiment

experiment: \
		../CDROM.images/Debian-3.0r0-CD-1 \
		../CDROM.images/Debian-3.0r0-CD-5 \
		lilo_prompt.ppm \
		system.vhdl \
		simulation.setup
	@echo "This procedure will install Debian 3.0r0 onto your virtual"
	@echo "machine."
	@echo "This takes some (or more) time, take a cup of coffee,"
	@echo "go for a swim or just lean back and watch the automatically"
	@echo "running installation procedure."
	@echo
	@echo "Creating virtual disks, this may take a while ..."
	@echo
	@echo "Do a tail -f ./expect-run.log to view progress output."
	@echo
	if [ -z "$$DISPLAY" ]; then \
		sed -e 's/^#no_window.*$$/no_window yes/g' < simulation.setup > simulation.setup.no_x11; \
		faum-expect -setup simulation.setup.no_x11 -gint version=0 > ./expect-run.log 2> ./expect-errors.log; \
	else \
		faum-expect -gint version=0 > ./expect-run.log 2> ./expect-errors.log; \
	fi
	touch experiment
clean distclean::
	rm -f simulation.setup.no_x11
	rm -f start_all.sh kill_all.sh
	rm -f errors.*
	rm -f expect-*.log
	rm -f log.*
	rm -f fault_list.expect
distclean::
	rm -f experiment
	rm -rf node.*

../CDROM.images/Debian-3.0r0-CD-1:
	cd ../CDROM.images; make Debian-3.0r0-CD-1

../CDROM.images/Debian-3.0r0-CD-5:
	cd ../CDROM.images; make Debian-3.0r0-CD-5

install:
	mkdir -p $(DESTDIR)$(thisexdir)
	for file in \
		lilo_prompt.ppm \
		simulation.setup \
		system.vhdl \
		Makefile \
		; do \
		cp $${file} $(DESTDIR)$(thisexdir) ; \
	done ;

test: experiment
	@if  [ -z "`grep 'END of process REACHED' expect-run.log`" ] ; then \
		touch experimentFailed ; \
		echo "Experiment failed!" ; \
	fi
distclean::
	rm -f experimentFailed
