TCL_VER	?=	8.3

SRCS	!=	echo ${.CURDIR}/*.tcl
DOCS	 =	${SRCS:Nopcode.tcl:.tcl=.html}
CODE	!=	echo ${.CURDIR}/../src/*.[chy]

all:	${DOCS} opcode.html

opcode.html:: opcode.tcl vdbe.c
	tclsh${TCL_VER} ${.ALLSRC} > opcode.html

.SUFFIXES:	.tcl .html

.tcl.html:
	tclsh${TCL_VER} $*.tcl > $*.html

${DOCS}:	last_change

.PATH: ${.CURDIR}/../src

last_change: ${CODE}
	awk '/\$$Id:/ && NF > 4 { \
		if ($$2 == "\$$Id:") print $$5 "," $$6; \
		else print $$6 "," $$7 \
	}' ${.ALLSRC} | sort -t, | tail -1 > lc && mv lc last_change
