# 
# Copyright (C) 1999, 2000, 2001  Network Associates, Incorporated (NAI)
# All rights reserved.
#
# This file is part of the NAI Generic Software Wrappers Toolkit
# (GSWTK).  See ftp://ftp.tislabs.com/pub/wrappers/ for the latest
# distribution.
#
# The GSWTK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# The GSWTK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# $Id: Makefile,v 1.17 2001/04/05 18:41:16 stevek Exp $

TOPDIR = ../..

include ${TOPDIR}/mak/config.mak

OBJS = source${OBJ} dbi.tab${OBJ} dbi${OBJ} wr_db${OBJ} wr_vm${OBJ} \
       wr_utilities${OBJ}

CFLAGS += -I ${TOPDIR}/wss/include -I ${TOPDIR}/wsi/${BUILDDIR}/include
CFLAGS += -DUSER_MODE_TEST
UNIX_CFLAGS += -g -Wall

CXXFLAGS += -I ${TOPDIR}/wss/include -I ${TOPDIR}/wsi/${BUILDDIR}/include
CXXFLAGS += -DUSER_MODE_TEST
UNIX_CXXFLAGS += -g -Wall

CLEANFILES += lex.dbi.c dbi.tab.cc dbi.tab.cc.output dbi wss.db wr_db.c
CLEANFILES += wr_utilities.c ${OBJS}

all: dbi

clean:
	rm -f ${CLEANFILES}

dbi: ${OBJS}
	$(CC) -o $@ ${CFLAGS} ${LDFLAGS} ${OBJS} ${LIBS}

template: ${TOPDIR}/wr.lib/libwdl/template
	${LN} ${TOPDIR}/wr.lib/libwdl/template template

wr_db.c: ${TOPDIR}/wss/wss_db.c
	${LN} ${TOPDIR}/wss/wss_db.c wr_db.c

wr_utilities.c: ${TOPDIR}/wsi/${BUILDDIR}/wsi_utilities.c
	${LN} ${TOPDIR}/wsi/${BUILDDIR}/wsi_utilities.c wr_utilities.c

smap.h: ${TOPDIR}/wr.lib/libwdl/smap.h
	${LN} ${TOPDIR}/wr.lib/libwdl/smap.h smap.h

dbi.y: template

dbi.tab.cc: dbi.y lex.dbi.c smap.h
	bison -v -p dbi -o dbi.tab.cc dbi.y

lex.dbi.c: dbi.l
	flex -Pdbi dbi.l

