Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
  2. # To compile on MinGW: add "-lws2_32" to LDFLAGS
  3. # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS
  4. CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement \
  5. -Wno-unused-function -Wno-unused-value
  6. OFLAGS = -O
  7. LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
  8. APPS = test_suite_aes test_suite_arc4 \
  9. test_suite_base64 test_suite_camellia \
  10. test_suite_cipher.aes test_suite_cipher.camellia \
  11. test_suite_cipher.des test_suite_debug \
  12. test_suite_des test_suite_dhm \
  13. test_suite_error test_suite_hmac_shax \
  14. test_suite_md test_suite_mdx \
  15. test_suite_mpi test_suite_pkcs1_v21 \
  16. test_suite_rsa test_suite_shax \
  17. test_suite_x509parse test_suite_xtea \
  18. test_suite_version
  19. .SILENT:
  20. all: $(APPS)
  21. test_suite_cipher.aes.c : suites/test_suite_cipher.function suites/test_suite_cipher.aes.data scripts/generate_code.pl suites/helpers.function
  22. echo " Generate $@"
  23. scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.aes
  24. test_suite_cipher.camellia.c : suites/test_suite_cipher.function suites/test_suite_cipher.camellia.data scripts/generate_code.pl suites/helpers.function
  25. echo " Generate $@"
  26. scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.camellia
  27. test_suite_cipher.des.c : suites/test_suite_cipher.function suites/test_suite_cipher.des.data scripts/generate_code.pl suites/helpers.function
  28. echo " Generate $@"
  29. scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.des
  30. %.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function
  31. echo " Generate $@"
  32. scripts/generate_code.pl suites $* $*
  33. test_suite_aes: test_suite_aes.c ../library/libpolarssl.a
  34. echo " CC $@.c"
  35. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  36. test_suite_arc4: test_suite_arc4.c ../library/libpolarssl.a
  37. echo " CC $@.c"
  38. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  39. test_suite_base64: test_suite_base64.c ../library/libpolarssl.a
  40. echo " CC $@.c"
  41. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  42. test_suite_camellia: test_suite_camellia.c ../library/libpolarssl.a
  43. echo " CC $@.c"
  44. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  45. test_suite_cipher.aes: test_suite_cipher.aes.c ../library/libpolarssl.a
  46. echo " CC $@.c"
  47. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  48. test_suite_cipher.camellia: test_suite_cipher.camellia.c ../library/libpolarssl.a
  49. echo " CC $@.c"
  50. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  51. test_suite_cipher.des: test_suite_cipher.des.c ../library/libpolarssl.a
  52. echo " CC $@.c"
  53. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  54. test_suite_des: test_suite_des.c ../library/libpolarssl.a
  55. echo " CC $@.c"
  56. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  57. test_suite_dhm: test_suite_dhm.c ../library/libpolarssl.a
  58. echo " CC $@.c"
  59. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  60. test_suite_error: test_suite_error.c ../library/libpolarssl.a
  61. echo " CC $@.c"
  62. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  63. test_suite_hmac_shax: test_suite_hmac_shax.c ../library/libpolarssl.a
  64. echo " CC $@.c"
  65. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  66. test_suite_md: test_suite_md.c ../library/libpolarssl.a
  67. echo " CC $@.c"
  68. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  69. test_suite_mdx: test_suite_mdx.c ../library/libpolarssl.a
  70. echo " CC $@.c"
  71. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  72. test_suite_mpi: test_suite_mpi.c ../library/libpolarssl.a
  73. echo " CC $@.c"
  74. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  75. test_suite_pkcs1_v21: test_suite_pkcs1_v21.c ../library/libpolarssl.a
  76. echo " CC $@.c"
  77. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  78. test_suite_rsa: test_suite_rsa.c ../library/libpolarssl.a
  79. echo " CC $@.c"
  80. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  81. test_suite_shax: test_suite_shax.c ../library/libpolarssl.a
  82. echo " CC $@.c"
  83. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  84. test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a
  85. echo " CC $@.c"
  86. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  87. test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a
  88. echo " CC $@.c"
  89. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  90. test_suite_debug: test_suite_debug.c ../library/libpolarssl.a
  91. echo " CC $@.c"
  92. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  93. test_suite_version: test_suite_version.c ../library/libpolarssl.a
  94. echo " CC $@.c"
  95. $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
  96. clean:
  97. rm -f $(APPS) *.c
  98. check: $(APPS)
  99. echo "Running checks (Success if all tests PASSED)"
  100. for i in $(APPS); \
  101. do \
  102. echo " - $${i}"; \
  103. ./$${i} | grep -v 'PASS$$' | grep -v -- '-----' | grep -v '^$$'; \
  104. echo ""; \
  105. done