Makefile 2.0 KB

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