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