Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.9KB

  1. #CC=clang
  2. HASHDIR = ../src
  3. UTILS = emit_keys
  4. PROGS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \
  5. test10 test11 test12 test13 test14 test15 test16 test17 \
  6. test18 test19 test20 test21 test22 test23 test24 test25 \
  7. test26 test27 test28 test29 test30 test31 test32 test33 \
  8. test34 test35 test36 test37 test38 test39 test40 test41 \
  9. test42 test43 test44 test45 test46 test47 test48 test49 \
  10. test50 test51 test52 test53 test54 test55 test56 test57 \
  11. test58 test59 test60 test61 test62 test63 test64 test65 \
  12. test66 test67 test68 test69 test70 test71 test72 test73 \
  13. test74 test75 test76 test77 test78 test79 test80 test81 \
  14. test82 test83 test84 test85 test86 test87 test88 test89 \
  15. test90 test91 test92 test93 test94 test95 test96
  16. CFLAGS += -I$(HASHDIR)
  17. #CFLAGS += -DHASH_BLOOM=16
  18. #CFLAGS += -O2
  19. CFLAGS += -g
  20. #CFLAGS += -Wstrict-aliasing=2
  21. CFLAGS += -Wall
  22. #CFLAGS += -Wextra
  23. #CFLAGS += -std=c89
  24. CFLAGS += ${EXTRA_CFLAGS}
  25. ifeq ($(HASH_DEBUG),1)
  26. CFLAGS += -DHASH_DEBUG=1
  27. endif
  28. ifeq ($(HASH_PEDANTIC),1)
  29. CFLAGS += -pedantic
  30. endif
  31. TEST_TARGET=run_tests
  32. TESTS=./do_tests
  33. # detect Cygwin
  34. ifneq ($(strip $(shell $(CC) -v 2>&1 |grep "cygwin")),)
  35. TESTS=./do_tests.cygwin
  36. endif
  37. # detect MinGW
  38. ifneq ($(strip $(shell $(CC) -v 2>&1 |grep "mingw")),)
  39. TEST_TARGET=run_tests_mingw
  40. TESTS=./do_tests.mingw
  41. endif
  42. #detect Linux (platform specific utilities)
  43. ifneq ($(strip $(shell $(CC) -v 2>&1 |grep "linux")),)
  44. PLAT_UTILS = hashscan sleep_test
  45. endif
  46. #detect FreeBSD (platform specific utilities)
  47. ifeq ($(strip $(shell uname -s)), FreeBSD)
  48. ifeq ($(shell if [ `sysctl -n kern.osreldate` -ge 0801000 ]; then echo "ok"; fi), ok)
  49. PLAT_UTILS = hashscan sleep_test
  50. endif
  51. endif
  52. all: $(PROGS) $(UTILS) $(PLAT_UTILS) keystat $(TEST_TARGET)
  53. tests_only: $(PROGS) $(TEST_TARGET)
  54. GITIGN = .gitignore
  55. MKGITIGN = [ -f "$(GITIGN)" ] || echo "$(GITIGN)" > $(GITIGN); grep -q '^\$@$$' $(GITIGN) || echo "$@" >> $(GITIGN)
  56. debug:
  57. $(MAKE) all HASH_DEBUG=1
  58. pedantic:
  59. $(MAKE) all HASH_PEDANTIC=1
  60. cplusplus:
  61. CC="$(CXX) -x c++" $(MAKE) all
  62. thorough:
  63. $(MAKE) clean && $(MAKE) all EXTRA_CFLAGS='-pedantic'
  64. $(MAKE) clean && $(MAKE) all EXTRA_CFLAGS='-pedantic -DHASH_BLOOM=16'
  65. $(MAKE) clean && $(MAKE) tests_only EXTRA_CFLAGS='-pedantic -DHASH_BLOOM=16 -DHASH_DEBUG -DNO_DECLTYPE'
  66. $(MAKE) clean && CC="$(CXX) -x c++" $(MAKE) all EXTRA_CFLAGS='-pedantic'
  67. $(MAKE) clean && CC="$(CXX) -x c++" $(MAKE) all EXTRA_CFLAGS='-pedantic -DHASH_BLOOM=16'
  68. $(MAKE) clean && CC="$(CXX) -x c++" $(MAKE) tests_only EXTRA_CFLAGS='-pedantic -DHASH_BLOOM=16 -DHASH_DEBUG -DNO_DECLTYPE'
  69. example: example.c $(HASHDIR)/uthash.h
  70. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(@).c
  71. $(PROGS) $(UTILS) : $(HASHDIR)/uthash.h
  72. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(@).c
  73. @$(MKGITIGN)
  74. hashscan : $(HASHDIR)/uthash.h
  75. $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(@).c
  76. @$(MKGITIGN)
  77. sleep_test : $(HASHDIR)/uthash.h
  78. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_BLOOM=16 $(LDFLAGS) -o $@ $(@).c
  79. @$(MKGITIGN)
  80. keystat : $(HASHDIR)/uthash.h
  81. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_BER $(LDFLAGS) -o keystat.BER keystat.c
  82. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_FNV $(LDFLAGS) -o keystat.FNV keystat.c
  83. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_JEN $(LDFLAGS) -o keystat.JEN keystat.c
  84. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_OAT $(LDFLAGS) -o keystat.OAT keystat.c
  85. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_SAX $(LDFLAGS) -o keystat.SAX keystat.c
  86. $(CC) $(CPPFLAGS) $(CFLAGS) -DHASH_FUNCTION=HASH_SFH $(LDFLAGS) -o keystat.SFH keystat.c
  87. run_tests: $(PROGS)
  88. perl $(TESTS)
  89. run_tests_mingw: $(PROGS)
  90. /bin/bash do_tests.mingw
  91. astyle:
  92. astyle -n --style=kr --indent-switches --add-brackets *.c
  93. .PHONY: clean astyle
  94. clean:
  95. rm -f $(UTILS) $(PLAT_UTILS) $(PROGS) test*.out keystat.??? example hashscan sleep_test *.exe $(GITIGN)
  96. rm -rf *.dSYM