2004-11-08 15:55:23 +00:00
|
|
|
#T= mysql
|
|
|
|
T= postgres
|
|
|
|
#T= oci8
|
|
|
|
#T= odbc
|
|
|
|
#T= sqlite
|
|
|
|
|
|
|
|
#LIB_EXT= .so
|
|
|
|
LIB_EXT= .dylib
|
|
|
|
#LIB_OPTION= -shared
|
|
|
|
LIB_OPTION= -dynamiclib
|
|
|
|
COMPAT_DIR= ../compat
|
|
|
|
|
2004-11-03 10:46:06 +00:00
|
|
|
VERSION= 2.0b2
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
OBJS= compat-5.1.o luasql.o ls_$T.o
|
|
|
|
LIBNAME= lib$T.$(VERSION)$(LIB_EXT)
|
|
|
|
LOADLIB= $T$(LIB_EXT)
|
|
|
|
|
|
|
|
# Driver specific
|
|
|
|
# SQLite
|
|
|
|
#DRIVER_LIBS= -lsqlite
|
|
|
|
#DRIVER_INCS=
|
|
|
|
|
|
|
|
# PostgreSQL
|
|
|
|
DRIVER_LIBS= -L/usr/local/pgsql/lib -lpq
|
|
|
|
DRIVER_INCS= -I/usr/local/pgsql/include
|
|
|
|
|
|
|
|
# Oracle OCI8
|
|
|
|
#DRIVER_LIBS= -L/home/oracle/OraHome1/lib -lz -lclntsh
|
|
|
|
#DRIVER_INCS= -Itomas/dblua_oci8/linux/include -I/home/oracle/OraHome1/rdbms/demo -I/home/oracle/OraHome1/rdbms/public
|
|
|
|
|
|
|
|
# MySQL
|
|
|
|
#DRIVER_LIBS= -L/usr/local/mysql/lib -lmysqlclient
|
|
|
|
#DRIVER_INCS= -I/usr/local/mysql/include
|
2003-12-01 16:13:13 +00:00
|
|
|
|
|
|
|
WARN= -Wall -Wmissing-prototypes -Wmissing-declarations -ansi
|
2004-11-08 15:55:23 +00:00
|
|
|
INCS= -I/usr/local/include/lua5 -I$(COMPAT_DIR) $(DRIVER_INCS)
|
|
|
|
LIBS= $(DRIVER_LIBS) -llua-5.0 -llualib-5.0 -lm -ldl
|
2003-12-01 16:13:13 +00:00
|
|
|
CFLAGS= -O2 $(WARN) $(INCS) $(DEFS)
|
2004-11-08 15:55:23 +00:00
|
|
|
CC= gcc
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2003-05-08 22:46:40 +00:00
|
|
|
PKG= luasql-$(VERSION)
|
2004-11-08 15:55:23 +00:00
|
|
|
DIST_DIR= $(PKG)
|
2003-05-08 22:46:40 +00:00
|
|
|
TAR_FILE= $(PKG).tar.gz
|
|
|
|
ZIP_FILE= $(PKG).zip
|
|
|
|
SRCS= README Makefile \
|
2004-10-15 12:30:26 +00:00
|
|
|
luasql.h luasql.c def.tmpl \
|
2004-11-08 15:59:16 +00:00
|
|
|
ls_postgres.c \
|
2003-08-29 14:25:00 +00:00
|
|
|
ls_odbc.c \
|
|
|
|
ls_oci8.c \
|
|
|
|
ls_mysql.c \
|
2004-08-18 18:10:37 +00:00
|
|
|
ls_sqlite.c \
|
2003-05-08 22:46:40 +00:00
|
|
|
test.lua performance.lua \
|
2003-12-29 15:27:23 +00:00
|
|
|
index.html manual.html license.html authors.html luasql.png
|
2003-04-07 13:41:29 +00:00
|
|
|
|
|
|
|
AR= ar rcu
|
|
|
|
RANLIB= ranlib
|
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
|
|
|
|
lib: $(OBJS)
|
|
|
|
$(CC) $(CFLAGS) -o $(LIBNAME) $(LIB_OPTION) $(OBJS) $(LIBS)
|
2004-10-15 12:28:07 +00:00
|
|
|
|
|
|
|
compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c
|
|
|
|
$(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
dist: dist_dir
|
|
|
|
tar -czf $(TAR_FILE) $(DIST_DIR)
|
|
|
|
zip -lq $(ZIP_FILE) $(DIST_DIR)/*
|
|
|
|
rm -rf $(DIST_DIR)
|
|
|
|
|
|
|
|
dist_dir:
|
|
|
|
mkdir $(DIST_DIR)
|
|
|
|
cp $(SRCS) $(DIST_DIR)
|
|
|
|
|
|
|
|
#sqlitelinux: $(SQLITE_LIB) $(SQLITE_SO)
|
2003-05-05 10:06:34 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#pglinux: $(PG_LIB) $(PG_SO)
|
2004-08-18 18:10:37 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#pgmac: $(PG_LIB) $(PG_DYLIB)
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#odbcwin:
|
|
|
|
#sed -e "s/VERSION_NUMBER/$(VERSION)/" -e "s/DRIVER/odbc/" def.tmpl > odbc.def
|
2003-04-15 18:26:08 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#ocilinux: $(OCI_LIB) $(OCI_SO)
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#ociwin:
|
|
|
|
#sed -e "s/VERSION_NUMBER/$(VERSION)/" -e "s/DRIVER/oracle/" def.tmpl > oracle.def
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#mysqllinux: $(MYSQL_LIB) $(MYSQL_SO)
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#mysqlwin:
|
|
|
|
#sed -e "s/VERSION_NUMBER/$(VERSION)/" -e "s/DRIVER/mysql/" def.tmpl > mysql.def
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(SQLITE_LIB): $(LS_OBJ) $(SQLITE_OBJ)
|
|
|
|
#$(AR) $@ $(LS_OBJ) $(SQLITE_OBJ)
|
|
|
|
#$(RANLIB) $@
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(SQLITE_SO): $(LS_OBJ) $(SQLITE_OBJ)
|
|
|
|
#gcc -o $@ -shared $(LS_OBJ) $(SQLITE_OBJ) $(LIBS_DIR) $(SQLITE_LIBS) $(LIBS)
|
|
|
|
#ln -f -s $@ $(SQLITE_LOADLIB)
|
2004-08-18 18:10:37 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(PG_LIB): $(LS_OBJ) $(PG_OBJ)
|
|
|
|
#$(AR) $@ $(LS_OBJ) $(PG_OBJ)
|
|
|
|
#$(RANLIB) $@
|
2004-08-18 18:10:37 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(PG_SO): $(LS_OBJ) $(PG_OBJ)
|
|
|
|
#gcc -o $@ -shared $(LS_OBJ) $(PG_OBJ) $(LIBS_DIR) $(PG_LIBS) $(LIBS)
|
|
|
|
#ln -f -s $@ $(PG_LOADLIB)
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(PG_DYLIB): $(LS_OBJ) $(PG_OBJ)
|
|
|
|
#gcc -o $@ -dynamiclib $(LS_OBJ) $(PG_OBJ) $(LIBS_DIR) $(PG_LIBS) $(LIBS)
|
|
|
|
#ln -f -s $@ $(PG_LOADLIB)
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(OCI_LIB): $(LS_OBJ) $(OCI_OBJ)
|
|
|
|
#$(AR) $@ $(LS_OBJ) $(OCI_OBJ)
|
|
|
|
#$(RANLIB) $@
|
2003-04-07 13:41:29 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(OCI_SO): $(LS_OBJ) $(OCI_OBJ)
|
|
|
|
#gcc -o $@ -shared $(LS_OBJ) $(OCI_OBJ) $(LIBS_DIR) $(OCI_LIBS) $(LIBS)
|
|
|
|
#ln -f -s $@ $(OCI_LOADLIB)
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(MYSQL_LIB): $(LS_OBJ) $(MYSQL_OBJ)
|
|
|
|
#$(AR) $@ $(LS_OBJ) $(MYSQL_OBJ)
|
|
|
|
#$(RANLIB) $@
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
#$(MYSQL_SO): $(LS_OBJ) $(MYSQL_OBJ)
|
|
|
|
#gcc -o $@ -shared $(LS_OBJ) $(MYSQL_OBJ) $(LIBS_DIR) $(MYSQL_LIBS) $(LIBS)
|
|
|
|
#ln -f -s $@ $(MYSQL_LOADLIB)
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2004-11-08 15:55:23 +00:00
|
|
|
install:
|
|
|
|
mkdir -p $(LIB_DIR)
|
|
|
|
cp $(LIBNAME) $(LOADLIB) $(LIB_DIR)
|
2003-05-26 11:28:31 +00:00
|
|
|
|
2003-04-07 13:41:29 +00:00
|
|
|
clean:
|
2004-11-08 15:55:23 +00:00
|
|
|
rm -f $(TAR_FILE) $(ZIP_FILE) $(LIBNAME) *.o *.lua
|
|
|
|
#rm -f $(TAR_FILE) $(ZIP_FILE) \
|
2004-08-18 18:10:37 +00:00
|
|
|
$(LS_OBJ) $(ODBC_OBJ) $(PG_OBJ) $(OCI_OBJ) $(MYSQL_OBJ) $(SQLITE_OBJ)\
|
|
|
|
$(ODBC_LIB) $(ODBC_DLL) $(SQLITE_LIB) $(SQLITE_SO) $(PG_LIB) $(PG_SO) $(PG_DYLIB) $(OCI_LIB) $(OCI_SO) $(MYSQL_LIB) $(MYSQL_SO) \
|
|
|
|
sqlite.lua postgres.lua odbc.lua oracle.lua mysql.lua sqlite.def postgres.def odbc.def oracle.def mysql.def
|