Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 -rp 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. WARNING_BORDER_LONG =**********************************************************************************\n
  49. CTR_DRBG_128_BIT_KEY_WARN_L1=**** WARNING! MBEDTLS_CTR_DRBG_USE_128_BIT_KEY defined! ****\n
  50. CTR_DRBG_128_BIT_KEY_WARN_L2=**** Using 128-bit keys for CTR_DRBG limits the security of generated ****\n
  51. CTR_DRBG_128_BIT_KEY_WARN_L3=**** keys and operations that use random values generated to 128-bit security ****\n
  52. CTR_DRBG_128_BIT_KEY_WARNING=\n$(WARNING_BORDER_LONG)$(CTR_DRBG_128_BIT_KEY_WARN_L1)$(CTR_DRBG_128_BIT_KEY_WARN_L2)$(CTR_DRBG_128_BIT_KEY_WARN_L3)$(WARNING_BORDER_LONG)
  53. # Post build steps
  54. post_build:
  55. ifndef WINDOWS
  56. # If 128-bit keys are configured for CTR_DRBG, display an appropriate warning
  57. -scripts/config.pl get MBEDTLS_CTR_DRBG_USE_128_BIT_KEY && ([ $$? -eq 0 ]) && \
  58. echo '$(CTR_DRBG_128_BIT_KEY_WARNING)'
  59. # If NULL Entropy is configured, display an appropriate warning
  60. -scripts/config.pl get MBEDTLS_TEST_NULL_ENTROPY && ([ $$? -eq 0 ]) && \
  61. echo '$(NULL_ENTROPY_WARNING)'
  62. endif
  63. clean:
  64. $(MAKE) -C library clean
  65. $(MAKE) -C programs clean
  66. $(MAKE) -C tests clean
  67. ifndef WINDOWS
  68. find . \( -name \*.gcno -o -name \*.gcda -o -name \*.info \) -exec rm {} +
  69. endif
  70. check: lib tests
  71. $(MAKE) -C tests check
  72. test: check
  73. ifndef WINDOWS
  74. # note: for coverage testing, build with:
  75. # make CFLAGS='--coverage -g3 -O0'
  76. covtest:
  77. $(MAKE) check
  78. programs/test/selftest
  79. tests/compat.sh
  80. tests/ssl-opt.sh
  81. lcov:
  82. rm -rf Coverage
  83. lcov --capture --initial --directory library -o files.info
  84. lcov --capture --directory library -o tests.info
  85. lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
  86. lcov --remove all.info -o final.info '*.h'
  87. gendesc tests/Descriptions.txt -o descriptions
  88. genhtml --title "mbed TLS" --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage final.info
  89. rm -f files.info tests.info all.info final.info descriptions
  90. apidoc:
  91. mkdir -p apidoc
  92. cd doxygen && doxygen mbedtls.doxyfile
  93. apidoc_clean:
  94. rm -rf apidoc
  95. endif
  96. ## Editor navigation files
  97. C_SOURCE_FILES = $(wildcard include/*/*.h library/*.[hc] programs/*/*.[hc] tests/suites/*.function)
  98. tags: $(C_SOURCE_FILES)
  99. ctags -o $@ $(C_SOURCE_FILES)
  100. TAGS: $(C_SOURCE_FILES)
  101. etags -o $@ $(C_SOURCE_FILES)
  102. GPATH GRTAGS GSYMS GTAGS: $(C_SOURCE_FILES)
  103. ls $(C_SOURCE_FILES) | gtags -f - --gtagsconf .globalrc