blob: 39fc342bfc69064291e05f56d339e1e1e08da7e6 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001
2DESTDIR=/usr/local
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +01003PREFIX=mbedtls_
Paul Bakker5121ce52009-01-03 21:22:43 +00004
5.SILENT:
6
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +02007.PHONY: all no_test programs lib tests install uninstall clean test check covtest lcov apidoc apidoc_clean
Paul Bakker5121ce52009-01-03 21:22:43 +00008
Simon Butcher1ceab6e2016-06-21 10:14:00 +01009all: programs tests post_build
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020010
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020011no_test: programs
12
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020013programs: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020014 $(MAKE) -C programs
Paul Bakkerf9964ab2012-04-05 12:07:50 +000015
16lib:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020017 $(MAKE) -C library
18
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020019tests: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020020 $(MAKE) -C tests
Paul Bakkerf9964ab2012-04-05 12:07:50 +000021
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020022ifndef WINDOWS
Manuel Pégourié-Gonnard99839932015-08-03 10:34:09 +020023install: no_test
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000024 mkdir -p $(DESTDIR)/include/mbedtls
25 cp -r include/mbedtls $(DESTDIR)/include
Paul Bakker5121ce52009-01-03 21:22:43 +000026
27 mkdir -p $(DESTDIR)/lib
Manuel Pégourié-Gonnard52a50792015-07-27 10:36:12 +020028 cp -RP library/libmbedtls.* $(DESTDIR)/lib
29 cp -RP library/libmbedx509.* $(DESTDIR)/lib
30 cp -RP library/libmbedcrypto.* $(DESTDIR)/lib
Paul Bakker5121ce52009-01-03 21:22:43 +000031
32 mkdir -p $(DESTDIR)/bin
33 for p in programs/*/* ; do \
34 if [ -x $$p ] && [ ! -d $$p ] ; \
35 then \
36 f=$(PREFIX)`basename $$p` ; \
37 cp $$p $(DESTDIR)/bin/$$f ; \
38 fi \
39 done
40
Paul Bakker9a736322012-11-14 12:39:52 +000041uninstall:
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000042 rm -rf $(DESTDIR)/include/mbedtls
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010043 rm -f $(DESTDIR)/lib/libmbedtls.*
Manuel Pégourié-Gonnard52a50792015-07-27 10:36:12 +020044 rm -f $(DESTDIR)/lib/libmbedx509.*
45 rm -f $(DESTDIR)/lib/libmbedcrypto.*
Paul Bakker9a736322012-11-14 12:39:52 +000046
47 for p in programs/*/* ; do \
48 if [ -x $$p ] && [ ! -d $$p ] ; \
49 then \
50 f=$(PREFIX)`basename $$p` ; \
51 rm -f $(DESTDIR)/bin/$$f ; \
52 fi \
53 done
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020054endif
Paul Bakker9a736322012-11-14 12:39:52 +000055
Simon Butcher1ceab6e2016-06-21 10:14:00 +010056WARNING_BORDER =*******************************************************\n
57NULL_ENTROPY_WARN_L1=**** WARNING! MBEDTLS_TEST_NULL_ENTROPY defined! ****\n
58NULL_ENTROPY_WARN_L2=**** THIS BUILD HAS NO DEFINED ENTROPY SOURCES ****\n
59NULL_ENTROPY_WARN_L3=**** AND IS *NOT* SUITABLE FOR PRODUCTION USE ****\n
60
61NULL_ENTROPY_WARNING=\n$(WARNING_BORDER)$(NULL_ENTROPY_WARN_L1)$(NULL_ENTROPY_WARN_L2)$(NULL_ENTROPY_WARN_L3)$(WARNING_BORDER)
62
63# Post build steps
64post_build:
Simon Butchercff625f2016-06-27 15:15:11 +010065ifndef WINDOWS
Simon Butcher1ceab6e2016-06-21 10:14:00 +010066 # If NULL Entropy is configured, display an appropriate warning
67 -scripts/config.pl get MBEDTLS_TEST_NULL_ENTROPY && ([ $$? -eq 0 ]) && \
68 echo '$(NULL_ENTROPY_WARNING)'
Simon Butchercff625f2016-06-27 15:15:11 +010069endif
Simon Butcher1ceab6e2016-06-21 10:14:00 +010070
Paul Bakker5121ce52009-01-03 21:22:43 +000071clean:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020072 $(MAKE) -C library clean
73 $(MAKE) -C programs clean
74 $(MAKE) -C tests clean
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020075ifndef WINDOWS
Paul Bakkerbd3b3592016-07-13 16:37:32 +010076 find . \( -name \*.gcno -o -name \*.gcda -o -name \*.info \) -exec rm {} +
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020077endif
Paul Bakker5121ce52009-01-03 21:22:43 +000078
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020079check: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020080 $(MAKE) -C tests check
Paul Bakker37ca75d2011-01-06 12:28:03 +000081
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020082test: check
Manuel Pégourié-Gonnard6529ff02014-01-31 13:41:07 +010083
Manuel Pégourié-Gonnard85113842015-07-08 21:20:03 +010084ifndef WINDOWS
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010085# note: for coverage testing, build with:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020086# make CFLAGS='--coverage -g3 -O0'
Manuel Pégourié-Gonnard79d090b2014-02-26 19:39:01 +010087covtest:
Manuel Pégourié-Gonnardfc367082015-06-26 16:50:24 +020088 $(MAKE) check
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010089 programs/test/selftest
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +010090 tests/compat.sh
91 tests/ssl-opt.sh
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010092
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010093lcov:
94 rm -rf Coverage
Manuel Pégourié-Gonnard53c6e962014-06-13 12:22:07 +020095 lcov --capture --initial --directory library -o files.info
96 lcov --capture --directory library -o tests.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +020097 lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
98 lcov --remove all.info -o final.info '*.h'
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010099 gendesc tests/Descriptions.txt -o descriptions
Manuel Pégourié-Gonnardafe8f532015-01-23 17:40:33 +0000100 genhtml --title "mbed TLS" --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage final.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +0200101 rm -f files.info tests.info all.info final.info descriptions
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +0100102
Paul Bakker37ca75d2011-01-06 12:28:03 +0000103apidoc:
104 mkdir -p apidoc
Manuel Pégourié-Gonnardf234ff82015-01-22 17:01:27 +0000105 doxygen doxygen/mbedtls.doxyfile
Paul Bakker37ca75d2011-01-06 12:28:03 +0000106
107apidoc_clean:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200108 rm -rf apidoc
109endif