Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. SRC_DIRS = ./ ../../ allcodecs/
  26. VPATH = $(SRC_DIRS)
  27. CPPFLAGS += $(addprefix -I ,$(SRC_DIRS))
  28. CFLAGS += -Wall -Wextra -Wconversion \
  29. -std=c99
  30. CXXFLAGS += -Wall -Wextra -Wconversion \
  31. -std=c++11
  32. LDFLAGS += -pthread
  33. TESTHASHES = 110000000
  34. HASH_SRC := $(sort $(wildcard allcodecs/*.c allcodecs/*.cc))
  35. HASH_OBJ := $(patsubst %.c,%.o,$(HASH_SRC))
  36. .PHONY: default
  37. default: release
  38. .PHONY: all
  39. all: release
  40. collisionsTest: main.o pool.o threading.o sort.o $(HASH_OBJ)
  41. $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
  42. main.o: hashes.h xxhash.h
  43. release: CXXFLAGS += -O3
  44. release: CFLAGS += -O3
  45. release: collisionsTest
  46. debug: CXXFLAGS += -g3 -O0 -DDEBUG
  47. debug: CFLAGS += -g3 -O0 -DDEBUG
  48. debug: collisionsTest
  49. .PHONY: check
  50. check: test
  51. .PHONY: test
  52. test: debug
  53. @echo ""
  54. @echo "## $(TESTHASHES) hashes with original and 0 threads"
  55. @time ./collisionsTest --nbh=$(TESTHASHES)
  56. @echo ""
  57. @echo "## $(TESTHASHES) hashes with original and 4 threads"
  58. @time ./collisionsTest --nbh=$(TESTHASHES) --threadlog=2
  59. @echo ""
  60. .PHONY: clean
  61. clean:
  62. $(RM) *.o allcodecs/*.o
  63. $(RM) collisionsTest