############# MathLink related paths and settings start: ####################
#### Specify here the fulll path to the Mathematica MathLink Developer Kit:
MLINKDIR = /export/local/Wolfram/Mathematica/7.0/SystemFiles/Links/MathLink/DeveloperKit

#### Specify the system SYS and the library name MLIB.
### For 64-bit Linux on x86 platform:
SYS = Linux-x86-64
BIT = 64
##Note, in Mathematica 6.0 the name for Linux-x86-64 was changed from ML to ML64i3:

MLIB = -lML64i3 
#-lstdc++ 
############# MathLink related paths and settings end. ####################

CC=gcc
CFLAGS= -I/usr/local/include -I/users/guest/asmirnov/tokyo -O3
LIBDIRS = -L/x1/tentukov/lib -L/usr/local/lib -L/users/guest/asmirnov/tokyo 
LIBS = -pthread  -Wl,--start-group ${MLIB} -lstdc++ -Wl,-end-group \
   -ltokyocabinet -lrt -lz -lbz2 -lm -lc -Wl,--start-group -lc -lnss_files \
   -lnss_dns -lresolv -Wl,-end-group


CADDSDIR = ${MLINKDIR}/${SYS}/CompilerAdditions
INCDIR = ${CADDSDIR}
MLIBDIR = ${CADDSDIR}
MPREP = ${CADDSDIR}/mprep

#QDBM = /users/guest/asmirnov/qdbm/qdbm-1.8.75
#QDBM = /x1/tentukov/qdbm-1.8.77
QDBM = /users/guest/asmirnov/tokyo

CFLAGS = -O3 -I${INCDIR} -I${QDBM} -I/usr/local/include 

###### Do not change anything below this line.


OBJ = QLink.o MathSide.o 

QLink${BIT}: $(OBJ)
	$(CC) -static $(OBJ) -L${MLIBDIR} ${LIBDIRS} ${LIBS} -o $@

QLink.o : QLink.c
	cc -c ${CFLAGS} QLink.c

MathSide.o : MathSide.c
	cc -c ${CFLAGS} MathSide.c

MathSide.c : MathSide.tm
	${MPREP} -o MathSide.c MathSide.tm
