#
# Modify the following 7 lines to suite your setup
#

# Binaries for your MySQL
MYSQLBIN=/usr/local/bin

# Dude that will create the database & tables
MYSQLUSER=root

# Dude's password
MYSQLPASSWORD=PinkFloyd

# MySQL library location
MYSQLLIBDIR=/usr/local/mysql/lib/mysql

# MySQL include files
MYSQLINCDIR=/usr/local/mysql/include/mysql

# Place to store 'accounting' binary
BINDIR=/usr/local/bin

# If you intend to store clear text passwords (Yek!), comment the following
# CFLAGS=-DCRYPT

#
# Leave the rest intact
#

MYSQLLIB=mysqlclient

CC=gcc

PROGS= accounting authmysql

all:                  $(PROGS) 

authmysql.o:	authmysql.c
	$(CC) -c authmysql.c $(CFLAGS) -I$(MYSQLINCDIR)
authmysql:	authmysql.o
	$(CC) -o authmysql authmysql.o -L$(MYSQLLIBDIR) -l$(MYSQLLIB) -lcrypt

accounting.o:	accounting.c	
	$(CC) -c accounting.c -I$(MYSQLINCDIR)

accounting:	accounting.o
	$(CC) -o accounting accounting.o -L$(MYSQLLIBDIR) -l$(MYSQLLIB)

clean:
	/bin/rm -f $(PROGS) *.o core

install:
	install -s -m 700  accounting $(BINDIR)/accounting
	install -s -m 775  authmysql $(BINDIR)/authmysql
createdb:
	$(MYSQLBIN)/mysqladmin create accounting -u $(MYSQLUSER) -p$(MYSQLPASSWORD)
createtables:
	$(MYSQLBIN)/mysql accounting -u $(MYSQLUSER) -p$(MYSQLPASSWORD) < create.sql
