# Makefile generated by imake - do not edit!
# $Xorg: imake.c,v 1.6 2001/02/09 02:03:15 xorgcvs Exp $

# ================ Generic Header ====================================
# $Id: Imake.tmpl,v 1.39 2004/04/08 19:07:33 queinnec Exp $

# Define commands and other parameters specific to site:

# ====================# Generic Site Parameters =======================
# $Id: Site.def,v 1.27 2003/11/16 12:04:09 queinnec Exp $

HOME   		= /home/queinnec
HOST		= bambou
HOSTTYPE	= i586
CVSROOT         = /home/cvsowner/cvsd-root/master

LATEX		= latex
BIBTEX		= bibtex
DELATEX		= detex -l
MAKEINDEX	= makeindex
SPELL		= ispell -l
EPELLE		= epelle -latex
PACK		= gzip
UNPACK		= gunzip
RM		= rm -f
CC		= cc
MAKE            = make
DVIPS           = dvips
DVIPSFLAGS	= -D600 -Z
LiSP2TeXFLAGS   = -vU -I/usr/local/lib/LiSP2TeX
RSYNC		= rsync --rsh ssh -z
RDIST		= rdist -P /usr/bin/ssh
RSH		= ssh -A -g -X
HEVEA		= hevea
HEVEAFLAGS	= -v -I ${HOME}/Hevea
HACHA		= hacha
HACHAFLAGS	= -v

XDVI            =       xdvi
ADVI            =       advi

TIME		= time
DELATEX         = cat
WAISDATABASES   = /usr/local/lib/freewais-sf/databases
PRINT           = print
FTPHOST		=	localhost

FTPDIR		=	/var/www/html/queinnec
LATEX2HTMLDIR	=	/usr/lib/latex2html
HEVEAFLAGS	=	-I ${HOME}/Hevea 			-I /usr/local/lib/hevea  		        -I /usr/local/lib/hevea/html

XDVIGEOM        =       1044x808+-20+-50
XDVIFLAGS       =       -xoffset 8mm -yoffset 15mm -s 6 			-expert -cr red -keep -paper a4r -bw 0                         -browser gnome-moz-remote -debug 4096

ADVIGEOM        =       1024x800+-0+-32
ADVIFLAGS       =       -nomargins -browser gnome-moz-remote 			-A -fullwidth -nocrop

EXPORTFLAGS	=	-i -ftp_dir=${FTPDIR}

# The generic rules that hold everywhere. They mainly concern
# concern TeX generation which is a not naive task given the
# circular constraints that exist.
.SUFFIXES: .epelle .spell .ind .idx .pdf .ps .dvi .bbl .aux .tex .bk .hbk

.tex.dvi: ;	${LATEX} $*.tex
.tex.aux: ;	${LATEX} $*.tex
.tex.bbl: ;	-${BIBTEX} $*
.idx.ind: ;	${MAKEINDEX} $*
.tex.spell: ;	${DELATEX} $*.tex | ${SPELL} | sort -u >$*.spell
.tex.epelle:
	DICOPLUS=${HOME}/.dicoplus.z ${EPELLE} $*.tex >$*.epelle

.dvi.ps:
	${DVIPS} ${DVIPSFLAGS} $*.dvi -o $*.ps
.ps.pdf:
	ps2pdf $*.ps $*.pdf

.SUFFIXES: .tex .rtf
LATEX2RTFFLAGS	=	-i french
.tex.rtf :
	latex2rtf -l ${LATEX2RTFFLAGS} -o $*.rtf $*.tex

# Default entry for the LiSP2TeX tool
LiSP2TeXFLAGS   = -vU -I/usr/local/lib/LiSP2TeX
.SUFFIXES: .tex .bk
.bk.tex :
	LiSP2TeX ${LiSP2TeXFLAGS} -- $*.bk > $*.tx
	expand < $*.tx > $*.tex && rm $*.tx
.SUFFIXES: .tex .hbk
.hbk.tex :
	LiSP2TeX ${LiSP2TeXFLAGS} -- $*.hbk > $*.tx
	expand < $*.tx > $*.tex && rm $*.tx

# Rules to convert xfig figures.
.SUFFIXES: .tex .ps .eps .xfig .fig .gif
.xfig.ps : ;	fig2dev -L ps $*.xfig > $*.ps
.fig.ps : ;	fig2dev -L ps $*.fig > $*.ps
.xfig.eps : ;	fig2dev -L eps $*.xfig > $*.eps
.fig.eps : ;	fig2dev -L eps $*.fig > $*.eps
.xfig.tex : ;	fig2dev -L latex $*.xfig > $*.tex
.fig.tex : ;	fig2dev -L latex $*.fig > $*.tex
.xfig.gif :
	fig2dev -L gif -t '#ffffff' $*.xfig $*.gf
	giftrans -t '#ffffff' -o $*.gif $*.gf
	rm $*.gf
.fig.gif :
	fig2dev -L gif -t '#ffffff' $*.fig $*.gf
	giftrans -t '#ffffff' -o $*.gif $*.gf
	rm $*.gf
.gif.eps :
	convert $*.gif $*.eps

# =====================================================================
# $Id: Imake.rules,v 1.37 2003/11/16 12:04:05 queinnec Exp $

# ==================== Specific entries ===============================

# $Id: Imakefile,v 1.28 2004/04/20 17:00:19 queinnec Exp $
# Tests et installation des programmes de correction automatique.

work : 	compile.all 	test.junit 	test.log2html 	test.tee_head 	test.count.pl 	test.dist.pl 	test.norm.pl 	test

clean ::
	-rm tmp.out*

JDK_HOME	=	/usr/java/j2sdk1.4.2_04
RT		=	${JDK_HOME}/jre/lib/rt.jar
JUNIT		=	/opt/java/junit3.8.1/junit.jar
CP		=	${RT}:${JUNIT}
JAVAC		=	jikes -classpath .:${CP}

compile.all : compile.c compile.java
compile.c : confiner
compile.java :
	${JAVAC} fr/lip6/qnc/cfskit/?*.java
	jar -cf ../cfskit.jar fr/lip6/qnc/cfskit/?*.class

test.junit : compile.java
	cd junit-tests/ && for c in Test_*.java ; do	${JAVAC} -cp ..:${CP} $$c ; done

	-cd junit-tests/ && java -cp ..:.:${CP} 		fr.lip6.qnc.cfskit.TestRun Test_TestRun >/tmp/ttr

	grep '100 Assertions, 1 Tests, 0 Failures' /tmp/ttr
	-cd junit-tests/ && java -cp ..:.:${CP} 		fr.lip6.qnc.cfskit.TestRun Test_Abort >/tmp/ttr

	grep '100 Assertions, 2 Tests, 1 Failures' /tmp/ttr
	@echo;echo "   *** ALL junit cfskit passed successfully *** ";echo

# ###################################################
# Mettre en place le cfskit sur tique (via youpou):
# Comme les sources doivent etre accessibles depuis tique et mygale,
# ils sont potentiellement aussi visibles par les etudiants.

MIDDLE		=	youpou.lip6.fr
MIDDLEPATH	=	Cours/Licence/CFS/src
REMOTE		=	tique.infop6.jussieu.fr
PREFREMOTEPATH	=	/Enseignants/Infos/licence/CFS
REMOTEPATH	=	${PREFREMOTEPATH}/src

install : to.youpou
to.youpou :
	${RSYNC} -avu . ${MIDDLE}:${MIDDLEPATH}/
	${RSH} ${MIDDLE} "cd ${MIDDLEPATH}/ && m on.youpou"

on.youpou : to.tique
to.tique :
	rm -f `find . -name '*~' -print`
	${RSYNC} -avuL . ${REMOTE}:${REMOTEPATH}/
	@echo "Proteger ce repertoire de la curiosite estudiantine"
	${RSH} ${REMOTE} "cd ${PREFREMOTEPATH}/ && chmod 711 . "
	@echo "Proteger ces binaires de la curiosite estudiantine"
	${RSH} ${REMOTE} "cd ${PREFREMOTEPATH}/ && chmod -R 711 bin "
	@echo "cfskit installed on ${REMOTE}"

# #####################################################
#                         TESTS
# #####################################################

# ############################################# test confiner en C
# Obsolete! On n'utilise plus que rt_confiner ecrit en shell.
CFLAGS	=	-Wall -ansi -pedantic -g

confiner : confiner.c
	${CC} ${CFLAGS} confiner.c -o confiner

test.confiner : confiner
	./confiner -h
	./confiner --help
	./confiner --cpu=44 -- /bin/date
	./confiner --cpu=44 -- date
	./confiner --cpu=44 -- date -u
	./confiner --cpu=44 -- echo coucou > tmp.out
	echo coucou > tmp.out2 && diff tmp.out tmp.out2
	./confiner --cpu=44 -- cat < Imakefile > tmp.out
	diff Imakefile tmp.out
	echo 'while true ; do false ; done' > loop.sh
	-./confiner --cpu=2 -- bash loop.sh 2>&1
	-./confiner --fsize=10000 -- cat </dev/zero >tmp.out
	ls -l tmp.out
	-./confiner --data=10000000 -- ${HOME}/c/mem
	-./confiner --cpu=10 --nproc=70 -- sh -c "date&date&date&date"
	echo 'while true ; do (bash ./loop.sh & echo $$!) ; done' > foster.sh
	-./confiner --cpu=1 --nproc=100 -- sh foster.sh
	-rm -f loop.sh foster.sh tmp.out*

# ############################################## test compresseur de fichier

test.log2html :
	echo -n > /tmp/coucou
	perl log2html.pl ignore-that-uuid /dev/null /tmp/coucou >/tmp/coucou.out
	-grep Coucou /tmp/coucou.out >/tmp/coucou.count
	diff /tmp/coucou /tmp/coucou.count
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 " ..."
	for i in 1; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 " ..."
	for i in 1 2; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 3 " ..."
	for i in 1 2 3; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 3 4 " ..."
	for i in 1 2 3 4; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 3 4 5 " ..."
	for i in 1 2 3 4 5; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 3 4 5 6 " ..."
	for i in 1 2 3 4 5 6; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

	@echo; echo "Testing log2html with" 1 2 3 4 5 6 7 " ..."
	for i in 1 2 3 4 5 6 7; do echo Coucou ; done > /tmp/coucou
	perl log2html.pl ignore-that-uuid  /dev/null /tmp/coucou > /tmp/coucou.out
	grep Coucou /tmp/coucou.out >/tmp/coucou.count
	cd /tmp && diff coucou coucou.count || grep similaires coucou.out
	rm -f /tmp/coucou*

# ################################################ Test tee_head
# tee_head est un limiteur de flux.

test.tee_head :
	echo Coucou > /tmp/coucou
	cat /tmp/coucou | perl tee_head.pl 1000 		/tmp/coucou.out > /tmp/coucou2.out

	diff /tmp/coucou /tmp/coucou.out
	diff /tmp/coucou /tmp/coucou2.out
	for i in 1 2 3 4 5 6 7 8 9 ; do echo Coucou ; done > /tmp/coucou
	cat /tmp/coucou | perl tee_head.pl 50 		/tmp/coucou.out > /tmp/coucou2.out

	diff /tmp/coucou /tmp/coucou.out || grep WARNING /tmp/coucou.out
	diff /tmp/coucou.out /tmp/coucou2.out
	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	echo Coucou ; done ; done ; done > /tmp/coucou

	cat /tmp/coucou | perl tee_head.pl 1k 		/tmp/coucou.out > /tmp/coucou2.out

	diff -q /tmp/coucou /tmp/coucou.out || grep WARNING /tmp/coucou.out
	diff /tmp/coucou.out /tmp/coucou2.out
	[ `wc -c < /tmp/coucou.out` -lt 1200 ]
	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	for i in 1 2 3 4 5 6 7 8 9 0; do 	echo Coucou ; done ; done ; done ; done ; done > /tmp/coucou

	cat /tmp/coucou | perl tee_head.pl 10k 		/tmp/coucou.out > /tmp/coucou2.out

	diff -q /tmp/coucou /tmp/coucou.out || grep WARNING /tmp/coucou.out
	diff /tmp/coucou.out /tmp/coucou2.out
	[ `wc -c < /tmp/coucou.out` -lt 10200 ]
	@echo;echo "********* All tests on tee_head successful *************"

# ################################################ test dist.pl
# dist.pl calcule la distance de Levenstein entre deux fichiers.

test.dist.pl :
	(echo a; echo bb; echo c) > /tmp/f1
	(echo a; echo bbd; echo c) > /tmp/f2
	[ 0 = `perl dist.pl /tmp/f1 /tmp/f1 | cut -d ' ' -f3` ] && echo OK
	[ 1 = `perl dist.pl /tmp/f1 /tmp/f2 | cut -d ' ' -f3` ] && echo OK
	cat /tmp/f1 /tmp/f2 > /tmp/f3
	[ 3 = `perl dist.pl /tmp/f1 /tmp/f3 | cut -d ' ' -f3` ] && echo OK
	cat /tmp/f2 /tmp/f2 > /tmp/f4
	[ 1 = `perl dist.pl /tmp/f3 /tmp/f4 | cut -d ' ' -f3` ] && echo OK
	cat /tmp/f2 /tmp/f1 > /tmp/f5
	perl dist.pl /tmp/f3 /tmp/f5
	[ 2 = `perl dist.pl /tmp/f3 /tmp/f5 | cut -d ' ' -f3` ] && echo OK
	-rm /tmp/f0
	touch /tmp/f0
	[ 3 = `perl dist.pl /tmp/f1 /tmp/f0 | cut -d ' ' -f3` ] && echo OK
	[ 6 = `perl dist.pl /tmp/f0 /tmp/f3 | cut -d ' ' -f3` ] && echo OK
	[ 0 = `perl dist.pl /tmp/f0 /tmp/f0 | cut -d ' ' -f3` ] && echo OK
	[ 0 = `perl dist.pl dist.pl dist.pl | cut -d ' ' -f3` ] && echo OK
	@echo;echo "******* all tests on dist.pl successful *******"

# ################################################ test norm.pl
# norm.pl normalise un fichier (enleve les blancs, la casse et les lignes vides)

test.norm.pl :
	[ 1 = `echo ab | perl norm.pl | wc -l` ]
	[ 2 = `(echo ab; echo; echo c) | perl norm.pl | wc -l` ]
	[ 2 = `(echo ab; echo '  '; echo SPACES) | perl norm.pl | wc -l` ]
	[ 2 = `(echo ab; echo '	'; echo TAB) | perl norm.pl | wc -l` ]
	[ 2 = `(echo ab; echo; echo c d; echo) | perl norm.pl | wc -w` ]
	[ 2 = `(echo ab; echo; echo c d; echo; echo) | perl norm.pl | wc -l` ]
	[ ab = `echo A B | perl norm.pl` ]
	@echo;echo "******* all tests on norm.pl successful *******"

# ################################################ test count.pl
# count.pl compte des mots (ou des regexps) dans stdin.

test.count.pl : count.pl
	@echo;echo "            Comptes simples ..."
	echo lajdsf | perl count.pl aaa
	[ `echo lajdsf | perl count.pl aaa` = 0 ]
	[ `echo caaab | perl count.pl aaa` = 1 ]
	[ `echo aaab | perl count.pl aaa` = 1 ]
	[ `echo caaa | perl count.pl aaa` = 1 ]
	[ `echo aaa | perl count.pl aaa` = 1 ]
	echo aaabaaa | perl count.pl aaa
	[ `echo aaabaaa | perl count.pl aaa` = 2 ]
	[ `(echo aaa; echo baaa) | perl count.pl aaa` = 2 ]
	(echo aaa; echo; echo baaa) | perl count.pl aaa
	[ `(echo aaa; echo; echo baaa) | perl count.pl aaa` = 2 ]
	@echo;echo "             Comptes speciaux ..."
	echo ':)' | perl count.pl ':)'
	[ `echo ':)' | perl count.pl ':)'` = 1 ]
	[ `echo ':):(' | perl count.pl ':)'` = 1 ]
	[ `echo 'a:c)' | perl count.pl ':)'` = 0 ]
	[ `(echo 'a:) ::)'; echo ':)') | perl count.pl ':)'` = 3 ]
	@echo;echo "             les options ..."
	(echo aaa; echo; echo baaa) | perl count.pl aaa
	[ `(echo aaa; echo; echo BAAA) | perl count.pl aaa` = 1 ]
	[ `(echo aaa; echo; echo BAAA) | perl count.pl -i aaa` = 2 ]
	[ `(echo aaa; echo; echo aBaa) | perl count.pl -regexp 'a+'` = 3 ]
	[ `(echo aaa; echo; echo ABAA) | perl count.pl -i -regexp 'a+'` = 3 ]
	@echo;echo "********* All tests on count.pl successful *************"

# ########################################## Tests des scripts run*.sh
# Le repertoire Tests/ contient les <<questions>> pour les tests
# internes en fait une seule question nommee InternalTests/ contenant
# tous les scripts ordonnes a tourner. Il n'y a pas besoin d'avoir des
# <<solutions>>.

RT_LOG_DIR	=	/tmp/logs
RT_TMP		=	/tmp/r

test.runtests :
	-rm -rf ${RT_LOG_DIR}/InternalTests1
	-mkdir -p /tmp/r
	${MAKE} run.one.test RT_TESTS_DIR=`pwd`/tests Q=InternalTests-Q1 		SOLUTION_DIR=/tmp RT_UUID=InternalTests1 M=612222

	@echo cat ${RT_LOG_DIR}/InternalTests1/InternalTests-Q1.log
	@echo;echo "********* All Internal tests successful *************"

test.runtests.with.links :
	export RT_LINK_TEST=`pwd`/genlink.sh ;	export RT_HTTP_PREFIX=SeeIfImHere ;	${MAKE} test.runtests

	grep SeeIfImHere ${RT_LOG_DIR}/InternalTests1/InternalTests-Q1.log

test.runalltests :
	-rm -rf ${RT_LOG_DIR}/InternalTests
	-rm -f /tmp/run.all.tests
	-mkdir /tmp/r
	-mkdir -p ${RT_TMP}
	export RT_MARK_DIR=`pwd` ;	export RT_UUID=InternalTests ;	export RT_TESTS_DIR=`pwd`/tests ;	export RT_LOG_DIR=${RT_LOG_DIR} ;	export RT_TMP=${RT_TMP} ;	cd /tmp/r && 	$$RT_MARK_DIR/runalltests.sh bof 2>&1 | tee /tmp/run.all.tests

	MARK=`sed -ne 's/^Total obtenu: //p' </tmp/run.all.tests ` && 	[ "$$MARK" = 613333 ]

test : 	test.runtests 	test.runtests.with.links 	test.runalltests

	@echo; echo ALL TESTS PASSED SUCCESSFULLY; echo

# ##########################################
# Tester l'option -n de run.sh

test.run.sh :
	-rm -rf /tmp/logs
	-mkdir /tmp/logs
	-rm -rf /tmp/run
	-mkdir /tmp/run
	export CFSKIT_DIR=`pwd`;	export RT_MARK_DIR=`pwd` ;	export RT_TESTS_DIR=`pwd`/../CFS2002jan30/tests ;	export RT_LOG_DIR=/tmp/logs ;	export RT_TMP=${RT_TMP} ;	export RT_SESSION=CFSjan30am ;	export RT_HTTP_PREFIX="file:$$RT_TESTS_DIR/" ;	cd /tmp/run && bash $$RT_MARK_DIR/run.sh -n 	   /archive/remote/Ens/licence/2001/cct/CFS/2002janvier/LIC_CFS-1/30am

# ########################################## obsolete ?
test.runtests.old : runtests.sh runtestlib.sh
	-rm -rf ${RT_LOG_DIR}
	${MAKE} test.question1
	${MAKE} test.question2
	${MAKE} test.question3
	${MAKE} test.question4
	${MAKE} test.question5

test.question1 :
	@echo; echo "********** Notation question 1"; echo
	${MAKE} run.one.test D=student1  Q=30-01-02-matin-Q1 M=0
	${MAKE} run.one.test D=student2  Q=30-01-02-matin-Q1 M=1
	${MAKE} run.one.test D=student2a Q=30-01-02-matin-Q1 M=1
	${MAKE} run.one.test D=student2b Q=30-01-02-matin-Q1 M=1
	${MAKE} run.one.test D=student3  Q=30-01-02-matin-Q1 M=2
	${MAKE} run.one.test D=student4  Q=30-01-02-matin-Q1 M=1.1

test.question2 :
	@echo; echo "********** Notation question 2"; echo
	${MAKE} run.one.test D=student5  Q=30-01-02-matin-Q2 M=7

test.question3 :
	@echo; echo "********** Notation question 3"; echo
	${MAKE} run.one.test D=student6  Q=30-01-02-matin-Q3 M=0.65
	${MAKE} run.one.test D=student7  Q=30-01-02-matin-Q3 M=1
	${MAKE} run.one.test D=student8  Q=30-01-02-matin-Q3 M=0.95

test.question4 :
	@echo; echo "********** Notation question 4"; echo
	${MAKE} run.one.test D=student9  Q=30-01-02-matin-Q4 M=3

test.question5 :
	@echo; echo "********** Notation question 5"; echo
	-rm ../solutions/student9/dico.txt
	${MAKE} run.one.test D=student9  Q=30-01-02-matin-Q5 M=0.9
	-rm -rf ../solutions/student10
	cd ../solutions && cp -rp Titou student10
	${MAKE} run.one.test D=student10 Q=30-01-02-matin-Q5 M=1

test.all.questions :
	if [ -d "${RT_LOG_DIR}" ] ; then rm -rf ${RT_LOG_DIR} ; else true ; fi
	-rm -rf ../solutions/student10
	cd ../solutions && cp -rp Titou student10
	@echo; echo "********** Notation toutes questions"; echo
	export HERE=`pwd` ;	export RT_TESTS_DIR=$$HERE/../CFS2002jan30/tests ;	export RT_LOG_DIR=${RT_LOG_DIR} ;	export RT_TMP=${RT_TMP} ;	cd ../solutions/student10 && 	time $$HERE/runalltests.sh

	echo mozilla file:`ls -t ${RT_LOG_DIR}/?*?/all.html | head -1 `
	perl ./extract.pl `ls -t ${RT_LOG_DIR}/?*?/all.log | head -1 `

test.several.students :
	if [ -d "${RT_LOG_DIR}" ] ; then rm -rf ${RT_LOG_DIR} ; else true ; fi
	-rm -rf ../solutions/?
	cd ../solutions && cp -rp Titou A
	cd ../solutions && cp -rp Christian B
	export HERE=`pwd` ;	export RT_TESTS_DIR=$$HERE/../CFS2002jan30/tests ;	export RT_LOG_DIR=${RT_LOG_DIR} ;	export RT_TMP=${RT_TMP} ;	for student in ../solutions/? ; do ( 	echo "------------- Notation de l'etudiant $$student" ; 	cd $$student && time $$HERE/runalltests.sh ) ; done

# L'etudiant D a noter sur la question Q, note attendue: M.
D	=	student
Q	=	30-01-02-matin-Q1
M	=	0
RT_TESTS_DIR	=	`pwd`/../CFS2002jan30/tests
SOLUTION_DIR	=	../solutions/${D}
run.one.test :
	-rm -f /tmp/run.one.test
	export HERE=`pwd` ;	export RT_TESTS_DIR=${RT_TESTS_DIR} ;	export RT_LOG_DIR=${RT_LOG_DIR} ;	export RT_TMP=${RT_TMP} ;	cd ${SOLUTION_DIR} && 	$$HERE/runtests.sh ${Q} 2>&1 | tee /tmp/run.one.test

	@if egrep -q "question ${Q}: ${M}\.?$$" < /tmp/run.one.test ;	then echo "	-------- Test OK -------" ; rm -f /tmp/run.one.test ;	else echo "*** PROBLEME ***" ; exit 1 ; fi

# end of Imakefile

# ==================== Generic entries ================================
# The generic entries that must be everywhere;
PROMPT	=	">>>>>>>>>>>>>>>>>"

# This one does nothing
nothing :

# Check-in back all files that are checked-out whether RCS or CVS
ckpt :
	@perl ${HOME}/perl/ckpt.prl .
rec.ckpt : ckpt
	@PWD=`pwd` ; export PWD                                 ; \
	for d in `find . -type d -print`                        ; \
	  do ( cd $$d ; echo Checkpointing $$d                        ; \
	    ${MAKE} -f $$PWD/Makefile ckpt ) ; done

# Sanitize with respect to RCS or CVS (faster than old.notci)
notci sanitize :
	@perl ${HOME}/perl/sanitize.prl .
rec.notci : notci
	@PWD=`pwd` ; export PWD                                 ; \
	for d in `find . -type d -print`                        ; \
	  do ( cd $$d ; echo Sanitizing $$d                        ; \
	    ${MAKE} -f $$PWD/Makefile notci ) ; done

# Erase useless files
clean ::
	-${RM} core *.BAK *~ .*.BAK .*~ *.~*.~ .*.~*.~
rec.clean : clean
	@PWD=`pwd` ; export PWD                                 ; \
	for d in `find . -type d -print`                        ; \
	  do ( cd $$d ; echo Cleaning $$d                        ; \
	    ${MAKE} -f $$PWD/Makefile clean ) ; done

# Erase useless files in a Tex, LaTeX, BibTeX contexts, ChangeBar files
cleantex ::
	-${RM} *.log *.aux *.lof *.lot *.toc
	-${RM} *.blg *.bbl
	-${RM} *.idx *.ilg *.ind
	-${RM} *.spell *.epelle
	-${RM} *.cb
cleandvi ::
	-${RM} *.dvi

advi.pro :
	ln -sf /usr/share/texmf/tex/latex/advi/advi.pro ./

# Calm down the screen saver during a presentation:
xset.off :
	xset s off

# This entry maps a make entry on all subdirectories, the work to be
# done is held in the MAPWORK variable
MAPWORK=clean
mapdirectories ::
	@for d in `ls -F | sed -e '/\/\$$/s,.\$$,,p' -e d` 	; 	do ( cd $$d 						; 	     echo "			on $$d: m ${MAPWORK}" 	; 	     m ${MAKEFLAGS} "${MAPWORK}" ) 			; 	done

# This entry compresses all not yet compressed files of a directory. The
# makefile is not compressed in order to ease the reverse action.
compress ::
	@for f in `ls -AF`					; 	 do case $$f in *[mM]akefile|*/|*.Z) :			;;                         *) echo ${PACK} $$f ; ${PACK} $$f	;;             esac						;          done

# This entry removes the generated Makefile.
# Usually one uses it as                clean :: cleanMakefile
cleanMakefile :
	-@if [ -f Imakefile ] ; then ${RM} -f Makefile ; fi

# This entry depends on FILE, STAMP and DATE
# It changes all occurrences of STAMP...tar into STAMPDATE.tar
# This is used to keep track of files within html pages.

update.file :
	@if [ -z "${FILE}" ] ; then echo Define FILE first ; exit 1 ;		else exit 0 ; fi

	@if [ -z "${STAMP}" ] ; then echo Define STAMP first ; exit 1 ;		else exit 0 ; fi

	@if [ -z "${DATE}" ] ; then echo Define DATE first ; exit 1 ;		else exit 0 ; fi

	@echo
	@echo "	Updating ${FILE} ..."
	@echo
	if [ -f ${FILE}.BAK ]; then exit 0; else 	  mv ${FILE} ${FILE}.BAK ; cp ${FILE}.BAK ${FILE} ; fi

	$$HOME/perl/updatefile.prl -stamp="${STAMP}" -date="${DATE}" -- ${FILE}
	chmod u+w ${FILE}

# Turn off the screen saver during a talk

screen.saver.off :
	xset s off

