4dc5ceb0527f75febb027aebb70e26f45738db77
[ccan] / ccan / tdb / tools / Makefile
1 LDLIBS:=../../tdb.o ../../hash.o
2 CFLAGS:=-I../../.. -Wall -O3 #-g -pg
3 LDFLAGS:=-L../../..
4
5 default: replay_trace tdbtorture tdbdump tdbtool starvation mktdb
6
7 benchmark: replay_trace
8         @trap "rm -f /tmp/trace.$$$$" 0; for f in benchmarks/*.rz; do if runzip -k $$f -o /tmp/trace.$$$$ && echo -n "$$f": && ./replay_trace --quiet -n 5 replay.tdb /tmp/trace.$$$$ && rm /tmp/trace.$$$$; then rm -f /tmp/trace.$$$$; else exit 1; fi; done
9
10 REPLAY_LIBS=$(LDLIBS) ../../str_talloc.o ../../grab_file.o  ../../talloc.o ../../noerr.o
11 replay_trace: replay_trace.c keywords.c $(REPLAY_LIBS)
12         $(LINK.c) $< $(LOADLIBES) $(REPLAY_LIBS) -o $@
13
14 keywords.c: keywords.gperf
15         gperf $< > $@
16
17 check: replay_trace
18         @rm -f *.reduced_trace
19         @set -e; for f in tests/*.trace.tar.bz2; do             \
20                 tar xvfj $$f;                                   \
21                 ./replay_trace replay.tdb *.reduced_trace;      \
22                 rm -f *.reduced_trace;                          \
23         done
24
25 # Usage: make mytest.trace.tar.bz2 TRACEFILES=*.trace
26 %.trace.tar.bz2: $(patsubst %.trace,%.reduced_trace,$(wildcard $(TRACEFILES)))
27         tar cvfj $@ $^
28
29 %.reduced_trace: %.trace
30         @sed 's/\(^[0-9]* traverse\) .*/\1fn/' < $^ > $@
31
32 clean:
33         rm -f replay_trace tdbtorture tdbdump tdbtool *.o