Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. TESTS=test-base64 test-md4 test-md5 test-milenage test-ms_funcs \
  2. test-bitfield \
  3. test-printf \
  4. test-rsa-sig-ver \
  5. test-sha1 \
  6. test-sha256 test-aes test-asn1 test-x509 test-x509v3 test-list test-rc4
  7. all: $(TESTS)
  8. ifndef CC
  9. CC=gcc
  10. endif
  11. ifndef LDO
  12. LDO=$(CC)
  13. endif
  14. ifndef CFLAGS
  15. CFLAGS = -MMD -O2 -Wall -g
  16. endif
  17. CFLAGS += -I../src
  18. CFLAGS += -I../src/utils
  19. SLIBS = ../src/utils/libutils.a
  20. DLIBS = ../src/crypto/libcrypto.a \
  21. ../src/tls/libtls.a
  22. LIBS = $(SLIBS) $(DLIBS)
  23. LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)
  24. # glibc < 2.17 needs -lrt for clock_gettime()
  25. LLIBS += -lrt
  26. ../src/utils/libutils.a:
  27. $(MAKE) -C ../src/utils
  28. ../src/crypto/libcrypto.a:
  29. $(MAKE) -C ../src/crypto
  30. ../src/tls/libtls.a:
  31. $(MAKE) -C ../src/tls
  32. test-aes: test-aes.o $(LIBS)
  33. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  34. test-asn1: test-asn1.o $(LIBS)
  35. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  36. test-base64: test-base64.o $(LIBS)
  37. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  38. test-bitfield: test-bitfield.o $(LIBS)
  39. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  40. test-https: test-https.o $(LIBS)
  41. $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
  42. test-list: test-list.o $(LIBS)
  43. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  44. test-md4: test-md4.o $(LIBS)
  45. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  46. test-md5: test-md5.o $(LIBS)
  47. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  48. test-milenage: test-milenage.o $(LIBS)
  49. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  50. test-ms_funcs: test-ms_funcs.o $(LIBS)
  51. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  52. test-printf: test-printf.o $(LIBS)
  53. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  54. test-rc4: test-rc4.o $(LIBS)
  55. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  56. test-rsa-sig-ver: test-rsa-sig-ver.o $(LIBS)
  57. $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
  58. test-sha1: test-sha1.o $(LIBS)
  59. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  60. test-sha256: test-sha256.o $(LIBS)
  61. $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
  62. test-x509: test-x509.o $(LIBS)
  63. $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
  64. test-x509v3: test-x509v3.o $(LIBS)
  65. $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
  66. run-tests: $(TESTS)
  67. ./test-aes
  68. ./test-bitfield
  69. ./test-list
  70. ./test-md4
  71. ./test-md5
  72. ./test-milenage
  73. ./test-printf
  74. ./test-rsa-sig-ver
  75. ./test-sha1
  76. ./test-sha256
  77. @echo
  78. @echo All tests completed successfully.
  79. clean:
  80. $(MAKE) -C ../src clean
  81. rm -f $(TESTS) *~ *.o *.d
  82. rm -f test-https
  83. rm -f test_x509v3_nist.out.*
  84. rm -f test_x509v3_nist2.out.*
  85. -include $(OBJS:%.o=%.d)