# --------------------------------------------------------
# Tcl-GDBI Makefile
#
# Getting this to work:
# Edit section II to suite your needs.
# Find your operating system from section III, uncomment it,
# comment out the other operating systems, and modify the
# paths as necessary.
# Then type
#	make clean ; make
#
# $Id: Makefile,v 1.12 2000/01/14 17:47:03 tdarugar Exp $
# --------------------------------------------------------


# --------------------------------------------------------
# Section I:
SRC 	   = sql-mysql.cc sql.cc sql-manager.cc
OBJ_DIR  = obj
OBJS	   = $(SRC:%.cc=$(OBJ_DIR)/%.o)
# --------------------------------------------------------

# -- Configurable parameters: ----------------------------
# Section II:
CC	= g++
LD	= g++
FLAGS	= -Wall
# include the path to your libmysqlclient as one of the -L's
LD_FLAGS = -L/usr/lib/mysql -L/usr/local/mysql/lib \
	-L/usr/lib -lmysqlclient
# include path to mysql includes
INCLUDE  = -I/usr/local/include -I/usr/include/mysql -I/usr/local/mysql/include

# --------------------------------------------------------
# Section III


# --------------------------------------------------------
# Linux:
EXTRA_FLAGS    = -fPIC 
EXTRA_LD_FLAGS = -shared -lgcc
# On some versions of linux you might need to add the following to
# EXTRA_FLAGS and EXTRA_LD_FLAGS:
# -u __divdi3  -u __moddi3

# --------------------------------------------------------
# Solaris:
#EXTRA_FLAGS    = -fPIC -shared
#EXTRA_LD_FLAGS = -L/usr/local/mysql -lnsl -lsocket -shared
#LD	= ld
# You will need to modify the following paths to your libmysqlclient.so
# and libgcc.a
#EXTRA_LINKS = /usr/local/mysql/lib/libmysqlclient.a \
#        /opt/GCC2721/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/libgcc.a

# --------------------------------------------------------
# FreeBSD:
# CC     = cc
# EXTRA_LD_FLAGS = -lg++ -lstdc++ -lm -lgcc_pic

# --------------------------------------------------------
# You shouldn't need to modify anything below this line.
# 

CURDATE = `date +%y%m%d`

.SUFFIXES:	.o .cc

all:	sql.so

$(OBJ_DIR)/%.o: %.cc
	$(CC) -c $(INCLUDE) $(EXTRA_FLAGS) $(FLAGS) -o $@ $<

sql.so:	$(OBJS)
	$(LD) $(OBJS) $(EXTRA_LINKS) $(LD_FLAGS) $(EXTRA_LD_FLAGS) -o sql.so

clean:
	@ rm -f *~ $(OBJ_DIR)/*.o sql.so
	@ echo "Cleaned"
