# $Header: /cvsroot/gprolog/contribs/gplmysql/Makefile,v 1.3 2002/01/29 05:26:03 oommoo Exp $

CC        = gcc
CFLAGS    = -g -Wall
CINCLUDES = -I/usr/include/mysql
CLIBS     = -L/usr/lib/mysql -lmysqlclient -lz
#DFLAGS    = -DADWDEBUG
DFLAGS    =
GP        = gplc
GPFLAGS   =

SOURCE    = first-prog.pl   \
            second-prog.pl  \
            mysql-cg.pl     \
            mysqlwrap.pl  

NATIVES = ${SOURCE:.pl=.c}

TARGETS = ${SOURCE:.pl=}

all: $(TARGETS)
	@echo Make all done.

first-prog: first-utils.c first-prog.pl
	$(GP) $(GPFLAGS) first-prog.pl first-utils.c

second-prog: second-utils.c second-prog.pl
	$(GP) $(GPFLAGS) second-prog.pl second-utils.c

mysql-cg: mysql-cg.c mysql-cg.pl
	$(GP) $(GPFLAGS) mysql-cg.pl mysql-cg.c -C '$(CFLAGS) $(CINCLUDES) $(DFLAGS)' -L '$(CLIBS)'

mysql-cg.o: mysql-cg.c 
#	$(CC) -c $(CFLAGS) $(DFLAGS) $(CINCLUDES) $(CLIBS)  mysql-cg.c
	$(GP) -c -C '$(CFLAGS) $(DFLAGS) $(CINCLUDES)' -L '$(CLIBS)'  mysql-cg.c

mysqlwrap: mysqlwrap.pl mysqlwrap.c mysqlwrap.h
	$(GP) $(GPFLAGS) mysqlwrap.pl mysqlwrap.c -L '$(CLIBS)'

mysqlwrap.o: mysqlwrap.c mysqlwrap.h
#	$(CC) -c $(CFLAGS) $(CINCLUDES) $(CLIBS)  mysqlwrap.c
	$(GP) -c -C '$(CFLAGS) $(CINCLUDES)' -L '$(CLIBS)'  mysqlwrap.c

doxy: Doxyfile 
	doxygen

clean:
	rm -f *.o *~ first-prog second-prog mysql-cg mysqlwrap
	rm -f ./tmp/*


# 
# $Log: Makefile,v $
# Revision 1.3  2002/01/29 05:26:03  oommoo
# Interesting suggestion from Renaud Mariana, using gplc to give suggestions for possible code improvement.  Also added a doxy target and some more details in macros for lists of prolog SOURCE files and c NATIVES.
#
# Revision 1.2  2002/01/18 11:24:27  diaz
# fix little bug + makefile
#
# Revision 1.1  2002/01/09 04:23:48  oommoo
# add gplsql example for relational database access using embedded c; (also includes two examples from the documentation).
# 
# 
