# $Id: Makefile.in,v 11.62 2000/10/19 23:15:18 ubell Exp $

srcdir=	@srcdir@/..
builddir=.

##################################################
# C, C++
##################################################
CPPFLAGS=	-I$(builddir) -I$(srcdir)/include @CPPFLAGS@
CFLAGS=	 	-c $(CPPFLAGS) @CFLAGS@
CXXFLAGS=	-c $(CPPFLAGS) @CXXFLAGS@

CC=		@MAKEFILE_CC@
CCLINK=		@MAKEFILE_CCLINK@
CXX=		@MAKEFILE_CXX@

INSTALLER=	@INSTALLER@

LDFLAGS=	@LDFLAGS@
LIBDB_ARGS=	@LIBDB_ARGS@
LIBJSO_LIBS=	@LIBJSO_LIBS@
LIBS=		@LIBS@
LIBSO_LIBS=	@LIBSO_LIBS@
LIBTOOL=	@LIBTOOL@
LIBTSO_LIBS=	@LIBTSO_LIBS@
LIBXSO_LIBS=	@LIBXSO_LIBS@

POSTLINK=	@POSTLINK@
SOLINK=		@SOLINK@
SOFLAGS=	@SOFLAGS@
SOMAJOR=	@DB_VERSION_MAJOR@
SOVERSION=	@DB_VERSION_MAJOR@.@DB_VERSION_MINOR@

libdb=		libdb.a

libso_base=	libdb
libso_linkname=	$(libso_base)-$(SOVERSION).la
libso=		$(libso_base)-$(SOVERSION).@SOSUFFIX@
libso_target=	$(libso_base)-$(SOVERSION).la
libso_default=	$(libso_base).@SOSUFFIX@
libso_major=	$(libso_base)-$(SOMAJOR).@SOSUFFIX@

##################################################
# C++
#
# C++ support is optional, and it can be used with or without shared libraries.
# You must configure it using:
#	--enable-cxx
##################################################
libcxx=		libdb_cxx.a
libxso_base=	libdb_cxx
libxso=		$(libxso_base)-$(SOVERSION).@SOSUFFIX@
libxso_target=	$(libxso_base)-$(SOVERSION).la
libxso_default=	$(libxso_base).@SOSUFFIX@
libxso_major=	$(libxso_base)-$(SOMAJOR).@SOSUFFIX@

##################################################
# JAVA
#
# Java support is optional and requires shared librarires.
# You must configure it using:
#	--enable-java --enable-dynamic
##################################################
CLASSPATH=	$(JAVA_CLASSTOP)
JAVAC=		env CLASSPATH=$(CLASSPATH) @JAVAC@
JAVACFLAGS=	@JAVACFLAGS@
JAVA_BUILTFILE= ./.javabuilt
JAVA_CLASSTOP=	$(srcdir)/java/classes
JAVA_SRCDIR=	$(srcdir)/java/src
JAVA_DBDIR=	$(JAVA_SRCDIR)/com/sleepycat/db
JAVA_EXDIR=	$(JAVA_SRCDIR)/com/sleepycat/examples

libjso_base=	libdb_java
libjso=		$(libjso_base)-$(SOVERSION).@SOSUFFIX@
libjso_target=	$(libjso_base)-$(SOVERSION).la
libjso_default=	$(libjso_base).@SOSUFFIX@
libjso_major=	$(libjso_base)-$(SOMAJOR).@SOSUFFIX@
libjso_g=	$(libjso_base)-$(SOVERSION)_g.@SOSUFFIX@

##################################################
# TCL
#
# Tcl support is optional and requires shared libraries.
# You must configure it using:
#	--enable-tcl --with-tcl=DIR --enable-dynamic
##################################################
TCFLAGS=	@TCFLAGS@
libtso_base=	libdb_tcl
libtso=		$(libtso_base)-$(SOVERSION).@SOSUFFIX@
libtso_target=	$(libtso_base)-$(SOVERSION).la
libtso_default=	$(libtso_base).@SOSUFFIX@
libtso_major=	$(libtso_base)-$(SOMAJOR).@SOSUFFIX@

##################################################
# DB_DUMP185 UTILITY
#
# The db_dump185 application should be compiled using the system's db.h file
# (which should be a DB 1.85/1.86 include file), and the system's 1.85/1.86
# object library.  To include the right db.h, don't include -I$(builddir) on
# the compile line.  You may also need to add a local include directory and
# local libraries, for example.  Do that by adding -I options to the DB185INC
# line, and -l options to the DB185LIB line.
##################################################
DB185INC=	-c @CFLAGS@ -I$(srcdir)/include @CPPFLAGS@
DB185LIB=

##################################################
# INSTALLATION DIRECTORIES AND PERMISSIONS
##################################################
prefix=	@prefix@
exec_prefix=@exec_prefix@
bindir=	@bindir@
includedir=@includedir@
libdir=	@libdir@
docdir=	$(prefix)/docs

dmode=	755
emode=	555
fmode=	444

transform=@program_transform_name@

##################################################
# PATHS FOR STANDARD USER-LEVEL COMMANDS
##################################################
SHELL=	@db_cv_path_sh@
ar=	@db_cv_path_ar@ cr
chmod=	@db_cv_path_chmod@
cp=	@db_cv_path_cp@
ln=	@db_cv_path_ln@
mkdir=	@db_cv_path_mkdir@
ranlib= @db_cv_path_ranlib@
rm=	@db_cv_path_rm@
strip=	@db_cv_path_strip@

##################################################
# NOTHING BELOW THIS LINE SHOULD EVER NEED TO BE MODIFIED.
##################################################
OBJS=   @ADDITIONAL_OBJS@ @LIBOBJS@ @RPC_OBJS@ bt_compare@o@ bt_conv@o@ \
	bt_curadj@o@ bt_cursor@o@ bt_delete@o@ bt_method@o@ bt_open@o@ \
	bt_put@o@ bt_rec@o@ bt_reclaim@o@ bt_recno@o@ bt_rsearch@o@ \
	bt_search@o@ bt_split@o@ bt_stat@o@ bt_upgrade@o@ bt_verify@o@ \
	btree_auto@o@ crdel_auto@o@ crdel_rec@o@ db@o@ db_am@o@ db_auto@o@ \
	db_byteorder@o@ db_cam@o@ db_conv@o@ db_dispatch@o@ db_dup@o@ \
	db_err@o@ db_getlong@o@ db_iface@o@ db_join@o@ db_log2@o@ \
	db_meta@o@ db_method@o@ db_overflow@o@ db_pr@o@ db_rec@o@ \
	db_reclaim@o@ db_ret@o@ db_salloc@o@ db_shash@o@ db_upg@o@ \
	db_upg_opd@o@ db_vrfy@o@ db_vrfyutil@o@ dbm@o@ env_method@o@ \
	env_open@o@ env_recover@o@ env_region@o@ hash@o@ hash_auto@o@ \
	hash_conv@o@ hash_dup@o@ hash_func@o@ hash_meta@o@ hash_method@o@ \
	hash_page@o@ hash_rec@o@ hash_reclaim@o@ hash_stat@o@ hash_upgrade@o@ \
	hash_verify@o@ hsearch@o@ lock@o@ lock_conflict@o@ \
	lock_deadlock@o@ lock_method@o@ lock_region@o@ lock_stat@o@ \
	lock_util@o@ log@o@ log_archive@o@ log_auto@o@ log_compare@o@ \
	log_findckp@o@ log_get@o@ log_method@o@ log_put@o@ log_rec@o@ \
	log_register@o@ mp_alloc@o@ mp_bh@o@ mp_fget@o@ mp_fopen@o@ \
	mp_fput@o@ mp_fset@o@ mp_method@o@ mp_region@o@ mp_register@o@ \
	mp_stat@o@ mp_sync@o@ mp_trickle@o@ mutex@o@ os_abs@o@ \
	os_alloc@o@ os_dir@o@ os_errno@o@ os_fid@o@ os_finit@o@ \
	os_fsync@o@ os_handle@o@ os_map@o@ os_method@o@ os_oflags@o@ \
	os_open@o@ os_region@o@ os_rename@o@ os_root@o@ os_rpath@o@ \
	os_rw@o@ os_seek@o@ os_sleep@o@ os_spin@o@ os_stat@o@ \
	os_tmpdir@o@ os_unlink@o@ qam@o@ qam_auto@o@ qam_conv@o@ qam_files@o@ \
	qam_method@o@ qam_open@o@ qam_rec@o@ qam_stat@o@ qam_upgrade@o@ \
	qam_verify@o@ txn@o@ txn_auto@o@ txn_rec@o@ txn_region@o@ xa@o@ \
	xa_db@o@ xa_map@o@

COBJS=	cxx_app@o@ cxx_except@o@ cxx_lock@o@ cxx_log@o@ cxx_mpool@o@ \
	cxx_table@o@ cxx_txn@o@

DBSOBJS=dbs@o@ dbs_am@o@ dbs_checkpoint@o@ dbs_debug@o@ dbs_handles@o@ \
	dbs_log@o@ dbs_qam@o@ dbs_spawn@o@ dbs_trickle@o@ dbs_util@o@ \
	dbs_yield@o@

EOBJS=	ex_access@o@ ex_btrec@o@ ex_dbclient@o@ ex_env@o@ ex_lock@o@ \
	ex_mpool@o@ ex_thread@o@ ex_tpcb@o@

JOBJS=	java_Db@o@ java_DbEnv@o@ java_DbLock@o@ java_DbLsn@o@ java_DbTxn@o@ \
	java_Dbc@o@ java_Dbt@o@ java_info@o@ java_locked@o@ java_util@o@

RPC_OBJS=client@o@ db_server_clnt@o@ db_server_xdr@o@ gen_client@o@ \
	gen_client_ret@o@
RPC_SRV=db_server_proc@o@ db_server_svc@o@ db_server_util@o@ gen_db_server@o@

TOBJS=	tcl_compat@o@ tcl_db@o@ tcl_db_pkg@o@ tcl_dbcursor@o@ tcl_env@o@ \
	tcl_internal@o@ tcl_lock@o@ tcl_log@o@ tcl_mp@o@ tcl_txn@o@

UOBJS=	db_archive@o@ db_checkpoint@o@ db_deadlock@o@ db_dump185@o@ \
	db_dump@o@ db_load@o@ db_printlog@o@ db_recover@o@ db_stat@o@ \
	db_upgrade@o@ db_verify@o@ util_log@o@ util_sig@o@ 

PROGS=  @ADDITIONAL_PROGS@ db_archive db_checkpoint db_deadlock \
	db_dump db_load db_printlog db_recover db_stat db_upgrade db_verify

JAVA_DBSRCS=\
	$(JAVA_DBDIR)/Db.java $(JAVA_DBDIR)/DbAppendRecno.java \
	$(JAVA_DBDIR)/DbBtreeCompare.java \
	$(JAVA_DBDIR)/DbBtreePrefix.java $(JAVA_DBDIR)/DbBtreeStat.java \
	$(JAVA_DBDIR)/DbConstants.java $(JAVA_DBDIR)/DbDeadlockException.java \
	$(JAVA_DBDIR)/DbDupCompare.java $(JAVA_DBDIR)/DbEnv.java \
	$(JAVA_DBDIR)/DbEnvFeedback.java $(JAVA_DBDIR)/DbErrcall.java \
	$(JAVA_DBDIR)/DbException.java $(JAVA_DBDIR)/DbFeedback.java \
	$(JAVA_DBDIR)/DbHash.java $(JAVA_DBDIR)/DbHashStat.java \
	$(JAVA_DBDIR)/DbKeyRange.java $(JAVA_DBDIR)/DbLock.java \
	$(JAVA_DBDIR)/DbLockStat.java $(JAVA_DBDIR)/DbLogStat.java \
	$(JAVA_DBDIR)/DbLsn.java $(JAVA_DBDIR)/DbMemoryException.java \
	$(JAVA_DBDIR)/DbMpoolFStat.java $(JAVA_DBDIR)/DbMpoolStat.java \
	$(JAVA_DBDIR)/DbOutputStreamErrcall.java \
	$(JAVA_DBDIR)/DbQueueStat.java $(JAVA_DBDIR)/DbRecoveryInit.java \
	$(JAVA_DBDIR)/DbRunRecoveryException.java $(JAVA_DBDIR)/DbTxn.java \
	$(JAVA_DBDIR)/DbTxnRecover.java	$(JAVA_DBDIR)/DbTxnStat.java \
	$(JAVA_DBDIR)/Dbc.java $(JAVA_DBDIR)/Dbt.java

JAVA_EXSRCS=\
	$(JAVA_EXDIR)/AccessExample.java \
	$(JAVA_EXDIR)/BtRecExample.java \
	$(JAVA_EXDIR)/EnvExample.java \
	$(JAVA_EXDIR)/LockExample.java \
	$(JAVA_EXDIR)/TpcbExample.java

##################################################
# Note: Berkeley DB Makefiles are configured to build either a static or
# a dynamic library.  You should not attempt to build both library types
# in the same directory, as they have incompatible object file formats.
# To build both static and dynamic libraries, create two separate build
# directories, and configure and build them separately.
##################################################
all:	@DEFAULT_LIB@ @ADDITIONAL_LIBS@ @ADDITIONAL_LANG@ $(PROGS)

$(libdb): $(OBJS)
	$(ar) $@ $(OBJS)
	test ! -f $(ranlib) || $(ranlib) $@

$(libcxx): $(COBJS) $(OBJS)
	$(ar) $@ $(COBJS) $(OBJS)
	test ! -f $(ranlib) || $(ranlib) $@

$(libso_target): $(OBJS)
	$(SOLINK) $(SOFLAGS) -o $(libso_target) \
	    $(OBJS) $(LDFLAGS) $(LIBSO_LIBS)

$(libxso_target): $(COBJS) $(OBJS)
	$(SOLINK) $(SOFLAGS) -o $(libxso_target) \
	    $(COBJS) $(OBJS) $(LDFLAGS) $(LIBXSO_LIBS)

$(libjso_target): $(JOBJS) $(OBJS)
	$(SOLINK) $(SOFLAGS) -o $(libjso_target) \
	    $(JOBJS) $(OBJS) $(LDFLAGS) $(LIBJSO_LIBS)

$(libtso_target): $(TOBJS) $(OBJS)
	$(SOLINK) $(SOFLAGS) -o $(libtso_target) \
	    $(TOBJS) $(OBJS) $(LDFLAGS) $(LIBTSO_LIBS)

##################################################
# Creating individual dependencies and actions for building java files
# is possible, but it is very messy and error prone.
##################################################
java:	$(JAVA_CLASSTOP) $(JAVA_BUILTFILE)

$(JAVA_BUILTFILE): $(JAVA_DBSRCS) $(JAVA_EXSRCS)
	$(JAVAC) -d $(JAVA_CLASSTOP) $(JAVACFLAGS) $(JAVA_DBSRCS)
	$(JAVAC) -d $(JAVA_CLASSTOP) $(JAVACFLAGS) $(JAVA_EXSRCS)
	@echo This file helps with building java using make > $(JAVA_BUILTFILE)

$(JAVA_CLASSTOP):
	@test -f $(mkdir) || (echo 'mkdir not found.'; exit 1)
	$(mkdir) $(JAVA_CLASSTOP)

##################################################
# Utilities
##################################################
berkeley_db_svc: $(RPC_SRV) util_log@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) $(RPC_SRV) util_log@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_archive: db_archive@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_archive@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_checkpoint: db_checkpoint@o@ util_log@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_checkpoint@o@ util_log@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_deadlock: db_deadlock@o@ util_log@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_deadlock@o@ util_log@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_dump: db_dump@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) db_dump@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_dump185: db_dump185@o@ @LIBOBJS@
	$(CCLINK) -o $@ $(LDFLAGS) db_dump185@o@ @LIBOBJS@ $(DB185LIB)
	$(POSTLINK) $@

db_load: db_load@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) db_load@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_printlog: db_printlog@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_printlog@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_recover: db_recover@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_recover@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_stat: db_stat@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) db_stat@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_upgrade: db_upgrade@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_upgrade@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

db_verify: db_verify@o@ util_sig@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) \
	    db_verify@o@ util_sig@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

##################################################
# Example programs
##################################################
ex_access: ex_access@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_access@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_btrec: ex_btrec@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_btrec@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_dbclient: ex_dbclient@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_dbclient@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_env: ex_env@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_env@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_lock: ex_lock@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_lock@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_mpool: ex_mpool@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_mpool@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_thread: ex_thread@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_thread@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

ex_tpcb: ex_tpcb@o@ @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) ex_tpcb@o@ $(LIBDB_ARGS) $(LIBS)
	$(POSTLINK) $@

##################################################
# Multi-threaded tester.
##################################################
dbs: $(DBSOBJS) @DEFAULT_LIB@
	$(CCLINK) -o $@ $(LDFLAGS) $(DBSOBJS) $(LIBDB_ARGS) @DBS_LIBS@ $(LIBS)
	$(POSTLINK) $@

##################################################
# Standard Makefile targets.
##################################################
RMLIST= berkeley_db_svc db_dump185 dbs ex_access ex_btrec ex_dbclient \
	ex_env ex_lock ex_mpool ex_thread ex_tpcb
clean:
	$(rm) -f $(OBJS)
	$(rm) -f $(COBJS) $(DBSOBJS) $(EOBJS) $(CEOBJS) $(JOBJS)
	$(rm) -f $(TOBJS) $(UOBJS) $(RPC_OBJS) $(RPC_SRV)
	$(rm) -f $(PROGS) $(RMLIST)
	$(rm) -f *@o@ *.o *.lo core *.core
	$(rm) -rf ALL.OUT TESTDIR
	$(rm) -rf .libs $(libdb) $(libcxx) $(libso) $(libso_target)
	$(rm) -rf $(libxso) $(libxso_target) $(libjso) $(libjso_target)
	$(rm) -rf $(libtso) $(libtso_target)

depend obj:

realclean distclean: clean
	$(rm) -f Makefile config.cache config.log config.status db_config.h
	$(rm) -f confdefs.h db.h db_int.h db_185.h include.tcl libtool

install: all install_include @DEFAULT_INSTALL@ install_utilities install_docs

install_setup:
	@test -f $(chmod) || (echo 'chmod not found.'; exit 1)
	@test -f $(cp) || (echo 'cp not found.'; exit 1)
	@test -f $(mkdir) || (echo 'mkdir not found.'; exit 1)
	@test -f $(rm) || (echo 'rm not found.'; exit 1)

install_include:
	@echo "Installing DB include files: $(includedir) ..."
	@test -d $(includedir) || \
	    ($(mkdir) -p $(includedir) && $(chmod) $(dmode) $(includedir))
	@cd $(includedir) && $(rm) -f db.h db_185.h db_cxx.h
	@$(cp) -p db.h db_185.h $(srcdir)/include/db_cxx.h $(includedir)
	@cd $(includedir) && $(chmod) $(fmode) db.h db_185.h db_cxx.h

install_static: install_setup
	@echo "Installing DB library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && $(rm) -f $(libdb)
	@$(cp) -p $(libdb) $(libdir)
	@cd $(libdir) && $(chmod) $(fmode) $(libdb)

install_static_cxx: install_setup
	@echo "Installing DB C++ static library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && $(rm) -f $(libcxx)
	@$(cp) -p $(libcxx) $(libdir)
	@cd $(libdir) && $(chmod) $(fmode) $(libcxx)

install_dynamic: install_setup
	@echo "Installing DB library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && \
	    $(rm) -f $(libso) $(libso_default) $(libso_major)
	@$(INSTALLER) $(libso_target) $(libdir)
	@cd $(libdir) && $(ln) -s $(libso) $(libso_default)
	@cd $(libdir) && $(ln) -s $(libso) $(libso_major)
	@$(LIBTOOL) --mode=finish $(libdir)

install_dynamic_cxx: install_setup
	@echo "Installing DB C++ library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && \
	    $(rm) -f $(libxso) $(libxso_default) $(libxso_major)
	@$(INSTALLER) $(libxso_target) $(libdir)
	@cd $(libdir) && $(ln) -s $(libxso) $(libxso_default)
	@cd $(libdir) && $(ln) -s $(libxso) $(libxso_major)

install_tcl: install_setup
	@echo "Installing DB Tcl library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && \
	    $(rm) -f $(libtso) $(libtso_default) $(libtso_major)
	@$(INSTALLER) $(libtso_target) $(libdir)
	@cd $(libdir) && $(ln) -s $(libtso) $(libtso_default)
	@cd $(libdir) && $(ln) -s $(libtso) $(libtso_major)

install_java: install_setup
	@echo "Installing DB Java library: $(libdir) ..."
	@test -d $(libdir) || \
	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
	@cd $(libdir) && \
	    $(rm) -f $(libjso) $(libjso_default) $(libjso_major)
	@$(INSTALLER) $(libjso_target) $(libdir)
	@cd $(libdir) && $(ln) -s $(libjso) $(libjso_default)
	@cd $(libdir) && $(ln) -s $(libjso) $(libjso_major)
	@cd $(libdir) && $(ln) -s $(libjso) $(libjso_g)

install_docs: install_setup
	@echo "Installing documentation: $(docdir) ..."
	@test -d $(docdir) || \
	    ($(mkdir) -p $(docdir) && $(chmod) $(dmode) $(docdir))
	@cd $(docdir) && $(rm) -rf *
	@cd $(srcdir)/docs && $(cp) -pr * $(docdir)/

install_utilities: install_setup
	@echo "Installing DB utilities: $(bindir) ..."
	@test -d $(bindir) || \
	    ($(mkdir) -p $(bindir) && $(chmod) $(dmode) $(bindir))
	@cd $(bindir) && $(rm) -f $(PROGS)
	@$(INSTALLER) -fp $(PROGS) $(bindir)
	@cd $(bindir) && (test ! -f $(strip) || $(strip) $(PROGS))
	@cd $(bindir) && $(chmod) $(emode) $(PROGS)

uninstall:
	-cd $(bindir) && $(rm) -f $(PROGS)
	-cd $(includedir) && $(rm) -f db.h db_185.h db_cxx.h
	-cd $(libdir) && $(rm) -f $(libdb) $(libcxx) $(libso_target) $(libso) \
	    $(libjso) $(libjso_target) $(libtso) $(libtso_target)
	-cd $(docdir) && $(rm) -rf *

##################################################
# Object build rules.
##################################################
# Utilities
db_archive@o@: $(srcdir)/db_archive/db_archive.c
	$(CC) $(CFLAGS) $?
db_checkpoint@o@: $(srcdir)/db_checkpoint/db_checkpoint.c
	$(CC) $(CFLAGS) $?
db_deadlock@o@: $(srcdir)/db_deadlock/db_deadlock.c
	$(CC) $(CFLAGS) $?
db_dump@o@: $(srcdir)/db_dump/db_dump.c
	$(CC) $(CFLAGS) $?
db_dump185@o@: $(srcdir)/db_dump185/db_dump185.c
	$(CC) $(DB185INC) $?
db_load@o@: $(srcdir)/db_load/db_load.c
	$(CC) $(CFLAGS) $?
db_printlog@o@: $(srcdir)/db_printlog/db_printlog.c
	$(CC) $(CFLAGS) $?
db_recover@o@: $(srcdir)/db_recover/db_recover.c
	$(CC) $(CFLAGS) $?
db_stat@o@: $(srcdir)/db_stat/db_stat.c
	$(CC) $(CFLAGS) $?
db_upgrade@o@: $(srcdir)/db_upgrade/db_upgrade.c
	$(CC) $(CFLAGS) $?
db_verify@o@: $(srcdir)/db_verify/db_verify.c
	$(CC) $(CFLAGS) $?

# Examples
ex_access@o@: $(srcdir)/examples_c/ex_access.c
	$(CC) $(CFLAGS) $?
ex_btrec@o@: $(srcdir)/examples_c/ex_btrec.c
	$(CC) $(CFLAGS) $?
ex_dbclient@o@: $(srcdir)/examples_c/ex_dbclient.c
	$(CC) $(CFLAGS) $?
ex_env@o@: $(srcdir)/examples_c/ex_env.c
	$(CC) $(CFLAGS) $?
ex_lock@o@: $(srcdir)/examples_c/ex_lock.c
	$(CC) $(CFLAGS) $?
ex_mpool@o@: $(srcdir)/examples_c/ex_mpool.c
	$(CC) $(CFLAGS) $?
ex_thread@o@: $(srcdir)/examples_c/ex_thread.c
	$(CC) $(CFLAGS) $?
ex_tpcb@o@: $(srcdir)/examples_c/ex_tpcb.c
	$(CC) $(CFLAGS) $?

# DB files
crdel_auto@o@: $(srcdir)/db/crdel_auto.c
	$(CC) $(CFLAGS) $?
crdel_rec@o@: $(srcdir)/db/crdel_rec.c
	$(CC) $(CFLAGS) $?
db@o@: $(srcdir)/db/db.c
	$(CC) $(CFLAGS) $?
db_am@o@: $(srcdir)/db/db_am.c
	$(CC) $(CFLAGS) $?
db_auto@o@: $(srcdir)/db/db_auto.c
	$(CC) $(CFLAGS) $?
db_cam@o@: $(srcdir)/db/db_cam.c
	$(CC) $(CFLAGS) $?
db_conv@o@: $(srcdir)/db/db_conv.c
	$(CC) $(CFLAGS) $?
db_dispatch@o@: $(srcdir)/db/db_dispatch.c
	$(CC) $(CFLAGS) $?
db_dup@o@: $(srcdir)/db/db_dup.c
	$(CC) $(CFLAGS) $?
db_iface@o@: $(srcdir)/db/db_iface.c
	$(CC) $(CFLAGS) $?
db_join@o@: $(srcdir)/db/db_join.c
	$(CC) $(CFLAGS) $?
db_meta@o@: $(srcdir)/db/db_meta.c
	$(CC) $(CFLAGS) $?
db_method@o@: $(srcdir)/db/db_method.c
	$(CC) $(CFLAGS) $?
db_overflow@o@: $(srcdir)/db/db_overflow.c
	$(CC) $(CFLAGS) $?
db_pr@o@: $(srcdir)/db/db_pr.c
	$(CC) $(CFLAGS) $?
db_rec@o@: $(srcdir)/db/db_rec.c
	$(CC) $(CFLAGS) $?
db_reclaim@o@: $(srcdir)/db/db_reclaim.c
	$(CC) $(CFLAGS) $?
db_ret@o@: $(srcdir)/db/db_ret.c
	$(CC) $(CFLAGS) $?
db_upg@o@: $(srcdir)/db/db_upg.c
	$(CC) $(CFLAGS) $?
db_upg_opd@o@: $(srcdir)/db/db_upg_opd.c
	$(CC) $(CFLAGS) $?
db_vrfy@o@: $(srcdir)/db/db_vrfy.c
	$(CC) $(CFLAGS) $?
db_vrfyutil@o@: $(srcdir)/db/db_vrfyutil.c
	$(CC) $(CFLAGS) $?

# Environment files
db_salloc@o@: $(srcdir)/env/db_salloc.c
	$(CC) $(CFLAGS) $?
db_shash@o@: $(srcdir)/env/db_shash.c
	$(CC) $(CFLAGS) $?
env_method@o@: $(srcdir)/env/env_method.c
	$(CC) $(CFLAGS) $?
env_open@o@: $(srcdir)/env/env_open.c
	$(CC) $(CFLAGS) $?
env_recover@o@: $(srcdir)/env/env_recover.c
	$(CC) $(CFLAGS) $?
env_region@o@: $(srcdir)/env/env_region.c
	$(CC) $(CFLAGS) $?

# Common files
db_byteorder@o@: $(srcdir)/common/db_byteorder.c
	$(CC) $(CFLAGS) $?
db_err@o@: $(srcdir)/common/db_err.c
	$(CC) $(CFLAGS) $?
db_getlong@o@: $(srcdir)/common/db_getlong.c
	$(CC) $(CFLAGS) $?
db_log2@o@: $(srcdir)/common/db_log2.c
	$(CC) $(CFLAGS) $?
util_log@o@: $(srcdir)/common/util_log.c
	$(CC) $(CFLAGS) $?
util_sig@o@: $(srcdir)/common/util_sig.c
	$(CC) $(CFLAGS) $?

# Btree files
bt_compare@o@: $(srcdir)/btree/bt_compare.c
	$(CC) $(CFLAGS) $?
bt_conv@o@: $(srcdir)/btree/bt_conv.c
	$(CC) $(CFLAGS) $?
bt_curadj@o@: $(srcdir)/btree/bt_curadj.c
	$(CC) $(CFLAGS) $?
bt_cursor@o@: $(srcdir)/btree/bt_cursor.c
	$(CC) $(CFLAGS) $?
bt_delete@o@: $(srcdir)/btree/bt_delete.c
	$(CC) $(CFLAGS) $?
bt_method@o@: $(srcdir)/btree/bt_method.c
	$(CC) $(CFLAGS) $?
bt_open@o@: $(srcdir)/btree/bt_open.c
	$(CC) $(CFLAGS) $?
bt_put@o@: $(srcdir)/btree/bt_put.c
	$(CC) $(CFLAGS) $?
bt_rec@o@: $(srcdir)/btree/bt_rec.c
	$(CC) $(CFLAGS) $?
bt_reclaim@o@: $(srcdir)/btree/bt_reclaim.c
	$(CC) $(CFLAGS) $?
bt_recno@o@: $(srcdir)/btree/bt_recno.c
	$(CC) $(CFLAGS) $?
bt_rsearch@o@: $(srcdir)/btree/bt_rsearch.c
	$(CC) $(CFLAGS) $?
bt_search@o@: $(srcdir)/btree/bt_search.c
	$(CC) $(CFLAGS) $?
bt_split@o@: $(srcdir)/btree/bt_split.c
	$(CC) $(CFLAGS) $?
bt_stack@o@: $(srcdir)/btree/bt_stack.c
	$(CC) $(CFLAGS) $?
bt_stat@o@: $(srcdir)/btree/bt_stat.c
	$(CC) $(CFLAGS) $?
bt_upgrade@o@: $(srcdir)/btree/bt_upgrade.c
	$(CC) $(CFLAGS) $?
bt_verify@o@: $(srcdir)/btree/bt_verify.c
	$(CC) $(CFLAGS) $?
btree_auto@o@: $(srcdir)/btree/btree_auto.c
	$(CC) $(CFLAGS) $?

# Queue files
qam@o@: $(srcdir)/qam/qam.c
	$(CC) $(CFLAGS) $?
qam_auto@o@: $(srcdir)/qam/qam_auto.c
	$(CC) $(CFLAGS) $?
qam_conv@o@: $(srcdir)/qam/qam_conv.c
	$(CC) $(CFLAGS) $?
qam_files@o@: $(srcdir)/qam/qam_files.c
	$(CC) $(CFLAGS) $?
qam_method@o@: $(srcdir)/qam/qam_method.c
	$(CC) $(CFLAGS) $?
qam_open@o@: $(srcdir)/qam/qam_open.c
	$(CC) $(CFLAGS) $?
qam_rec@o@: $(srcdir)/qam/qam_rec.c
	$(CC) $(CFLAGS) $?
qam_stat@o@: $(srcdir)/qam/qam_stat.c
	$(CC) $(CFLAGS) $?
qam_upgrade@o@: $(srcdir)/qam/qam_upgrade.c
	$(CC) $(CFLAGS) $?
qam_verify@o@: $(srcdir)/qam/qam_verify.c
	$(CC) $(CFLAGS) $?

# C++ files
cxx_app@o@: $(srcdir)/cxx/cxx_app.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_except@o@: $(srcdir)/cxx/cxx_except.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_lock@o@: $(srcdir)/cxx/cxx_lock.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_log@o@: $(srcdir)/cxx/cxx_log.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_mpool@o@: $(srcdir)/cxx/cxx_mpool.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_table@o@: $(srcdir)/cxx/cxx_table.cpp
	$(CXX) $(CXXFLAGS) $?
cxx_txn@o@: $(srcdir)/cxx/cxx_txn.cpp
	$(CXX) $(CXXFLAGS) $?

# Java files
java_Db@o@::$(srcdir)/libdb_java/java_Db.c
	$(CC) $(CFLAGS) $?
java_DbEnv@o@: $(srcdir)/libdb_java/java_DbEnv.c
	$(CC) $(CFLAGS) $?
java_DbLock@o@: $(srcdir)/libdb_java/java_DbLock.c
	$(CC) $(CFLAGS) $?
java_DbLsn@o@: $(srcdir)/libdb_java/java_DbLsn.c
	$(CC) $(CFLAGS) $?
java_DbTxn@o@: $(srcdir)/libdb_java/java_DbTxn.c
	$(CC) $(CFLAGS) $?
java_Dbc@o@: $(srcdir)/libdb_java/java_Dbc.c
	$(CC) $(CFLAGS) $?
java_Dbt@o@: $(srcdir)/libdb_java/java_Dbt.c
	$(CC) $(CFLAGS) $?
java_info@o@: $(srcdir)/libdb_java/java_info.c
	$(CC) $(CFLAGS) $?
java_locked@o@: $(srcdir)/libdb_java/java_locked.c
	$(CC) $(CFLAGS) $?
java_util@o@: $(srcdir)/libdb_java/java_util.c
	$(CC) $(CFLAGS) $?

# Tcl files
tcl_compat@o@: $(srcdir)/tcl/tcl_compat.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_db@o@: $(srcdir)/tcl/tcl_db.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_db_pkg@o@: $(srcdir)/tcl/tcl_db_pkg.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_dbcursor@o@: $(srcdir)/tcl/tcl_dbcursor.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_env@o@: $(srcdir)/tcl/tcl_env.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_internal@o@: $(srcdir)/tcl/tcl_internal.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_lock@o@: $(srcdir)/tcl/tcl_lock.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_log@o@: $(srcdir)/tcl/tcl_log.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_mp@o@: $(srcdir)/tcl/tcl_mp.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?
tcl_txn@o@: $(srcdir)/tcl/tcl_txn.c
	$(CC) $(CFLAGS) $(TCFLAGS) $?

# Hash files
hash_auto@o@: $(srcdir)/hash/hash_auto.c
	$(CC) $(CFLAGS) $?
hash@o@: $(srcdir)/hash/hash.c
	$(CC) $(CFLAGS) $?
hash_conv@o@: $(srcdir)/hash/hash_conv.c
	$(CC) $(CFLAGS) $?
hash_dup@o@: $(srcdir)/hash/hash_dup.c
	$(CC) $(CFLAGS) $?
hash_func@o@: $(srcdir)/hash/hash_func.c
	$(CC) $(CFLAGS) $?
hash_meta@o@: $(srcdir)/hash/hash_meta.c
	$(CC) $(CFLAGS) $?
hash_method@o@: $(srcdir)/hash/hash_method.c
	$(CC) $(CFLAGS) $?
hash_page@o@: $(srcdir)/hash/hash_page.c
	$(CC) $(CFLAGS) $?
hash_rec@o@: $(srcdir)/hash/hash_rec.c
	$(CC) $(CFLAGS) $?
hash_reclaim@o@: $(srcdir)/hash/hash_reclaim.c
	$(CC) $(CFLAGS) $?
hash_stat@o@: $(srcdir)/hash/hash_stat.c
	$(CC) $(CFLAGS) $?
hash_upgrade@o@: $(srcdir)/hash/hash_upgrade.c
	$(CC) $(CFLAGS) $?
hash_verify@o@: $(srcdir)/hash/hash_verify.c
	$(CC) $(CFLAGS) $?

# Lock files
lock@o@: $(srcdir)/lock/lock.c
	$(CC) $(CFLAGS) $?
lock_conflict@o@:$(srcdir)/lock/lock_conflict.c
	$(CC) $(CFLAGS) $?
lock_deadlock@o@:$(srcdir)/lock/lock_deadlock.c
	$(CC) $(CFLAGS) $?
lock_method@o@:$(srcdir)/lock/lock_method.c
	$(CC) $(CFLAGS) $?
lock_region@o@:$(srcdir)/lock/lock_region.c
	$(CC) $(CFLAGS) $?
lock_stat@o@:$(srcdir)/lock/lock_stat.c
	$(CC) $(CFLAGS) $?
lock_util@o@:$(srcdir)/lock/lock_util.c
	$(CC) $(CFLAGS) $?

# Log files
log@o@: $(srcdir)/log/log.c
	$(CC) $(CFLAGS) $?
log_archive@o@: $(srcdir)/log/log_archive.c
	$(CC) $(CFLAGS) $?
log_auto@o@: $(srcdir)/log/log_auto.c
	$(CC) $(CFLAGS) $?
log_compare@o@: $(srcdir)/log/log_compare.c
	$(CC) $(CFLAGS) $?
log_findckp@o@: $(srcdir)/log/log_findckp.c
	$(CC) $(CFLAGS) $?
log_get@o@: $(srcdir)/log/log_get.c
	$(CC) $(CFLAGS) $?
log_method@o@: $(srcdir)/log/log_method.c
	$(CC) $(CFLAGS) $?
log_put@o@: $(srcdir)/log/log_put.c
	$(CC) $(CFLAGS) $?
log_rec@o@: $(srcdir)/log/log_rec.c
	$(CC) $(CFLAGS) $?
log_register@o@: $(srcdir)/log/log_register.c
	$(CC) $(CFLAGS) $?

# Mpool files
mp_alloc@o@: $(srcdir)/mp/mp_alloc.c
	$(CC) $(CFLAGS) $?
mp_bh@o@: $(srcdir)/mp/mp_bh.c
	$(CC) $(CFLAGS) $?
mp_fget@o@: $(srcdir)/mp/mp_fget.c
	$(CC) $(CFLAGS) $?
mp_fopen@o@: $(srcdir)/mp/mp_fopen.c
	$(CC) $(CFLAGS) $?
mp_fput@o@: $(srcdir)/mp/mp_fput.c
	$(CC) $(CFLAGS) $?
mp_fset@o@: $(srcdir)/mp/mp_fset.c
	$(CC) $(CFLAGS) $?
mp_method@o@: $(srcdir)/mp/mp_method.c
	$(CC) $(CFLAGS) $?
mp_region@o@: $(srcdir)/mp/mp_region.c
	$(CC) $(CFLAGS) $?
mp_register@o@: $(srcdir)/mp/mp_register.c
	$(CC) $(CFLAGS) $?
mp_stat@o@: $(srcdir)/mp/mp_stat.c
	$(CC) $(CFLAGS) $?
mp_sync@o@: $(srcdir)/mp/mp_sync.c
	$(CC) $(CFLAGS) $?
mp_trickle@o@: $(srcdir)/mp/mp_trickle.c
	$(CC) $(CFLAGS) $?

# Mutex files
mutex@o@: $(srcdir)/mutex/mutex.c
	$(CC) $(CFLAGS) $?
mut_fcntl@o@: $(srcdir)/mutex/mut_fcntl.c
	$(CC) $(CFLAGS) $?
mut_pthread@o@: $(srcdir)/mutex/mut_pthread.c
	$(CC) $(CFLAGS) $?
mut_tas@o@: $(srcdir)/mutex/mut_tas.c
	$(CC) $(CFLAGS) $?
# UTS4 spinlock assembly.
uts4_cc@o@: $(srcdir)/mutex/uts4_cc.s
	$(AS) $(ASFLAGS) -o $@ $?

# Transaction files
txn@o@: $(srcdir)/txn/txn.c
	$(CC) $(CFLAGS) $?
txn_auto@o@: $(srcdir)/txn/txn_auto.c
	$(CC) $(CFLAGS) $?
txn_rec@o@: $(srcdir)/txn/txn_rec.c
	$(CC) $(CFLAGS) $?
txn_region@o@: $(srcdir)/txn/txn_region.c
	$(CC) $(CFLAGS) $?

# XA files
xa@o@: $(srcdir)/xa/xa.c
	$(CC) $(CFLAGS) $?
xa_db@o@: $(srcdir)/xa/xa_db.c
	$(CC) $(CFLAGS) $?
xa_map@o@: $(srcdir)/xa/xa_map.c
	$(CC) $(CFLAGS) $?

# RPC client files
client@o@: $(srcdir)/rpc_client/client.c
	$(CC) $(CFLAGS) $?
db_server_clnt@o@: $(srcdir)/rpc_client/db_server_clnt.c
	$(CC) $(CFLAGS) $?
gen_client@o@: $(srcdir)/rpc_client/gen_client.c
	$(CC) $(CFLAGS) $?
gen_client_ret@o@: $(srcdir)/rpc_client/gen_client_ret.c
	$(CC) $(CFLAGS) $?

# RPC server files
db_server_proc@o@: $(srcdir)/rpc_server/db_server_proc.c
	$(CC) $(CFLAGS) $?
db_server_svc@o@: $(srcdir)/rpc_server/db_server_svc.c
	$(CC) $(CFLAGS) $?
db_server_util@o@: $(srcdir)/rpc_server/db_server_util.c
	$(CC) $(CFLAGS) $?
db_server_xdr@o@: $(srcdir)/rpc_server/db_server_xdr.c
	$(CC) $(CFLAGS) $?
gen_db_server@o@: $(srcdir)/rpc_server/gen_db_server.c
	$(CC) $(CFLAGS) $?

# Historic compatibility files
db185@o@: $(srcdir)/db185/db185.c
	$(CC) $(CFLAGS) $?
dbm@o@: $(srcdir)/dbm/dbm.c
	$(CC) $(CFLAGS) $?
hsearch@o@: $(srcdir)/hsearch/hsearch.c
	$(CC) $(CFLAGS) $?

# OS specific files
os_abs@o@: $(srcdir)/os/os_abs.c
	$(CC) $(CFLAGS) $?
os_alloc@o@: $(srcdir)/os/os_alloc.c
	$(CC) $(CFLAGS) $?
os_dir@o@: $(srcdir)/os/os_dir.c
	$(CC) $(CFLAGS) $?
os_errno@o@: $(srcdir)/os/os_errno.c
	$(CC) $(CFLAGS) $?
os_fid@o@: $(srcdir)/os/os_fid.c
	$(CC) $(CFLAGS) $?
os_finit@o@: $(srcdir)/os/os_finit.c
	$(CC) $(CFLAGS) $?
os_fsync@o@: $(srcdir)/os/os_fsync.c
	$(CC) $(CFLAGS) $?
os_handle@o@: $(srcdir)/os/os_handle.c
	$(CC) $(CFLAGS) $?
os_map@o@: $(srcdir)/os/os_map.c
	$(CC) $(CFLAGS) $?
os_method@o@: $(srcdir)/os/os_method.c
	$(CC) $(CFLAGS) $?
os_oflags@o@: $(srcdir)/os/os_oflags.c
	$(CC) $(CFLAGS) $?
os_open@o@: $(srcdir)/os/os_open.c
	$(CC) $(CFLAGS) $?
os_region@o@: $(srcdir)/os/os_region.c
	$(CC) $(CFLAGS) $?
os_rename@o@: $(srcdir)/os/os_rename.c
	$(CC) $(CFLAGS) $?
os_root@o@: $(srcdir)/os/os_root.c
	$(CC) $(CFLAGS) $?
os_rpath@o@: $(srcdir)/os/os_rpath.c
	$(CC) $(CFLAGS) $?
os_rw@o@: $(srcdir)/os/os_rw.c
	$(CC) $(CFLAGS) $?
os_seek@o@: $(srcdir)/os/os_seek.c
	$(CC) $(CFLAGS) $?
os_sleep@o@: $(srcdir)/os/os_sleep.c
	$(CC) $(CFLAGS) $?
os_spin@o@: $(srcdir)/os/os_spin.c
	$(CC) $(CFLAGS) $?
os_stat@o@: $(srcdir)/os/os_stat.c
	$(CC) $(CFLAGS) $?
os_tmpdir@o@: $(srcdir)/os/os_tmpdir.c
	$(CC) $(CFLAGS) $?
os_unlink@o@: $(srcdir)/os/os_unlink.c
	$(CC) $(CFLAGS) $?

# Dbs.
dbs@o@: $(srcdir)/test_server/dbs.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_am@o@: $(srcdir)/test_server/dbs_am.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_checkpoint@o@: $(srcdir)/test_server/dbs_checkpoint.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_debug@o@: $(srcdir)/test_server/dbs_debug.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_handles@o@: $(srcdir)/test_server/dbs_handles.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_log@o@: $(srcdir)/test_server/dbs_log.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_qam@o@: $(srcdir)/test_server/dbs_qam.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_spawn@o@: $(srcdir)/test_server/dbs_spawn.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_trickle@o@: $(srcdir)/test_server/dbs_trickle.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_util@o@: $(srcdir)/test_server/dbs_util.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?
dbs_yield@o@: $(srcdir)/test_server/dbs_yield.c
	$(CC) $(CFLAGS) -I$(srcdir)/test_server $?

# Replacement files
getcwd@o@: $(srcdir)/clib/getcwd.c
	$(CC) $(CFLAGS) $?
getopt@o@: $(srcdir)/clib/getopt.c
	$(CC) $(CFLAGS) $?
memcmp@o@: $(srcdir)/clib/memcmp.c
	$(CC) $(CFLAGS) $?
memcpy@o@: $(srcdir)/clib/memmove.c
	$(CC) -DMEMCOPY $(CFLAGS) $? -o $@
memmove@o@: $(srcdir)/clib/memmove.c
	$(CC) -DMEMMOVE $(CFLAGS) $?
raise@o@: $(srcdir)/clib/raise.c
	$(CC) $(CFLAGS) $?
strcasecmp@o@: $(srcdir)/clib/strcasecmp.c
	$(CC) $(CFLAGS) $?
snprintf@o@: $(srcdir)/clib/snprintf.c
	$(CC) $(CFLAGS) $?
strerror@o@: $(srcdir)/clib/strerror.c
	$(CC) $(CFLAGS) $?
vsnprintf@o@: $(srcdir)/clib/vsnprintf.c
	$(CC) $(CFLAGS) $?
