summaryrefslogtreecommitdiffstats
path: root/contrib/libio/dbz/Makefile.in
blob: 6d6dc2874855fcb361ed4617beb80a7aa2f531bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
srcdir = .
CFLAGS = -g
C_FLAGS = $(CFLAGS) -I$(srcdir) -I.. -I$(srcdir)/.. -DDBZ_FINISH='_IO_flush_all()'
CC = `if [ -f ../../../gcc/gcc ] ; \
	then echo ../../../gcc/gcc -B../../../gcc/ ; \
	else echo gcc ; fi`
LIBIO = ../libio.a ../../libiberty/libiberty.a
LIBS = $(LIBIO)
# LIBS = ../libcnews.a
DBM =
RFC = -DHAVERFCIZE
CASE = case.o
DEBUG = -DDBZDEBUG
LINTFLAGS = -h $(DEBUG) $(RFC) -I$(srcdir)
LDFLAGS =
# =()<NEWSBIN = @<NEWSBIN>@>()=
NEWSBIN = /usr/lib/newsbin
# workaround for System V make bug
SHELL = /bin/sh

# database sizes for performance tests, regression, and regression prime-find
TSIZE=12007
RSIZE=4019
RPSIZE=2679

#### host and target dependent Makefile fragments come in here.
##

# history files for regression and performance tests
RHIST=hist3.3
R2HIST=hist10
THIST=hist13

#all:	dbz
all:
install:
install-info:
info:

check: r
	$(MAKE) rclean

bininstall:	dbz
	cp dbz $(NEWSBIN)

cmp:	dbz
	cmp dbz $(NEWSBIN)/dbz

newsinstall:
	: nothing

u:	dbz.o
	ar ruv ../libcnews.a dbz.o
	cmp dbz.h ../h/dbz.h

t:	tdbz fake

lint:
	lint $(LINTFLAGS) dbzmain.c dbz.c

.c.o:
	$(CC) $(C_FLAGS) -c $<

rdbz.o:	rdbz.c
	$(CC) $(C_FLAGS) $(DEBUG) -DDEFSIZE=$(RSIZE) -c rdbz.c

rdbzmain.o: rdbzmain.c
	$(CC) $(C_FLAGS) $(RFC) -c rdbzmain.c

tdbz.o:	$(srcdir)/dbz.c
	cp $(srcdir)/dbz.c tdbz.c
	$(CC) $(C_FLAGS) -DDEFSIZE=$(TSIZE) -c tdbz.c
	rm tdbz.c

dbz:	dbzmain.o $(CASE)
	$(CC) $(LDFLAGS) dbzmain.o $(CASE) $(PRE) $(DBM) $(LIBS) $(POST) -o $@

tdbz:	dbzmain.o tdbz.o $(CASE)
	$(CC) $(LDFLAGS) dbzmain.o tdbz.o $(CASE) $(PRE) $(LIBS) $(POST) -o $@

rdbz:	rdbzmain.o rdbz.o $(CASE)
	$(CC) $(LDFLAGS) rdbzmain.o rdbz.o $(CASE) $(PRE) $(LIBS) $(POST) -o $@

fake:	fake.o random.o
	$(CC) $(LDFLAGS) fake.o random.o $(PRE) $(LIBS) $(POST) -o $@

byteflip:	byteflip.o
	$(CC) $(LDFLAGS) byteflip.o $(PRE) $(LIBS) $(POST) -o $@

hist10:	fake
	./fake -t -e 75 10000 >$@

hist3.3:	fake
	./fake -t -e 75 3300 >$@

hist13:	fake
	./fake -t -e 75 13000 >$@

r:	$(srcdir)/getmap $(srcdir)/revbytes $(srcdir)/altbytes stamp-r8
	: success!

stamp-r0:
	: 'WARNING:  creates about 2MB of debris; do "make rclean" afterward'
	rm -f dbase dbase[23] dbase.* dbase[23].*
	test ! -d xx || rmdir xx
	@touch stamp-r0

stamp-r1: $(RHIST) $(R2HIST) stamp-r0
	: crude check of synthetic history file
	( sed 25q $(RHIST) ; tail -25 $(RHIST) ) >histjunk
	cmp histjunk $(srcdir)/firstlast25
	rm histjunk
	@touch stamp-r1

r2a: rdbz stamp-r1
	: basic tests, exercising as many options as possible
	cp $(RHIST) dbase
	mkdir xx
	chmod -w xx
	./rdbz -E 1000 -0 -M -i -S -u -U -C xx dbase
	rmdir xx
	sed '/>	0/d' $(RHIST) >dbase.used
	test "`cat dbase.used | wc -l`" -eq "`sed -n '2s/ .*//p' dbase.dir`" ;

stamp-r2: r2a
	cp $(RHIST) dbase2
	./rdbz -E 1000 -0 -p $(RPSIZE) -t '	' dbase2
	cmp $(RHIST) dbase
	cmp dbase dbase2
	cmp dbase.dir dbase2.dir
	cmp dbase.pag dbase2.pag
	./rdbz -E 1000 -0 -c dbase
	./rdbz -E 1000 -0 -c -i -q -M -U dbase
	@touch stamp-r2

stamp-r3: stamp-r2
	: build a database and then add to it
	sed 1000q $(RHIST) >dbase2
	sed 1,1000d $(RHIST) >dbase2.add
	./rdbz -E 1000 -0 dbase2
	./rdbz -E 1000 -0 -a dbase2 dbase2.add
	cmp dbase dbase2
	cmp dbase.dir dbase2.dir
	cmp dbase.pag dbase2.pag
	@touch stamp-r3

stamp-r4: stamp-r3
	: build based on existing one, test extraction and readonly files
	./rdbz -E 1000 -0 -f dbase dbase2
	test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$1}' dbase2.dir`" ;
	test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$2}' dbase2.dir`" ;
	chmod -w dbase2.dir dbase2.pag
	./rdbz -E 1000 -x dbase2 dbase >dbase.temp
	cmp dbase.used dbase.temp
	@touch stamp-r4

stamp-r5: stamp-r4
	: try some small case perversions
	sed 's/\(@[^ 	]*\)A/\1a/' dbase >dbase.ick
	./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
	cmp dbase.used dbase.temp
	sed -n 's/A\([^ 	]*@\)/a\1/p' dbase >dbase.ick
	./rdbz -x dbase2 dbase.ick >dbase.temp
	test ! -s dbase.temp ;
	rm -f dbase2.dir dbase2.pag
	@touch stamp-r5

stamp-r6: stamp-r5
	: try it without tags, case-insensitive, with case perversions
	./rdbz -E 1000 -0 -p '0 b 1' dbase2
	tr '[A-M][n-z]' '[a-m][N-Z]' <dbase2 >dbase.ick
	./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
	cmp dbase.used dbase.temp
	rm -f dbase.temp dbase.ick
	@touch stamp-r6

stamp-r7: byteflip stamp-r6
	: test various perversions of byte ordering
	awk -f $(srcdir)/revbytes dbase.dir >dbase2.dir
	./byteflip `$(srcdir)/getmap dbase.dir` `$(srcdir)/getmap dbase2.dir` <dbase.pag >dbase2.pag
	cp dbase dbase2
	./rdbz -E 1000 -0 -c dbase2
	awk -f $(srcdir)/altbytes dbase.dir >dbase2.dir
	dd conv=swab <dbase.pag >dbase2.pag
	./rdbz -E 1000 -0 -c dbase2
	cp dbase2 dbase3
	./rdbz -E 1000 -0 -f dbase2 dbase3
	./rdbz -E 1000 -0 -c dbase3
	test " `$(srcdir)/getmap dbase2.dir`" = " `$(srcdir)/getmap dbase3.dir`" ;
	@touch stamp-r7

stamp-r8: stamp-r7
	: test massive overflow, throw in case sensitivity and tag mask
	cp $(R2HIST) dbase
	./rdbz -E 1000 -0 -p '0 0 7ffc0000' dbase
	./rdbz -E 1000 -0 -cq dbase
	sed 100q dbase | egrep '[aA].*	' | tr aA Aa >dbase.ick
	./rdbz -x dbase dbase.ick >dbase.temp
	test ! -s dbase.temp ;
	@touch stamp-r8

rclean:
	rm -f dbase dbase[23] dbase.* dbase[23].* fake fake.o random.o
	rm -f rdbz rdbz.o rdbzmain.o $(RHIST) $(R2HIST) byteflip byteflip.o
	rm -f histjunk core stamp-r? *~
	test ! -d xx || rmdir xx

mostlyclean: rclean
	rm -f *.o [a-z]dbz [a-z][a-z]dbz junk* PostScript.out
	rm -f hist* dbase* *.bak mon.out gmon.out core dbm.h

clean:	mostlyclean
	rm -f dbz

distclean: clean
	rm -rf Makefile config.status rdbz.c rdbzmain.c

maintainer-clean realclean: distclean
OpenPOWER on IntegriCloud