1# Makefile for writing tests of DBM brothers
2
3
4
5#================================================================
6# Setting variables
7#================================================================
8
9
10# Generic settings
11SHELL = /bin/sh
12
13# Targets
14MYBINS = tctest qdbmtest ndbmtest sdbmtest gdbmtest tdbtest cdbtest bdbtest \
15  maptest sqltest cmpsqltctest
16
17
18
19#================================================================
20# Suffix rules
21#================================================================
22
23
24.SUFFIXES :
25
26
27
28#================================================================
29# Actions
30#================================================================
31
32
33mesg :
34	@echo "Here are writing tests of DBM brothers." 1>&2
35	@echo "select a target of {all clean $(MYBINS)}." 1>&2
36
37
38all : $(MYBINS)
39
40
41clean :
42	rm -rf $(MYBINS) *.o *.exe a.out casket* *~
43
44
45distclean : clean
46
47
48
49#================================================================
50# Building binaries
51#================================================================
52
53
54tctest : tctest.c
55	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):.:.." ; PATH="$(PATH):.:.." ; \
56	  export LD_LIBRARY_PATH PATH ; ldflags=`tcucodec conf -l` ; \
57	  [ -z "$$ldflags" ] && \
58	    ldflags="-L/usr/local/lib -ltokyocabinet -lz -lpthread -lm -lc" ; \
59	  gcc -I.. -I/usr/local/include -D_GNU_SOURCE=1 \
60	    -Wall -ansi -pedantic -O3 -o $@ tctest.c \
61	    -static -L. -L.. $$ldflags
62
63
64qdbmtest : qdbmtest.c
65	gcc -I.. -I/usr/local/include -D_GNU_SOURCE=1 \
66	  -Wall -ansi -pedantic -O3 -o $@ qdbmtest.c \
67	  -static -L.. -L/usr/local/lib -lqdbm -lz -lc
68
69
70ndbmtest : ndbmtest.c
71	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
72	  -Wall -ansi -pedantic -O3 -o $@ ndbmtest.c \
73	  -static -L/usr/local/lib -lndbm -lc
74
75
76sdbmtest : sdbmtest.c
77	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
78	  -Wall -ansi -pedantic -O3 -o $@ sdbmtest.c \
79	  -static -L/usr/local/lib -lsdbm -lc
80
81
82gdbmtest : gdbmtest.c
83	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
84	  -Wall -ansi -pedantic -O3 -o $@ gdbmtest.c \
85	  -static -L/usr/local/lib -lgdbm -lc
86
87
88tdbtest : tdbtest.c
89	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
90	  -Wall -ansi -pedantic -O3 -o $@ tdbtest.c \
91	  -static -L/usr/local/lib -ltdb -lc
92
93
94cdbtest : cdbtest.c
95	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
96	  -Wall -ansi -pedantic -O3 -o $@ cdbtest.c \
97	  -static -L/usr/local/lib -lcdb -lc
98
99
100bdbtest : bdbtest.c
101	gcc -I/usr/local/bdb/include -D_GNU_SOURCE=1 \
102	  -Wall -O3 -o $@ bdbtest.c \
103	  -static -L/usr/local/bdb/lib -ldb -lpthread -lc
104
105
106maptest : maptest.cc
107	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):.:.." ; PATH="$(PATH):.:.." ; \
108	  export LD_LIBRARY_PATH PATH ; ldflags=`tcucodec conf -l` ; \
109	  [ -z "$$ldflags" ] && \
110	    ldflags="-L/usr/local/lib -ltokyocabinet -lz -lpthread -lm -lc" ; \
111	  g++ -I.. -I/usr/local/include -D_GNU_SOURCE=1 \
112	    -Wall -ansi -pedantic -O3 -o $@ maptest.cc \
113	    -static -L. -L.. -lstdc++ $$ldflags
114
115
116sqltest : sqltest.c
117	gcc -I/usr/local/include -D_GNU_SOURCE=1 \
118	  -Wall -O3 -o $@ sqltest.c \
119	  -static -L/usr/local/lib -lsqlite3 -lpthread -ldl -lc
120
121
122cmpsqltctest : cmpsqltctest.c
123	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):.:.." ; PATH="$(PATH):.:.." ; \
124	  export LD_LIBRARY_PATH PATH ; ldflags=`tcucodec conf -l` ; \
125	  [ -z "$$ldflags" ] && \
126	    ldflags="-L/usr/local/lib -ltokyocabinet -lz -lpthread -lm -lc" ; \
127	  gcc -std=c99 -I.. -I/usr/local/include -D_GNU_SOURCE=1 \
128	    -Wall -pedantic -O3 -o $@ cmpsqltctest.c \
129	    -static -L. -L.. -lsqlite3 -lpthread -ldl $$ldflags
130
131
132
133# END OF FILE
134