# ---------------------------------------------------------------------
# FreeAdhocUDF - copyright (c) 2004 - 2006 adhoc dataservice GmbH
# Christoph Theuring / Peter Mandrella / Georg Horn
# based on FreeUDFLibC - copyright (c) 1999 Gregory Deatz
# changes by adhoc dataservice GmbH
# ---------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# InterBase Installation Directory
#
# CHANGE this definition to point to your InterBase/FireBird installation directory
# ---------------------------------------------------------------------
# only for "make install"
#DBDIR=/opt/firebird
#DBDIR=/opt/interbase

# Location of header files and libraries
# for firebird
#INC=../firebird_1.5/include
#LIB=../firebird_1.5/lib
#INC=../firebird_2.0/include
#LIB=../firebird_2.0/lib
#CLIENTLIB=-lfbclient

# for interbase
#INC=../interbase_7.1/include
#LIB=../interbase_7.1/lib
#INC=../interbase_7.5/include
#LIB=../interbase_7.5/lib
#INC=../interbase_2007/include
#LIB=../interbase_2007/lib
#INC=../linux/include
#LIB=../linux/lib
CLIENTLIB=-lgds

#   (for 5.5 and higher)
IB_VERSION=IB55
#   (for 5.0 and lower)
#IB_VERSION=IB50
#   (for 6.0 and lower)
#IB_VERSION=IB60

# ---------------------------------------------------------------------
# Compiler and linker Defines
# ---------------------------------------------------------------------
CC=gcc
LINK=gcc
LIB_LINK=ld
#CFLAGS=-D$(IB_VERSION) -fpic -O -c -w -I$(INC)
CFLAGS=-Wall -fpic -O -c -I$(INC)
# LINK_FLAGS=-lgds -lsocket -lthread -lnsl -ldl
LIB_LINK_FLAGS=-G -Bsymbolic -L$(LIB) -lm -lc -lib_util

# ---------------------------------------------------------------------
# Generic Compilation Rules
#
# Do NOT change anything below this point.
# ---------------------------------------------------------------------
.SUFFIXES: .o .c .e

# .e.c:
# 	$(GPRE) $< -d $(DB)

.c.o:
	$(CC) $< $(CFLAGS) -o $@

.o:
	$(LINK) -o $@ $< $(LINK_FLAGS)

# ---------------------------------------------------------------------
# The UDF objects
# ---------------------------------------------------------------------
UDF_OBJs = date_functions.o math_functions.o string_functions.o blob_functions.o md5c.o sysdep.o uuid.o uuid_functions.o const_functions.o conv_functions.o

all: FreeAdhocUDF.so

FreeAdhocUDF.so: $(UDF_OBJs)
	$(LIB_LINK) $(UDF_OBJs) -o $@ $(LIB_LINK_FLAGS) $(CLIENTLIB)

clean:
	rm -f FreeAdhocUDF.so *.o *~

new:	clean all

#install:
#	cp FreeAdhocUDF.so $(DBDIR)/UDF

date_functions.o: date_functions.h global.h
math_functions.o: math_functions.h global.h
string_functions.o: string_functions.h global.h md5_global.h md5.h
blob_functions.o: blob_functions.h global.h
md5c.o: md5.h md5_global.h
sysdep.o: sysdep.h
uuid.o: sysdep.h uuid.h
uuid_functions.o: global.h sysdep.h uuid.h date_functions.h uuid_functions.h
const_functions.o: const_functions.h
conv_functions.o: conv_functions.h global.h


