--- makefile.orig	Tue Dec 10 00:22:22 2002
+++ makefile	Tue Jan 14 18:57:13 2003
@@ -32,8 +32,8 @@
 SUFF=
 else
 ifneq (,$(findstring freebsd,$(OSTYPE)))
-TFLAGS=-pthread
-THRLIBS=
+TFLAGS=-D_REENTRANT ${PTHREAD_CFLAGS}
+THRLIBS=${PTHREAD_LIBS}
 else 
 TFLAGS=-D_REENTRANT -D_THREAD_SAFE
 THRLIBS=-lpthread
@@ -65,7 +65,7 @@
 
 WEB_EXAMPLES = cgistub bugdb clidb
 
-CC = g++
+CC = ${CXX}
 
 # Possible FastDB compile time parameters (-Dxxx should be added to DEFS macro):
 # 1. USE_LOCALE_SETTINGS - use C locale for string comparison operations
@@ -101,13 +101,13 @@
 DEFS = -DUSE_QUEUE_MANAGER -DUSE_LOCALE_SETTINGS
 
 #CFLAGS = $(TFLAGS) -c -Wall -O5 -g $(DEFS) 
-CFLAGS = -c -Wall -O0 -g $(DEFS) $(TFLAGS)
+CFLAGS = -c ${CXXFLAGS} $(DEFS) $(TFLAGS)
 #CFLAGS = -c -Wall -O0 -DFASTDB_DEBUG=DEBUG_TRACE -g $(DEFS) $(TFLAGS)
-SHFLAGS=-shared
+SHFLAGS=-shared -Wl,-soname,$@
 
 
 LD = $(CC)
-LDFLAGS = -g $(TFLAGS)
+LDFLAGS = $(TFLAGS)
 
 AR = ar
 ARFLAGS = -cru
@@ -326,14 +326,13 @@
 
 install: subsql installlib
 	mkdir -p $(BINSPATH)
-	cp subsql $(BINSPATH)
-	strip $(BINSPATH)/subsql
+	${BSD_INSTALL_PROGRAM} subsql $(BINSPATH)
 
 installlib: $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED)
 	mkdir -p $(INCSPATH)
-	cp $(INCS) $(INCSPATH)
+	${BSD_INSTALL_DATA} $(INCS) $(INCSPATH)
 	mkdir -p $(LIBSPATH)
-	cp $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED) $(LIBSPATH)
+	${BSD_INSTALL_PROGRAM} $(FASTDB_LIB) $(CLI_LIB) $(FASTDB_SHARED) $(CLI_SHARED) $(LIBSPATH)
 	cd $(LIBSPATH); ln -f -s $(FASTDB_SHARED) libfastdb$(SUFF).so
 	cd $(LIBSPATH); ln -f -s $(CLI_SHARED) libcli$(SUFF).so
 
