# Makefile for Tkrzw

#================================================================
# Setting Variables
#================================================================

# Generic settings
SHELL := @SHELL@

# Package information
PACKAGE := @PACKAGE_NAME@
PACKAGE_TARNAME := @PACKAGE_TARNAME@
VERSION := @PACKAGE_VERSION@
PACKAGEDIR := $(PACKAGE)-$(VERSION)
PACKAGETGZ := $(PACKAGE)-$(VERSION).tar.gz
LIBVER := @MYLIBVER@
LIBREV := @MYLIBREV@
LIBFMT := @MYLIBFMT@

# Targets
VPATH := .:..
HEADERFILES := @MYHEADERFILES@
LIBRARYFILES := @MYLIBRARYFILES@
LIBOBJFILES := @MYLIBOBJFILES@
COMMANDFILES := @MYCOMMANDFILES@
TESTFILES := @MYTESTFILES@
PCFILES := @MYPCFILES@

# Install destinations
prefix := @prefix@
exec_prefix := @exec_prefix@
datarootdir := @datarootdir@
INCLUDEDIR := @includedir@
LIBDIR := @libdir@
BINDIR := @bindir@
LIBEXECDIR := @libexecdir@
PCDIR := @libdir@/pkgconfig
DESTDIR :=

# Building configuration
CC := @CC@
CXX := @CXX@
CPPFLAGS := @MYCPPFLAGS@ \
  -D_TKRZW_PREFIX="\"$(prefix)\"" -D_TKRZW_INCLUDEDIR="\"$(INCLUDEDIR)\"" \
  -D_TKRZW_LIBDIR="\"$(LIBDIR)\"" -D_TKRZW_BINDIR="\"$(BINDIR)\"" \
  -D_TKRZW_LIBEXECDIR="\"$(LIBEXECDIR)\"" \
  -D_TKRZW_APPINC="\"-I$(INCLUDEDIR)\"" -D_TKRZW_APPLIBS="\"-L$(LIBDIR) @MYCMDLIBS@ @LIBS@\"" \
  -D_TKRZW_PKG_VERSION="\"$(VERSION)\"" -D_TKRZW_LIB_VERSION="\"$(LIBVER).$(LIBREV).$(LIBFMT)\""
CFLAGS := @MYCFLAGS@
CXXFLAGS := @MYCXXFLAGS@
LDSOFLAGS := @MYLDSOFLAGS@
LDFLAGS := @MYLDFLAGS@
CMDLDFLAGS := @MYCMDLDFLAGS@
CMDLIBS := @MYCMDLIBS@
TESTLIBS := @MYTESTLIBS@
LIBS := @LIBS@
RUNENV := @MYLDLIBPATHENV@=@MYLDLIBPATH@:.
VPATH := .:..
FILEPERFDIRECTIOFLAGS=@MYFILEPERFDIRECTIOFLAGS@
DBMPERFDIRECTIOFLAGS=@MYDBMPERFDIRECTIOFLAGS@
DBMPERFRECCOMPFLAGS=@MYDBMPERFRECCOMPFLAGS@
DBMTRANRECCOMPPARAMS=@MYDBMTRANRECCOMPPARAMS@
POSTCMD := @MYPOSTCMD@

#================================================================
# Actions
#================================================================

all : $(LIBRARYFILES) $(COMMANDFILES)
	@$(POSTCMD)
	@printf '\n'
	@printf '#================================================================\n'
	@printf '# Ready to install.\n'
	@printf '#================================================================\n'

clean :
	rm -f $(LIBRARYFILES) $(LIBOBJFILES) $(COMMANDFILES) $(TESTFILES)
	rm -f *.o *.d *.gch a.out check.in check.out gmon.out *.log *.vlog \
	  *.tkh *.tkt *.tks *.flat *~ hoge moge tako ika uni doc/*~
	rm -Rf casket*

untabify :
	ls *.cc *.h *.c | while read name ; \
	  do \
	    sed -e 's/\t/        /g' -e 's/ *$$//' $$name > $$name~; \
	    [ -f $$name~ ] && mv -f $$name~ $$name ; \
	  done

setversion :
	ls VCMakefile | while read name ; \
	  do \
	    sed -e "s/^PKG_VERSION = .*/PKG_VERSION = $(VERSION)/" \
	      -e "s/^LIB_VERSION = .*/LIB_VERSION = $(LIBVER).$(LIBREV).$(LIBFMT)/" $$name > $$name~ ; \
	    [ -f $$name~ ] && mv -f $$name~ $$name ; \
    done

install :
	mkdir -p $(DESTDIR)$(INCLUDEDIR)
	[ ! -f tkrzw_lib_commons.h -a -f ../tkrzw_lib_common.h ] && cd .. ; \
	  cp -Rf $(HEADERFILES) $(DESTDIR)$(INCLUDEDIR)
	mkdir -p $(DESTDIR)$(LIBDIR)
	cp -Rf $(LIBRARYFILES) $(DESTDIR)$(LIBDIR)
	mkdir -p $(DESTDIR)$(BINDIR)
	cp -Rf $(COMMANDFILES) $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(PCDIR)
	cp -Rf $(PCFILES) $(DESTDIR)$(PCDIR)
	@printf '\n'
	@printf '#================================================================\n'
	@printf '# Thanks for using Tkrzw.\n'
	@printf '#================================================================\n'

install-strip :
	$(MAKE) DESTDIR=$(DESTDIR) install
	cd $(DESTDIR)$(BINDIR) && strip $(COMMANDFILES)

uninstall :
	-cd $(DESTDIR)$(INCLUDEDIR) && rm -f $(HEADERFILES)
	-cd $(DESTDIR)$(LIBDIR) && rm -f $(LIBRARYFILES)
	-cd $(DESTDIR)$(BINDIR) && rm -f $(COMMANDFILES)
	-cd $(DESTDIR)$(PCDIR) && rm -f $(PCFILES)

dist :
	$(MAKE) untabify
	$(MAKE) setversion
	$(MAKE) distclean
	rm -Rf "../$(PACKAGEDIR)" "../$(PACKAGETGZ)"
	cd .. && cp -R tkrzw $(PACKAGEDIR) && \
	  tar --exclude=".*" -cvf - $(PACKAGEDIR) | gzip -c > $(PACKAGETGZ)
	rm -Rf "../$(PACKAGEDIR)"
	sync ; sync

distclean : clean apidocclean
	[ ! -f example/Makefile ] || cd example && $(MAKE) clean
	rm -Rf Makefile tkrzw.pc \
	  config.cache config.log config.status config.tmp autom4te.cache build

check :
	$(MAKE) check-build-util
	$(MAKE) check-perf-sampler
	$(MAKE) check-str-perf
	$(MAKE) check-file-perf
	$(MAKE) check-hashdbm-perf
	$(MAKE) check-hashdbm-util
	$(MAKE) check-treedbm-perf
	$(MAKE) check-treedbm-util
	$(MAKE) check-skipdbm-perf
	$(MAKE) check-skipdbm-util
	$(MAKE) check-tinydbm-perf
	$(MAKE) check-babydbm-perf
	$(MAKE) check-cachedbm-perf
	$(MAKE) check-stddbm-perf
	$(MAKE) check-polydbm-perf
	$(MAKE) check-polydbm-util
	$(MAKE) check-sharddbm-perf
	$(MAKE) check-sharddbm-util
	$(MAKE) check-index-perf
	$(MAKE) check-tran
	$(MAKE) check-ulog-util
	$(MAKE) check-langc
	rm -Rf casket*
	@printf '\n'
	@printf '#================================================================\n'
	@printf '# Checking completed.\n'
	@printf '#================================================================\n'

check-light :
	$(MAKE) check-build-util
	$(MAKE) check-perf-sampler
	$(MAKE) check-hashdbm-util
	$(MAKE) check-treedbm-util
	$(MAKE) check-skipdbm-util
	$(MAKE) check-polydbm-util
	$(MAKE) check-sharddbm-util
	$(MAKE) check-ulog-util
	rm -Rf casket*
	@printf '\n'
	@printf '#================================================================\n'
	@printf '# Checking completed.\n'
	@printf '#================================================================\n'

check-build-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_build_util version
	$(RUNENV) ./tkrzw_build_util config
	$(RUNENV) ./tkrzw_build_util config -v
	$(RUNENV) ./tkrzw_build_util config -i
	$(RUNENV) ./tkrzw_build_util config -l
	$(RUNENV) ./tkrzw_build_util config -p

check-str-perf :
	$(RUNENV) ./tkrzw_str_perf search \
	  --iter 1000 --text 2000 --pattern 5 --chars 10
	$(RUNENV) ./tkrzw_str_perf search \
	  --iter 1000 --text 2000 --pattern 5 --chars 10 --whole 3
	$(RUNENV) ./tkrzw_str_perf search \
	  --iter 1000 --text 2000 --pattern 5 --chars 10 --batch 3
	$(RUNENV) ./tkrzw_str_perf hash --iter 1000 --text 10000
	$(RUNENV) ./tkrzw_str_perf hash --iter 100 --text 1000 --error_type random
	$(RUNENV) ./tkrzw_str_perf compress --iter 200 --text 500

check-file-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_file_perf sequence --file std \
	  --iter 50000 --threads 5 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file std \
	  --iter 50000 --threads 5 --size 20 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-para \
	  --iter 50000 --threads 5 --size 20 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file mmap-para \
	  --iter 50000 --threads 5 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-atom \
	  --iter 50000 --threads 5 --size 20  casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file mmap-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file mmap-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-para \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 5000 --threads 4 --size 512 --block_size 512 $(FILEPERFDIRECTIOFLAGS) \
	  --padding casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 5000 --threads 4 --size 512 --block_size 512 $(FILEPERFDIRECTIOFLAGS) \
	  --pagecache --padding casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 50000 --threads 5 --size 5 --block_size 32 --head_buffer 1000 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 50000 --threads 5 --size 5 --block_size 32 --head_buffer 1000 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-para \
	  --iter 50000 --threads 5 --size 128 --block_size 128 --head_buffer 8192 casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-para \
	  --iter 50000 --threads 5 --size 128 --block_size 128 --pagecache --head_buffer 8192 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-atom \
	  --iter 50000 --threads 5 --size 20 --alloc_init 1 --alloc_inc 1.2 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 5000 --threads 4 --size 512 --block_size 512 $(FILEPERFDIRECTIOFLAGS) \
	  --padding casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 5000 --threads 4 --size 512 --block_size 512 $(FILEPERFDIRECTIOFLAGS) \
	  --pagecache --padding casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 50000 --threads 5 --size 5 --block_size 32 --head_buffer 1000 --random casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 50000 --threads 5 --size 5 --block_size 32 --head_buffer 1000 --append casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-atom \
	  --iter 50000 --threads 5 --size 128 --block_size 128 --head_buffer 8192 casket
	$(RUNENV) ./tkrzw_file_perf wicked --file pos-atom \
	  --iter 50000 --threads 5 --size 128 --block_size 128 --pagecache --head_buffer 8192 casket

check-hashdbm-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 \
	  $(DBMPERFRECCOMPFLAGS)
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 \
	  $(DBMPERFRECCOMPFLAGS) --append --record_crc 8 --validate
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 --random_key --random_value --append
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 --random_key --random_value --append
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm hash --file mmap-para --path casket.tkh \
	  --iter 100000 --threads 1 --size 8 --buckets 10000 --random_key --random_value --rebuild
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm hash --file mmap-para --path casket.tkh \
	  --iter 100000 --threads 1 --size 8 --buckets 10000 $(DBMPERFRECCOMPFLAGS) \
	  --random_key --random_value --keys 10000 --rebuild --append --record_crc 8 --validate
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm hash --file mmap-para --path casket.tkh \
	  --iter 10000 --threads 5 --size 8 --buckets 1000 $(DBMPERFRECCOMPFLAGS) \
	  --random_key --random_value --keys 5000 --rebuild --append --record_crc 16 --sleep 0.00001
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 $(DBMPERFRECCOMPFLAGS) \
	  --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm hash --file mmap-para --path casket.tkh \
	  --iter 20000 --threads 5 --size 8 --buckets 100000 $(DBMPERFRECCOMPFLAGS) \
	  --append  --record_crc 32 --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm hash --file pos-para --path casket.tkh \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding \
	  --iter 5000 --threads 1 --size 100 --buckets 100000 --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm hash --file pos-atom --path casket.tkh \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding \
	  --iter 5000 --threads 2 --size 100 --buckets 100000 --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm hash --file pos-atom --path casket.tkh \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding --pagecache \
	  --iter 10000 --threads 4 --size 100 --buckets 100000 --iterator --clear --rebuild --validate
	$(RUNENV) ./tkrzw_dbm_perf wicked --path casket.tkh --record_comp rc4 --cipher_key abc \
	  --iter 10000 --threads 4 --size 100 --buckets 100000 --iterator --clear --rebuild --validate

check-hashdbm-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_util create --dbm hash --record_crc 8 --buckets 10 casket.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket.tkh one first
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket.tkh two second
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket.tkh three third
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket.tkh four fourth
	$(RUNENV) ./tkrzw_dbm_util remove --dbm hash casket.tkh four
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket.tkh five fifth
	$(RUNENV) ./tkrzw_dbm_util rekey --dbm hash --no_overwrite casket.tkh five FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket.tkh FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket.tkh two
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash --multi casket.tkh 1 ichi 2 ni
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash --multi --append ":" casket.tkh 1 a 2 b
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash --multi casket.tkh 1 2 3
	$(RUNENV) ./tkrzw_dbm_util remove --dbm hash --multi casket.tkh 1 2 3
	$(RUNENV) ./tkrzw_dbm_util export --dbm hash casket.tkh casket.flat
	$(RUNENV) ./tkrzw_dbm_util create --dbm hash --record_crc 8 --buckets 10 casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util import --dbm hash casket-2.tkh casket.flat
	$(RUNENV) ./tkrzw_dbm_util list --dbm hash casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util list --dbm hash --move jump --jump_key three --items 2 casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util export --dbm hash --tsv casket.tkh casket.tsv
	$(RUNENV) ./tkrzw_dbm_util create --dbm hash --record_crc 8 --buckets 10 casket-3.tkh
	$(RUNENV) ./tkrzw_dbm_util import --dbm hash --tsv casket-3.tkh casket.tsv
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket-3.tkh three
	$(RUNENV) ./tkrzw_dbm_util export --dbm hash --ulog 123 casket.tkh casket-ulog
	$(RUNENV) ./tkrzw_dbm_util import --dbm hash --ulog 123 casket-4.tkh casket-ulog
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket-4.tkh three
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm hash casket.tkh
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm hash --validate casket.tkh
	$(RUNENV) ./tkrzw_dbm_util restore --dbm hash casket.tkh casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash casket-new.tkh four fourth
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket-new.tkh one
	$(RUNENV) ./tkrzw_dbm_util list --dbm hash casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util restore --dbm hash casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash casket-new.tkh one
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm hash --validate casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util merge --dbm hash casket-new.tkh casket.tkh
	$(RUNENV) ./tkrzw_dbm_util create --dbm hash --file pos-para \
	  --alloc_init 1 --alloc_inc 1.2 --buckets 10 --block_size 8192 --padding \
	  --truncate casket.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash --file pos-para \
	  --no_wait --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding \
	  casket.tkh tokyo shinjuku
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm hash --file pos-para \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash --file pos-para \
	  --block_size 8192 --padding casket.tkh saitama tokorozawa
	$(RUNENV) ./tkrzw_dbm_util set --dbm hash --file pos-para \
	  --block_size 8192 --padding casket.tkh kanagawa yokohama
	$(RUNENV) ./tkrzw_dbm_util get --dbm hash --file pos-para \
	  --block_size 8192 --padding casket.tkh saitama
	$(RUNENV) ./tkrzw_dbm_util remove --dbm hash --file pos-para \
	  --block_size 8192 --padding casket.tkh saitama
	$(RUNENV) ./tkrzw_dbm_util list --dbm hash --file pos-para \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tkh
	$(RUNENV) ./tkrzw_dbm_util create --record_comp rc4 --cipher_key abc --buckets 10 casket-rc4.tkh
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-rc4.tkh one first
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-rc4.tkh two second
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-rc4.tkh one
	$(RUNENV) ./tkrzw_dbm_util rebuild --cipher_key abc casket-rc4.tkh
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-rc4.tkh two
	$(RUNENV) ./tkrzw_dbm_util restore --cipher_key abc casket-rc4.tkh casket-rc4-new.tkh
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-rc4-new.tkh one
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-rc4-new.tkh three third
	$(RUNENV) ./tkrzw_dbm_util merge --cipher_key abc casket-rc4.tkh casket-rc4-new.tkh
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-rc4.tkh three
	$(RUNENV) ./tkrzw_dbm_util remove --cipher_key abc casket-rc4.tkh two
	$(RUNENV) ./tkrzw_dbm_util list --cipher_key abc casket-rc4.tkh

check-treedbm-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 --append
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 --page_update_write
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value --append
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value --append
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value --page_update_write
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 100000 --threads 1 --size 8 --max_page_size 200 --max_branches 8 \
	  --random_key --random_value --rebuild
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 100000 --threads 1 --size 8 --max_page_size 200 --max_branches 8 \
	  --max_cached_pages 256 --random_key --random_value --keys 10000 --rebuild \
	  --append --record_crc 8 --validate
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tree --file mmap-para --path casket.tkt \
	  --iter 10000 --threads 5 --size 8 --buckets 1000 $(DBMPERFRECCOMPFLAGS) \
	  --max_page_size 200 --max_branches 8 \
	  --random_key --random_value --keys 5000 --rebuild --append --record_crc 16 --sleep 0.00001
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --append --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tree --file mmap-para --path casket.tkt \
	  --iter 20000 --threads 5 --size 8 --max_page_size 200 --max_branches 8 \
	  --page_update_write --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tree --file pos-para --path casket.tkt \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding \
	  --iter 80000 --threads 1 --size 8 --max_page_size 1024 --max_branches 8 \
	  --append --record_crc 16 --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tree --file pos-para --path casket.tkt \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding --pagecache --align_pow 9 \
	  --iter 40000 --threads 5 --size 8 --max_page_size 1024 --max_branches 8 \
	  --append --record_crc 32 --iterator --clear --rebuild --validate
	$(RUNENV) ./tkrzw_dbm_perf wicked --path casket.tkt --record_comp aes --cipher_key abc \
	  --iter 10000 --threads 4 --size 100 --buckets 100000 --iterator --clear --rebuild --validate

check-treedbm-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_util create --dbm tree --record_crc 16 --buckets 10 casket.tkt
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket.tkt one first
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket.tkt two second
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket.tkt three third
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket.tkt four fourth
	$(RUNENV) ./tkrzw_dbm_util remove --dbm tree casket.tkt four
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket.tkt five fifth
	$(RUNENV) ./tkrzw_dbm_util rekey --dbm tree --no_overwrite casket.tkt five FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket.tkt FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket.tkt two
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree --multi casket.tkt 1 ichi 2 ni
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree --multi --append ":" casket.tkt 1 a 2 b
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree --multi casket.tkt 1 2 3
	$(RUNENV) ./tkrzw_dbm_util remove --dbm tree --multi casket.tkt 1 2 3
	$(RUNENV) ./tkrzw_dbm_util export --dbm tree casket.tkt casket.flat
	$(RUNENV) ./tkrzw_dbm_util create --dbm tree --buckets 10 casket-2.tkt
	$(RUNENV) ./tkrzw_dbm_util import --dbm tree casket-2.tkt casket.flat
	$(RUNENV) ./tkrzw_dbm_util list --dbm tree casket-2.tkt
	$(RUNENV) ./tkrzw_dbm_util list --dbm tree --move jump --jump_key three --items 2 casket-2.tkt
	$(RUNENV) ./tkrzw_dbm_util export --dbm tree --tsv casket.tkt casket.tsv
	$(RUNENV) ./tkrzw_dbm_util create --dbm tree --buckets 10 casket-3.tkt
	$(RUNENV) ./tkrzw_dbm_util import --dbm tree --tsv casket-3.tkt casket.tsv
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket-3.tkt three
	$(RUNENV) ./tkrzw_dbm_util export --dbm tree --ulog 123 casket.tkt casket-ulog
	$(RUNENV) ./tkrzw_dbm_util import --dbm tree --ulog 123 casket-4.tkt casket-ulog
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket-4.tkt three
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm tree casket.tkt
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm tree --validate casket.tkt
	$(RUNENV) ./tkrzw_dbm_util restore --dbm tree casket.tkt casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree casket-new.tkt four fourth
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket-new.tkt one
	$(RUNENV) ./tkrzw_dbm_util list --dbm tree casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util restore --dbm tree casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree casket-new.tkt one
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm tree --validate casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util merge --dbm tree casket-new.tkt casket.tkt
	$(RUNENV) ./tkrzw_dbm_util create --dbm tree --file pos-atom \
	  --alloc_init 1 --alloc_inc 1.2 --buckets 10 --block_size 8192 --padding \
	  --truncate casket.tkt
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree --file pos-atom \
	  --no_wait --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding \
	  casket.tkt tokyo shinjuku
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm tree --file pos-atom \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tkt
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree --file pos-atom \
	  --block_size 8192 --padding casket.tkt saitama tokorozawa
	$(RUNENV) ./tkrzw_dbm_util set --dbm tree --file pos-atom \
	  --block_size 8192 --padding casket.tkt kanagawa yokohama
	$(RUNENV) ./tkrzw_dbm_util get --dbm tree --file pos-atom \
	  --block_size 8192 --padding casket.tkt saitama
	$(RUNENV) ./tkrzw_dbm_util remove --dbm tree --file pos-atom \
	  --block_size 8192 --padding casket.tkt saitama
	$(RUNENV) ./tkrzw_dbm_util list --dbm tree --file pos-atom \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tkt
	$(RUNENV) ./tkrzw_dbm_util create --record_comp rc4 --cipher_key abc --buckets 10 casket-aes.tkt
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-aes.tkt one first
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-aes.tkt two second
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-aes.tkt one
	$(RUNENV) ./tkrzw_dbm_util rebuild --cipher_key abc casket-aes.tkt
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-aes.tkt two
	$(RUNENV) ./tkrzw_dbm_util restore --cipher_key abc casket-aes.tkt casket-aes-new.tkt
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-aes-new.tkt one
	$(RUNENV) ./tkrzw_dbm_util set --cipher_key abc casket-aes-new.tkt three third
	$(RUNENV) ./tkrzw_dbm_util merge --cipher_key abc casket-aes.tkt casket-aes-new.tkt
	$(RUNENV) ./tkrzw_dbm_util get --cipher_key abc casket-aes.tkt three
	$(RUNENV) ./tkrzw_dbm_util remove --cipher_key abc casket-aes.tkt two
	$(RUNENV) ./tkrzw_dbm_util list --cipher_key abc casket-aes.tkt

check-skipdbm-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm skip --file mmap-para --path casket.tks \
	  --iter 20000 --threads 5 --size 8 --step_unit 4 --max_level 10
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm skip --file mmap-atom --path casket.tks \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding --pagecache \
	  --iter 20000 --threads 5 --size 8 --step_unit 4 --max_level 10
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm skip --file mmap-para --path casket.tks \
	  --iter 20000 --threads 5 --size 8 --step_unit 2 --max_level 20 \
	  --random_key --random_value --validate
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm skip --file pos-para --path casket.tks \
	  --iter 100000 --size 8 --step_unit 8 --max_level 8 --insert_in_order
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm skip --file pos-para --path casket.tks \
	  --iter 20000 --threads 5 --size 8 --step_unit 3 --max_level 13
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm skip --file pos-para --path casket.tks \
	  --iter 20000 --threads 5 --size 8 --step_unit 5 --max_level 9
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm skip --file pos-atom --path casket.tks \
	  --block_size 512 $(DBMPERFDIRECTIOFLAGS) --padding --pagecache \
	  --iter 20000 --threads 5 --size 8 --step_unit 5 --max_level 9 --validate

check-skipdbm-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_util create --dbm skip --buckets 10 casket.tks
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket.tks one first
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket.tks two second
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket.tks three third
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket.tks four fourth
	$(RUNENV) ./tkrzw_dbm_util remove --dbm skip casket.tks four
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket.tks five fifth
	$(RUNENV) ./tkrzw_dbm_util rekey --dbm skip --no_overwrite casket.tks five FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip casket.tks FIVE
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip casket.tks two
	$(RUNENV) ./tkrzw_dbm_util export --dbm skip casket.tks casket.flat
	$(RUNENV) ./tkrzw_dbm_util create --dbm skip --buckets 10 casket-2.tks
	$(RUNENV) ./tkrzw_dbm_util import --dbm skip casket-2.tks casket.flat
	$(RUNENV) ./tkrzw_dbm_util list --dbm skip casket-2.tks
	$(RUNENV) ./tkrzw_dbm_util list --dbm skip --move jump --jump_key one --items 2 casket-2.tks
	$(RUNENV) ./tkrzw_dbm_util export --dbm skip --tsv casket.tks casket.tsv
	$(RUNENV) ./tkrzw_dbm_util create --dbm skip --buckets 10 casket-3.tks
	$(RUNENV) ./tkrzw_dbm_util import --dbm skip --tsv casket-3.tks casket.tsv
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip casket-3.tks three
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm skip casket.tks
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm skip --validate casket.tks
	$(RUNENV) ./tkrzw_dbm_util restore --dbm skip casket.tks casket-new.tks
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip casket-new.tks four fourth
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip casket-new.tks one
	$(RUNENV) ./tkrzw_dbm_util list --dbm skip casket-new.tks
	$(RUNENV) ./tkrzw_dbm_util restore --dbm skip casket-new.tks
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip casket-new.tks one
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm skip --validate casket-new.tks
	$(RUNENV) ./tkrzw_dbm_util merge --dbm skip --reducer last casket-new.tks casket.tks
	$(RUNENV) ./tkrzw_dbm_util create --dbm skip --file pos-atom \
	  --alloc_init 1 --alloc_inc 1.2 --buckets 10 --block_size 8192 --padding \
	  --truncate casket.tks
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip --file pos-atom \
	  --no_wait --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding \
	  casket.tks tokyo shinjuku
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm skip --file pos-atom \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tks
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip --file pos-atom \
	  --block_size 8192 --padding casket.tks saitama tokorozawa
	$(RUNENV) ./tkrzw_dbm_util set --dbm skip --file pos-atom \
	  --block_size 8192 --padding casket.tks kanagawa yokohama
	$(RUNENV) ./tkrzw_dbm_util get --dbm skip --file pos-atom \
	  --block_size 8192 --padding casket.tks saitama
	$(RUNENV) ./tkrzw_dbm_util remove --dbm skip --file pos-atom \
	  --block_size 8192 --padding casket.tks saitama
	$(RUNENV) ./tkrzw_dbm_util list --dbm skip --file pos-atom \
	  --no_lock --alloc_init 1 --alloc_inc 1.2 --block_size 8192 --padding casket.tks

check-tinydbm-perf :
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tiny \
	  --iter 20000 --threads 5 --size 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm tiny \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm tiny \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm tiny \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild

check-babydbm-perf :
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm baby \
	  --iter 20000 --threads 5 --size 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm baby \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm baby \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm baby \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild

check-cachedbm-perf :
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm cache \
	  --iter 20000 --threads 5 --size 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm cache \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm cache \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm cache \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild --cap_rec_num 4000

check-stddbm-perf :
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm stdhash \
	  --iter 20000 --threads 5 --size 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm stdhash \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm stdhash \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm stdhash \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm stdtree \
	  --iter 20000 --threads 5 --size 8
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm stdtree \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm stdtree \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm stdtree \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild

check-polydbm-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket \
	  --iter 10000 --threads 5 --size 8 \
	  --params "dbm=hash,file=std,num_buckets=100000,offset_width=3,align_pow=0"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket \
	  --iter 20000 --threads 5 --size 8 \
	  --params "dbm=hash,file=mmap-para,update_mode=in_place,num_buckets=100000"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value \
	  --params "dbm=hash,file=mmap-atom,update_mode=appending,num_buckets=100000"
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm poly --path casket \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value \
	  --params "dbm=hash,file=pos-para,num_buckets=100000,offset_width=3,align_pow=1"
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm poly --path casket \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild \
	  --params "dbm=hash,file=pos-atom,num_buckets=100000,fbp_capacity=0"
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm poly --path casket \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild \
	  --params "dbm=hash,file=pos-atom,num_buckets=100000,record_comp_mode=aes,cipher_key=abc"

check-polydbm-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_util create --dbm poly --params "num_buckets=10" casket.tkh 
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket.tkh one first
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket.tkh two second
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket.tkh three third
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket.tkh four fourth
	$(RUNENV) ./tkrzw_dbm_util remove --dbm poly casket.tkh four
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket.tkh five fifth
	$(RUNENV) ./tkrzw_dbm_util get --dbm poly casket.tkh two
	$(RUNENV) ./tkrzw_dbm_util export --dbm poly casket.tkh casket.flat
	$(RUNENV) ./tkrzw_dbm_util create --dbm poly --params "num_buckets=10" casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util import --dbm poly casket-2.tkh casket.flat
	$(RUNENV) ./tkrzw_dbm_util list --dbm poly casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util list --dbm poly --move jump --jump_key three --items 2 casket-2.tkh
	$(RUNENV) ./tkrzw_dbm_util export --dbm poly --tsv casket.tkh casket.tsv
	$(RUNENV) ./tkrzw_dbm_util create --dbm poly --params "num_buckets=10" casket-3.tkh
	$(RUNENV) ./tkrzw_dbm_util import --dbm poly --tsv casket-3.tkh casket.tsv
	$(RUNENV) ./tkrzw_dbm_util get --dbm poly casket-3.tkh three
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm poly casket.tkh
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm poly casket.tkh
	$(RUNENV) ./tkrzw_dbm_util restore --dbm poly casket.tkh casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly casket-new.tkh four fourth
	$(RUNENV) ./tkrzw_dbm_util get --dbm poly casket-new.tkh one
	$(RUNENV) ./tkrzw_dbm_util list --dbm poly casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util restore --dbm poly casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util get --dbm poly casket-new.tkh one
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm poly casket-new.tkh
	$(RUNENV) ./tkrzw_dbm_util create --dbm poly --params "num_buckets=10" casket-orig.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm poly --params "ulog_prefix=casket-ulog" \
	  casket-orig.tkh hello world
	$(RUNENV) ./tkrzw_dbm_util import --ulog 0 --dbm poly --params "num_buckets=10" \
	  casket-restored.tkh casket-ulog
	$(RUNENV) ./tkrzw_dbm_util get --dbm poly casket-restored.tkh hello

check-sharddbm-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm shard --path casket \
	  --iter 20000 --threads 5 --size 8 \
	  --params "dbm=tree,num_shards=3"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm shard --path casket \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value \
	  --params "dbm=tree,num_shards=3"
	$(RUNENV) ./tkrzw_dbm_perf parallel --dbm shard --path casket \
	  --iter 20000 --threads 5 --size 8 --random_key --random_value \
	  --params "dbm=tree,num_shards=3"
	$(RUNENV) ./tkrzw_dbm_perf wicked --dbm shard --path casket \
	  --iter 20000 --threads 5 --size 8 --iterator --clear --rebuild \
	  --params "dbm=tree,num_shards=3"

check-sharddbm-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_util create --dbm shard casket.tkt \
	  --params "num_buckets=10,num_shards=3"
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket.tkt one first
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket.tkt two second
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket.tkt three third
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket.tkt four fourth
	$(RUNENV) ./tkrzw_dbm_util remove --dbm shard casket.tkt four
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket.tkt five fifth
	$(RUNENV) ./tkrzw_dbm_util get --dbm shard casket.tkt two
	$(RUNENV) ./tkrzw_dbm_util export --dbm shard casket.tkt casket.flat
	$(RUNENV) ./tkrzw_dbm_util create --dbm shard casket-2.tkt \
	  --params "num_buckets=10,num_shards=4"
	$(RUNENV) ./tkrzw_dbm_util import --dbm shard casket-2.tkt casket.flat
	$(RUNENV) ./tkrzw_dbm_util list --dbm shard casket-2.tkt
	$(RUNENV) ./tkrzw_dbm_util list --dbm shard --move jump --jump_key three --items 2 casket-2.tkt
	$(RUNENV) ./tkrzw_dbm_util export --dbm shard --tsv casket.tkt casket.tsv
	$(RUNENV) ./tkrzw_dbm_util create --dbm shard --params "num_buckets=10" casket-3.tkt
	$(RUNENV) ./tkrzw_dbm_util import --dbm shard --tsv casket-3.tkt casket.tsv
	$(RUNENV) ./tkrzw_dbm_util get --dbm shard casket-3.tkt three
	$(RUNENV) ./tkrzw_dbm_util rebuild --dbm shard casket.tkt
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm shard casket.tkt
	$(RUNENV) ./tkrzw_dbm_util restore --dbm shard casket.tkt casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard casket-new.tkt four fourth
	$(RUNENV) ./tkrzw_dbm_util get --dbm shard casket-new.tkt one
	$(RUNENV) ./tkrzw_dbm_util list --dbm shard casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util restore --dbm shard casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util get --dbm shard casket-new.tkt one
	$(RUNENV) ./tkrzw_dbm_util inspect --dbm shard casket-new.tkt
	$(RUNENV) ./tkrzw_dbm_util create --dbm shard --params "num_buckets=10,num_shards=4" \
	  casket-orig.tkh
	$(RUNENV) ./tkrzw_dbm_util set --dbm shard --params "ulog_prefix=casket-ulog,num_shards=4" \
	  casket-orig.tkh hello world
	$(RUNENV) ./tkrzw_dbm_util import --ulog 0 --dbm shard --params "num_buckets=10,num_shards=4" \
	  casket-restored.tkh casket-ulog
	$(RUNENV) ./tkrzw_dbm_util get --dbm shard casket-restored.tkh hello

check-index-perf :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_perf index --type file \
	  --iter 20000 --threads 5 --random_key --random_value --path casket.tkt
	$(RUNENV) ./tkrzw_dbm_perf index --type mem \
	  --iter 20000 --threads 5 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf index --type n2n \
	  --iter 20000 --threads 5 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf index --type n2s \
	  --iter 20000 --threads 5 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf index --type s2n \
	  --iter 20000 --threads 5 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf index --type s2s \
	  --iter 20000 --threads 5 --random_key --random_value
	$(RUNENV) ./tkrzw_dbm_perf index --type str \
	  --iter 20000 --threads 5 --random_key --random_value

check-tran :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_dbm_tran build casket.tkh --iter 30000 --threads 4 \
	  --sync_freq 100 --params "record_crc_mode=8"
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tkh
	$(RUNENV) ./tkrzw_dbm_tran build casket.tkh --iter 30000 --threads 4 \
	  --sync_freq 100 --async 3 --rebuild --remove --params "record_crc_mode=8"
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tkh
	$(RUNENV) ./tkrzw_dbm_tran build casket.tkt --iter 30000 --threads 4 \
	  --sync_freq 100 --params "record_crc_mode=16,$(DBMTRANRECCOMPPARAMS)"
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tkt
	$(RUNENV) ./tkrzw_dbm_tran build casket.tkt --iter 30000 --threads 4 \
	  --sync_freq 100 --async 3 --rebuild --remove \
	  --params "record_crc_mode=16,$(DBMTRANRECCOMPPARAMS)"
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tkt
	$(RUNENV) ./tkrzw_dbm_tran build casket.tks --iter 10000 --threads 4 \
	  --sync_freq 10000
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tks
	$(RUNENV) ./tkrzw_dbm_tran build casket.tks --iter 10000 --threads 4 \
	  --sync_freq 10000 --async 3 --rebuild --remove
	$(RUNENV) ./tkrzw_dbm_tran check --restore casket.tks
	$(RUNENV) ./tkrzw_dbm_tran async casket.tkh --iter 15000 --threads 4 \
	  --params "num_buckets=100000" --rebuild --random_key --async 0
	$(RUNENV) ./tkrzw_dbm_tran async casket.tkh --iter 15000 --threads 4 \
	  --params "num_buckets=100000" --rebuild --async 4 --wait_freq 1000
	$(RUNENV) ./tkrzw_dbm_tran async casket.tkt --iter 15000 --threads 4 \
	  --params "num_buckets=10000,max_page_size=1024" --rebuild --random_key --async 0
	$(RUNENV) ./tkrzw_dbm_tran async casket.tkt --iter 15000 --threads 4 \
	  --params "num_buckets=10000,max_page_size=1024" --rebuild --async 4 --wait_freq 1000

check-ulog-util :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_ulog_util writeset --max_file_size 100 casket-ulog zero nil
	$(RUNENV) ./tkrzw_ulog_util writeclear --max_file_size 100 casket-ulog
	$(RUNENV) ./tkrzw_ulog_util writeset --max_file_size 100 casket-ulog one hop
	$(RUNENV) ./tkrzw_ulog_util writeset --max_file_size 100 casket-ulog two step
	$(RUNENV) ./tkrzw_ulog_util writeset --max_file_size 100 casket-ulog three jump
	$(RUNENV) ./tkrzw_ulog_util writeremove --max_file_size 100 casket-ulog two
	$(RUNENV) ./tkrzw_ulog_util listfiles casket-ulog
	$(RUNENV) ./tkrzw_dbm_util import --ulog 0 casket.tkt casket-ulog
	$(RUNENV) ./tkrzw_dbm_util get casket.tkt one
	$(RUNENV) ./tkrzw_dbm_util list casket.tkt
	$(RUNENV) ./tkrzw_ulog_util removeoldfiles --timestamp +1s --exclude_latest casket-ulog

check-langc :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_langc_check "casket.tkh" "truncate=true,num_buckets=10000" 20000
	$(RUNENV) ./tkrzw_langc_check "casket.tkt" "truncate=true,num_buckets=1000" 20000
	$(RUNENV) ./tkrzw_langc_check "casket.tks" "truncate=true" 20000

check-perf-sampler :
	rm -Rf casket*
	$(RUNENV) ./tkrzw_file_perf sequence --file std \
	  --iter 1000 --threads 2 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-para \
	  --iter 1000 --threads 2 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file mmap-atom \
	  --iter 1000 --threads 2 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-para \
	  --iter 1000 --threads 2 --size 20 casket
	$(RUNENV) ./tkrzw_file_perf sequence --file pos-atom \
	  --iter 1000 --threads 2 --size 20 casket
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkh \
	  --iter 1000 --threads 2 --params "dbm=hash,num_buckets=2000"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkt \
	  --iter 1000 --threads 2 --params "dbm=tree,num_buckets=500"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tks \
	  --iter 1000 --threads 2 --params "dbm=skip"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkmt \
	  --iter 1000 --threads 2 --params "dbm=tiny,num_buckets=2000"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkmb \
	  --iter 1000 --threads 2 --params "dbm=baby"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkmc \
	  --iter 1000 --threads 2 --params "dbm=cache,cap_rec_num=3000"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tksh \
	  --iter 1000 --threads 2 --params "dbm=stdhash,num_buckets=2000"
	$(RUNENV) ./tkrzw_dbm_perf sequence --dbm poly --path casket.tkst \
	  --iter 1000 --threads 2 --params "dbm=stdhash"
	$(RUNENV) ./tkrzw_langc_check "casket.tkh" "truncate=true,num_buckets=1000" 1000
	$(RUNENV) ./tkrzw_langc_check "casket.tkt" "truncate=true,num_buckets=200" 1000
	$(RUNENV) ./tkrzw_langc_check "casket.tks" "truncate=true" 1000

check-direct : check-direct-hashdbm check-direct-treedbm check-direct-skipdbm

check-direct-hashdbm :
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file mmap-para \
	  --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000 --cache_buckets
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000 --cache_buckets --block_size 512 --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000 --cache_buckets --block_size 512 \
	  --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000 --cache_buckets --block_size 512 \
	  --direct_io --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkh --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --buckets 2000000 --align_pow 7 --iter 1000000 --cache_buckets --block_size 512 \
	  --direct_io --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf wicked --path casket.tkh --file pos-para \
	  --random_seed -1 --iter 1000000 --cache_buckets --block_size 512 --padding \
	  --pagecache --rebuild --clear --iterator --threads 2

check-direct-treedbm :
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file mmap-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000 --cache_buckets \
	  --block_size 1024 --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000 --cache_buckets \
	  --block_size 1024 --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000 --cache_buckets \
	  --block_size 1024 --direct_io --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tkt --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --max_page_size 4060 --max_cached_pages 1000 --iter 1000000 --cache_buckets \
	  --block_size 1024 --direct_io --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf wicked --path casket.tkt --file pos-para \
    --random_seed -1 --max_page_size 4060 --max_cached_pages 1000 --iter 1000000 \
	  --cache_buckets --block_size 512 --padding --pagecache \
	  --rebuild --clear --iterator --threads 2

check-direct-skipdbm :
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file mmap-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000 --block_size 1024 --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000 --block_size 1024 --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000 --block_size 1024 --direct_io --padding
	$(RUNENV) ./tkrzw_dbm_perf sequence --path casket.tks --file pos-para \
    --random_seed -1 --random_key --size 100 \
	  --step_unit 16 --max_level 5 --iter 1000000 --block_size 1024 --direct_io \
	  --padding --pagecache
	$(RUNENV) ./tkrzw_dbm_perf wicked --path casket.tks --file pos-para \
    --random_seed -1 --step_unit 16 --max_level 5 --iter 1000000 \
	  --block_size 1024 --padding --pagecache --rebuild --clear --iterator --threads 2

test : $(TESTFILES)

testrun :
	$(RUNENV) ./tkrzw_sys_config_test
	$(RUNENV) ./tkrzw_lib_common_test
	$(RUNENV) ./tkrzw_str_util_test
	$(RUNENV) ./tkrzw_hash_util_test
	$(RUNENV) ./tkrzw_time_util_test
	$(RUNENV) ./tkrzw_thread_util_test
	$(RUNENV) ./tkrzw_logger_test
	$(RUNENV) ./tkrzw_compress_test
	$(RUNENV) ./tkrzw_containers_test
	$(RUNENV) ./tkrzw_key_comparators_test
	$(RUNENV) ./tkrzw_file_util_test
	$(RUNENV) ./tkrzw_file_mmap_test
	$(RUNENV) ./tkrzw_file_pos_test
	$(RUNENV) ./tkrzw_file_poly_test
	$(RUNENV) ./tkrzw_message_queue_test
	$(RUNENV) ./tkrzw_dbm_ulog_test
	$(RUNENV) ./tkrzw_dbm_common_impl_test
	$(RUNENV) ./tkrzw_dbm_hash_impl_test
	$(RUNENV) ./tkrzw_dbm_hash_test
	$(RUNENV) ./tkrzw_dbm_tree_impl_test
	$(RUNENV) ./tkrzw_dbm_tree_test
	$(RUNENV) ./tkrzw_dbm_skip_impl_test
	$(RUNENV) ./tkrzw_dbm_skip_test
	$(RUNENV) ./tkrzw_dbm_tiny_test
	$(RUNENV) ./tkrzw_dbm_baby_test
	$(RUNENV) ./tkrzw_dbm_cache_test
	$(RUNENV) ./tkrzw_dbm_std_test
	$(RUNENV) ./tkrzw_dbm_poly_test
	$(RUNENV) ./tkrzw_dbm_shard_test
	$(RUNENV) ./tkrzw_dbm_async_test
	$(RUNENV) ./tkrzw_index_test
	$(RUNENV) ./tkrzw_langc_test

apidoc :
	$(MAKE) apidocclean
	mkdir -p api-doc
	doxygen

apidocclean :
	rm -Rf api-doc

.PHONY : all clean untabify install install-strip uninstall \
  dist distclean check test testrun apidoc apidocclean

#================================================================
# Suffix rules
#================================================================

OBJS := $(LIBOBJFILES) $(COMMANDFILES:%=%.o) $(TESTFILES:%=%.o)
SRCS := $(OBJS:%.o=%.c)
DEPS := $(SRCS:%.c=%.d)

-include $(DEPS)

.SUFFIXES :
.SUFFIXES : .c .cc .o

.c.o :
	$(CC) -c $(CPPFLAGS) -MMD $(CFLAGS) $<

.cc.o :
	$(CXX) -c $(CPPFLAGS) -MMD $(CXXFLAGS) $<

#================================================================
# Building libraries
#================================================================

libtkrzw.a : $(LIBOBJFILES)
	$(AR) $(ARFLAGS) $@ $(LIBOBJFILES)

libtkrzw.so.$(LIBVER).$(LIBREV).$(LIBFMT) : $(LIBOBJFILES)
	$(CXX) $(CXXFLAGS) $(LDSOFLAGS) -o $@ $(LIBOBJFILES) $(LDFLAGS) $(LIBS)

libtkrzw.so.$(LIBVER) : libtkrzw.so.$(LIBVER).$(LIBREV).$(LIBFMT)
	ln -f -s libtkrzw.so.$(LIBVER).$(LIBREV).$(LIBFMT) $@

libtkrzw.so : libtkrzw.so.$(LIBVER).$(LIBREV).$(LIBFMT)
	ln -f -s libtkrzw.so.$(LIBVER).$(LIBREV).$(LIBFMT) $@

libtkrzw.$(LIBVER).$(LIBREV).$(LIBFMT).dylib : $(LIBOBJFILES)
	$(CXX) $(CXXFLAGS) -dynamiclib -o $@ \
	  -install_name $(LIBDIR)/libtkrzw.$(LIBVER).dylib \
	  -current_version $(LIBVER).$(LIBREV).$(LIBFMT) -compatibility_version $(LIBVER) \
	  $(LIBOBJFILES) $(LDFLAGS) $(LIBS)

libtkrzw.$(LIBVER).dylib : libtkrzw.$(LIBVER).$(LIBREV).$(LIBFMT).dylib
	ln -f -s libtkrzw.$(LIBVER).$(LIBREV).$(LIBFMT).dylib $@

libtkrzw.dylib : libtkrzw.$(LIBVER).$(LIBREV).$(LIBFMT).dylib
	ln -f -s libtkrzw.$(LIBVER).$(LIBREV).$(LIBFMT).dylib $@

#================================================================
# Building commands
#================================================================

tkrzw_build_util : tkrzw_build_util.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_str_perf : tkrzw_str_perf.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_file_perf : tkrzw_file_perf.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_dbm_util : tkrzw_dbm_util.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_dbm_perf : tkrzw_dbm_perf.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_dbm_tran : tkrzw_dbm_tran.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_ulog_util : tkrzw_ulog_util.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

tkrzw_langc_check : tkrzw_langc_check.o $(LIBRARYFILES)
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(CMDLIBS) $(LIBS)

#================================================================
# Building tests
#================================================================

tkrzw_sys_config_test : tkrzw_sys_config_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_lib_common_test : tkrzw_lib_common_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_str_util_test : tkrzw_str_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_hash_util_test : tkrzw_hash_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_time_util_test : tkrzw_time_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_thread_util_test : tkrzw_thread_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_logger_test : tkrzw_logger_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_compress_test : tkrzw_compress_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_containers_test : tkrzw_containers_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_key_comparators_test : tkrzw_key_comparators_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_file_util_test : tkrzw_file_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_file_std_test : tkrzw_file_std_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_file_mmap_test : tkrzw_file_mmap_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_file_pos_test : tkrzw_file_pos_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_file_poly_test : tkrzw_file_poly_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_message_queue_test : tkrzw_message_queue_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_ulog_test : tkrzw_dbm_ulog_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_common_impl_test : tkrzw_dbm_common_impl_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_hash_impl_test : tkrzw_dbm_hash_impl_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_hash_test : tkrzw_dbm_hash_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_tree_impl_test : tkrzw_dbm_tree_impl_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_tree_test : tkrzw_dbm_tree_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_skip_impl_test : tkrzw_dbm_skip_impl_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_skip_test : tkrzw_dbm_skip_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_tiny_test : tkrzw_dbm_tiny_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_baby_test : tkrzw_dbm_baby_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_cache_test : tkrzw_dbm_cache_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_std_test : tkrzw_dbm_std_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_poly_test : tkrzw_dbm_poly_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_shard_test : tkrzw_dbm_shard_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_dbm_async_test : tkrzw_dbm_async_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_index_test : tkrzw_index_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_cmd_util_test : tkrzw_cmd_util_test.o $(LIBRARYFILES)
	$(CXX) $(CXXFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

tkrzw_langc_test : tkrzw_langc_test.o $(LIBRARYFILES)
	$(CXX) $(CFLAGS) -o $@ $< $(CMDLDFLAGS) $(CMDLIBS) $(TESTLIBS) $(LIBS)

# END OF FILE
