TCL_VER	?=	8.3
TCL_DVER =	${TCL_VER:S/.//}
PREFIX	?=	/usr/local

CFLAGS	+=	-DHAVE_READLINE=1 -DOS_UNIX=1 -DOS_WIN=0
CFLAGS	+=	-I${PREFIX}/include/tcl${TCL_VER} -I${PREFIX}/include
CFLAGS	+=	-I${.CURDIR}/src -I${.CURDIR}

LDADD	+=	-lreadline -L${PREFIX}/lib -ltcl${TCL_DVER} -lm -lgdbm

.PATH:	${.CURDIR}/src

SRCS	 =	btree.c build.c dbbe.c dbbegdbm.c dbbemem.c delete.c expr.c \
		insert.c main.c pager.c parse.y printf.c random.c select.c \
		shell.c table.c tokenize.c update.c util.c vdbe.c where.c \
		tclsqlite.c

INCS	 =	sqlite.h

LIB	 =	sqlite
SHLIB_MAJOR=	1
SHLIB_MINOR=	0

sqlite.h:	sqlite.h.in VERSION
	sed -e s/--VERS--/`cat ${.CURDIR}/VERSION`/ \
            -e s/--ENCODING--/ISO8859/ \
                 ${.CURDIR}/src/sqlite.h.in > sqlite.h

parse.h parse.c: parse.y
	lemon o=parse ${.ALLSRC}

INCDIR	 =	${PREFIX}/include
LIBDIR	 =	${PREFIX}/lib

.include <bsd.lib.mk>

${OBJS} ${SOBJS}: parse.h sqlite.h
