blob: d475868a710e705b284f9e0cd6ea0eb46d2a4ba6 [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
Andres AG7aa5fa12016-08-25 16:36:16 +01009all: programs tests
10 $(MAKE) post_build
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020011
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020012no_test: programs
13
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020014programs: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020015 $(MAKE) -C programs
Paul Bakkerf9964ab2012-04-05 12:07:50 +000016
17lib:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020018 $(MAKE) -C library
19
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020020tests: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020021 $(MAKE) -C tests
Paul Bakkerf9964ab2012-04-05 12:07:50 +000022
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020023ifndef WINDOWS
Manuel Pégourié-Gonnard99839932015-08-03 10:34:09 +020024install: no_test
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000025 mkdir -p $(DESTDIR)/include/mbedtls
26 cp -r include/mbedtls $(DESTDIR)/include
Paul Bakker5121ce52009-01-03 21:22:43 +000027
28 mkdir -p $(DESTDIR)/lib
Manuel Pégourié-Gonnard52a50792015-07-27 10:36:12 +020029 cp -RP library/libmbedtls.* $(DESTDIR)/lib
30 cp -RP library/libmbedx509.* $(DESTDIR)/lib
31 cp -RP library/libmbedcrypto.* $(DESTDIR)/lib
Paul Bakker5121ce52009-01-03 21:22:43 +000032
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
Paul Bakker9a736322012-11-14 12:39:52 +000042uninstall:
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000043 rm -rf $(DESTDIR)/include/mbedtls
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010044 rm -f $(DESTDIR)/lib/libmbedtls.*
Manuel Pégourié-Gonnard52a50792015-07-27 10:36:12 +020045 rm -f $(DESTDIR)/lib/libmbedx509.*
46 rm -f $(DESTDIR)/lib/libmbedcrypto.*
Paul Bakker9a736322012-11-14 12:39:52 +000047
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
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020055endif
Paul Bakker9a736322012-11-14 12:39:52 +000056
Simon Butcher1ceab6e2016-06-21 10:14:00 +010057WARNING_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:
Simon Butchercff625f2016-06-27 15:15:11 +010066ifndef WINDOWS
Simon Butcher1ceab6e2016-06-21 10:14:00 +010067 # 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)'
Simon Butchercff625f2016-06-27 15:15:11 +010070endif
Simon Butcher1ceab6e2016-06-21 10:14:00 +010071
Paul Bakker5121ce52009-01-03 21:22:43 +000072clean:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020073 $(MAKE) -C library clean
74 $(MAKE) -C programs clean
75 $(MAKE) -C tests clean
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020076ifndef WINDOWS
Paul Bakkerbd3b3592016-07-13 16:37:32 +010077 find . \( -name \*.gcno -o -name \*.gcda -o -name \*.info \) -exec rm {} +
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020078endif
Paul Bakker5121ce52009-01-03 21:22:43 +000079
Andres AGc49b8082016-08-31 16:10:45 +010080check: lib tests
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020081 $(MAKE) -C tests check
Paul Bakker37ca75d2011-01-06 12:28:03 +000082
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020083test: check
Manuel Pégourié-Gonnard6529ff02014-01-31 13:41:07 +010084
Manuel Pégourié-Gonnard85113842015-07-08 21:20:03 +010085ifndef WINDOWS
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010086# note: for coverage testing, build with:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020087# make CFLAGS='--coverage -g3 -O0'
Manuel Pégourié-Gonnard79d090b2014-02-26 19:39:01 +010088covtest:
Manuel Pégourié-Gonnardfc367082015-06-26 16:50:24 +020089 $(MAKE) check
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010090 programs/test/selftest
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +010091 tests/compat.sh
92 tests/ssl-opt.sh
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010093
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010094lcov:
95 rm -rf Coverage
Manuel Pégourié-Gonnard53c6e962014-06-13 12:22:07 +020096 lcov --capture --initial --directory library -o files.info
97 lcov --capture --directory library -o tests.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +020098 lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
99 lcov --remove all.info -o final.info '*.h'
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +0100100 gendesc tests/Descriptions.txt -o descriptions
Manuel Pégourié-Gonnardafe8f532015-01-23 17:40:33 +0000101 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 +0200102 rm -f files.info tests.info all.info final.info descriptions
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +0100103
Paul Bakker37ca75d2011-01-06 12:28:03 +0000104apidoc:
105 mkdir -p apidoc
Manuel Pégourié-Gonnardf234ff82015-01-22 17:01:27 +0000106 doxygen doxygen/mbedtls.doxyfile
Paul Bakker37ca75d2011-01-06 12:28:03 +0000107
108apidoc_clean:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200109 rm -rf apidoc
110endif