Debian Codegraph @

third-party/xxhash/tests/collisions/Makefile

raw
1 # Brute force collision tester for 64-bit hashes
2 # Part of xxHash project
3 # Copyright (C) 2019-2021 Yann Collet
4 #
5 # GPL v2 License
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # You can contact the author at:
22 # - xxHash homepage: https://www.xxhash.com
23 # - xxHash source repository: https://github.com/Cyan4973/xxHash
24 #
25
26 SRC_DIRS = ./ ../../ allcodecs/
27 VPATH = $(SRC_DIRS)
28 CPPFLAGS += $(addprefix -I ,$(SRC_DIRS))
29 CFLAGS += -Wall -Wextra -Wconversion \
30 -std=c11
31 CXXFLAGS += -Wall -Wextra -Wconversion \
32 -std=c++11
33 LDFLAGS += -pthread
34 TESTHASHES = 3200000
35
36 HASH_SRC := $(sort $(wildcard allcodecs/*.c allcodecs/*.cc))
37 HASH_OBJ := $(patsubst %.c,%.o,$(HASH_SRC))
38
39
40 .PHONY: default
41 default: release
42
43 .PHONY: all
44 all: release
45
46 collisionsTest: main.o pool.o threading.o sort.o $(HASH_OBJ)
47 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
48
49 main.o: hashes.h xxhash.h
50
51 release: CXXFLAGS += -O3
52 release: CFLAGS += -O3
53 release: collisionsTest
54
55 debug: CXXFLAGS += -g3 -O0 -DDEBUG
56 debug: CFLAGS += -g3 -O0 -DDEBUG
57 debug: collisionsTest
58
59 .PHONY: check
60 check: test
61
62 .PHONY: test
63 test: debug
64 @echo ""
65 @echo "## $(TESTHASHES) hashes"
66 @time ./collisionsTest --nbh=$(TESTHASHES)
67 @echo ""
68 @echo "## $(TESTHASHES) hashes with filter"
69 @time ./collisionsTest --nbh=$(TESTHASHES) --filter
70 @echo ""
71 @echo "## $(TESTHASHES) hashes with 2 threads"
72 @time ./collisionsTest --nbh=$(TESTHASHES) --threadlog=1
73 @echo ""
74
75 .PHONY: clean
76 clean:
77 $(RM) *.o allcodecs/*.o
78 $(RM) collisionsTest