Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. DESTDIR=/usr/local
  2. PREFIX=mbedtls_
  3. .SILENT:
  4. .PHONY: all no_test programs lib tests install uninstall clean test check covtest lcov apidoc apidoc_clean
  5. all: programs tests
  6. $(MAKE) post_build
  7. no_test: programs
  8. programs: lib
  9. $(MAKE) -C programs
  10. lib:
  11. $(MAKE) -C library
  12. tests: lib
  13. $(MAKE) -C tests
  14. ifndef WINDOWS
  15. install: no_test
  16. mkdir -p $(DESTDIR)/include/mbedtls
  17. cp -r include/mbedtls $(DESTDIR)/include
  18. mkdir -p $(DESTDIR)/lib
  19. cp -RP library/libmbedtls.* $(DESTDIR)/lib
  20. cp -RP library/libmbedx509.* $(DESTDIR)/lib
  21. cp -RP library/libmbedcrypto.* $(DESTDIR)/lib
  22. mkdir -p $(DESTDIR)/bin
  23. for p in programs/*/* ; do \
  24. if [ -x $$p ] && [ ! -d $$p ] ; \
  25. then \
  26. f=$(PREFIX)`basename $$p` ; \
  27. cp $$p $(DESTDIR)/bin/$$f ; \
  28. fi \
  29. done
  30. uninstall:
  31. rm -rf $(DESTDIR)/include/mbedtls
  32. rm -f $(DESTDIR)/lib/libmbedtls.*
  33. rm -f $(DESTDIR)/lib/libmbedx509.*
  34. rm -f $(DESTDIR)/lib/libmbedcrypto.*
  35. for p in programs/*/* ; do \
  36. if [ -x $$p ] && [ ! -d $$p ] ; \
  37. then \
  38. f=$(PREFIX)`basename $$p` ; \
  39. rm -f $(DESTDIR)/bin/$$f ; \
  40. fi \
  41. done
  42. endif
  43. WARNING_BORDER =*******************************************************\n
  44. NULL_ENTROPY_WARN_L1=**** WARNING! MBEDTLS_TEST_NULL_ENTROPY defined! ****\n
  45. NULL_ENTROPY_WARN_L2=**** THIS BUILD HAS NO DEFINED ENTROPY SOURCES ****\n
  46. NULL_ENTROPY_WARN_L3=**** AND IS *NOT* SUITABLE FOR PRODUCTION USE ****\n
  47. NULL_ENTROPY_WARNING=\n$(WARNING_BORDER)$(NULL_ENTROPY_WARN_L1)$(NULL_ENTROPY_WARN_L2)$(NULL_ENTROPY_WARN_L3)$(WARNING_BORDER)
  48. # Post build steps
  49. post_build:
  50. ifndef WINDOWS
  51. # If NULL Entropy is configured, display an appropriate warning
  52. -scripts/config.pl get MBEDTLS_TEST_NULL_ENTROPY && ([ $$? -eq 0 ]) && \
  53. echo '$(NULL_ENTROPY_WARNING)'
  54. endif
  55. clean:
  56. $(MAKE) -C library clean
  57. $(MAKE) -C programs clean
  58. $(MAKE) -C tests clean
  59. ifndef WINDOWS
  60. find . \( -name \*.gcno -o -name \*.gcda -o -name \*.info \) -exec rm {} +
  61. endif
  62. check: lib tests
  63. $(MAKE) -C tests check
  64. test: check
  65. ifndef WINDOWS
  66. # note: for coverage testing, build with:
  67. # make CFLAGS='--coverage -g3 -O0'
  68. covtest:
  69. $(MAKE) check
  70. programs/test/selftest
  71. tests/compat.sh
  72. tests/ssl-opt.sh
  73. lcov:
  74. rm -rf Coverage
  75. lcov --capture --initial --directory library -o files.info
  76. lcov --capture --directory library -o tests.info
  77. lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
  78. lcov --remove all.info -o final.info '*.h'
  79. gendesc tests/Descriptions.txt -o descriptions
  80. genhtml --title "mbed TLS" --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage final.info
  81. rm -f files.info tests.info all.info final.info descriptions
  82. apidoc:
  83. mkdir -p apidoc
  84. doxygen doxygen/mbedtls.doxyfile
  85. apidoc_clean:
  86. rm -rf apidoc
  87. endif