Debian Codegraph @

modules/policy/lua-aho-corasick/tests/Makefile

raw
1 OS := $(shell uname)
2 ifeq ($(OS), Darwin)
3 SO_EXT := dylib
4 else
5 SO_EXT := so
6 endif
7
8 .PHONY = all clean test runtest benchmark
9
10 PROGRAM = ac_test
11 BENCHMARK = ac_bench
12 all: runtest
13
14 CXXFLAGS = -O3 -g -march=native -Wall -DDEBUG
15 MYCXXFLAGS = -MMD -I.. $(CXXFLAGS)
16 %.o : %.cxx
17 $(CXX) $< -c $(MYCXXFLAGS)
18
19 -include dep.cxx
20 SRC = test_main.cxx ac_test_simple.cxx ac_test_aggr.cxx test_bigfile.cxx
21
22 OBJ = ${SRC:.cxx=.o}
23
24 -include test_dep.txt
25 -include bench_dep.txt
26
27 $(PROGRAM) $(BENCHMARK) : testinput/text.tar testinput/image.bin
28 $(PROGRAM) : $(OBJ) ../libac.$(SO_EXT)
29 $(CXX) $(OBJ) -L.. -lac -o $@
30 -cat *.d > test_dep.txt
31
32 $(BENCHMARK) : ac_bench.o ../libac.$(SO_EXT)
33 $(CXX) ac_bench.o -L.. -lac -o $@
34 -cat *.d > bench_dep.txt
35
36 ifneq ($(OS), Darwin)
37 runtest:$(PROGRAM)
38 LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):.. ./$(PROGRAM) testinput/*
39
40 benchmark:$(BENCHMARK)
41 LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):.. ./ac_bench
42
43 else
44 runtest:$(PROGRAM)
45 DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH):.. ./$(PROGRAM) testinput/*
46
47 benchmark:$(BENCHMARK)
48 DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH):.. ./ac_bench
49
50 endif
51
52 testinput/text.tar:
53 echo "download testing files (gcc tarball)..."
54 if [ ! -d testinput ] ; then mkdir testinput; fi
55 cd testinput && \
56 curl ftp://ftp.gnu.org/gnu/gcc/gcc-1.42.tar.gz -o text.tar.gz 2>/dev/null \
57 && gzip -d text.tar.gz
58
59 testinput/image.bin:
60 echo "download testing files.."
61 if [ ! -d testinput ] ; then mkdir testinput; fi
62 curl http://www.3dvisionlive.com/sites/default/files/Curiosity_render_hiresb.jpg -o $@ 2>/dev/null
63
64 clean:
65 -rm -f *.o *.d dep.txt $(PROGRAM) $(BENCHMARK)