# ---------------------------------------------------------------------
# FreeUDFLibC - copyright (c) 1999 Gregory Deatz
# ---------------------------------------------------------------------

# ---------------------------------------------------------------------
# InterBase Installation Directory
#
# CHANGE this definition to point to your InterBase installation directory
# ---------------------------------------------------------------------
IBASE=		/usr/interbase
IB_VERSION=IB55
#IB_VERSION=IB50  (for 5.0 and lower)
#IB_VERSION=IB60 (for 6.0 and higher)

# ---------------------------------------------------------------------
# General InterBase Defines for SOLARIS
# ---------------------------------------------------------------------
GPRE=   	$(IBASE)/bin/gpre -c -n
GPRE_M=   	$(IBASE)/bin/gpre -c -n -m
ISQL=		$(IBASE)/bin/isql 

# ---------------------------------------------------------------------
# General Compiler and linker Defines for SOLARIS
# ---------------------------------------------------------------------
CC=		gcc
LINK=		gcc
LIB_LINK=	ld
CFLAGS=		-D$(IB_VERSION) -munaligned-doubles -fpic -O -c -w -I$(IBASE)/include  
LINK_FLAGS=	-lgdsmt -lsocket -lthread -lnsl -ldl
LIB_LINK_FLAGS=	-G -Bsymbolic -lgdsmt -lib_util -lm -lc
RM=		rm -f

# ---------------------------------------------------------------------
# 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 and the MD5 Test objects
# ---------------------------------------------------------------------
MD5Test_OBJs = md5c.o mddriver.o
UDF_OBJs = date_functions.o math_functions.o string_functions.o md5c.o

install: FreeUDFLibC
	@echo "------------------------------------------------------"
	@echo "You need to copy FreeUDFLib to the interbase lib "
	@echo "directory in order for the server to load it. "
	@echo "------------------------------------------------------"
	@echo "I can do this automagically for you, but you'll need"
	@echo "to type the password for root below. If you don't"
	@echo "trust me, then just bomb out of this and to install"
	@echo "type something like this (while logged in as root):"
	@echo "   cp FreeUDFLibC /usr/interbase/lib"
	@echo "------------------------------------------------------"
	@echo
	echo 'cp FreeUDFLibC ${IBASE}/lib' | su

all: FreeUDFLibC MD5Test

FreeUDFLibC: ${UDF_OBJs}
	${LIB_LINK} ${UDF_OBJs} -o $@ ${LIB_LINK_FLAGS}

MD5Test: ${MD5Test_OBJs}
	${LINK} ${MD5Test_OBJs} -o $@ ${LINK_FLAGS}

clean:
	rm -f MD5Test.exe MD5Test FreeUDFLibC *.o *~

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

md5c.o: md5.h md5_global.h

mddriver.o: md5.h global.h


