#
# $Id: Makefile,v 1.7 2004/07/05 11:20:33 dtynan Exp $
#
# Copyright (c) 2003, Kalopa Media Limited.  All rights reserved.
#
# This 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.
#
# It 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 product; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
# USA.
#
# THIS SOFTWARE IS PROVIDED BY KALOPA MEDIA LIMITED "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL KALOPA MEDIA LIMITED BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ABSTRACT
#
# $Log: Makefile,v $
# Revision 1.7  2004/07/05 11:20:33  dtynan
# Added support for nested queries.
#
# Revision 1.6  2004/04/30 11:48:29  dtynan
# Lots of changes for minor bug fixes, added functionality and the like.
# Notably the following:
#     o	Added a 'db_findXXXfirst()' function for searching the entired
# 	table.
#     o	Added a 'db_runXXXquery()' function which will run an SQL
# 	statement (without parsing any arguments) and return the
# 	first match.
#     o	Fixed a bug where the include() m4 statement was being used
# 	more than once.
#     o	Put the 'EMIT' code at the bottom of the output file.
#
# Revision 1.5  2004/01/28 13:53:57  dtynan
# Minor changes prior to 0.3 release.
#
# Revision 1.4  2004/01/26 23:46:46  dtynan
# Don't produce a separate include file.
#
# Revision 1.3  2003/11/17 13:15:16  dtynan
# Various changes to fix errors in the back-end code.
#
# Revision 1.2  2003/10/14 14:10:56  dtynan
# Some fixes for SQL and C, as well as 'dnl' lines in the M4 templates to
# reduce blank lines in the output.
#
# Revision 1.1  2003/10/14 13:00:18  dtynan
# Major revision of the DBOW code to use M4 as a back-end instead of
# hard-coding the output.
#
.SUFFIXES:	.d .sql .m4

MYSQL_INC=/usr/local/include/mysql
MYSQL_LIB=/usr/local/lib/mysql

PREFIX?=/usr/local
DBOWDIR=$(PREFIX)/share/dbow

CFLAGS=	-O -I$(MYSQL_INC) -I../lib -DDEBUG -DYYDEBUG -DDBOW=\"$(DBOWDIR)\"

all:	sample

install: sample

clean:
	rm -f sample.c sample.h sample.o sample

sample: sample.o
	$(CC) -o sample -L../lib -L$(MYSQL_LIB) sample.o -ldbow -lmysqlclient

.d.sql:	
	../src/dbow -t mysql -o $@ $<

.d.c:
	../src/dbow -N -t C -o $@ $<

.d.m4:
	../src/dbow -m -t C -o $*.m4 $<
