blob: 1c715a6a4f8ab72a4a481a316ba2e86e20f8c537 [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
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +02009all: programs tests
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
23install: all
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 ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010038 ln -sf $$f $(DESTDIR)/bin/$$o ; \
Paul Bakker5121ce52009-01-03 21:22:43 +000039 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 ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010053 rm -f $(DESTDIR)/bin/$$o ; \
Paul Bakker9a736322012-11-14 12:39:52 +000054 fi \
55 done
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020056endif
Paul Bakker9a736322012-11-14 12:39:52 +000057
Paul Bakker5121ce52009-01-03 21:22:43 +000058clean:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020059 $(MAKE) -C library clean
60 $(MAKE) -C programs clean
61 $(MAKE) -C tests clean
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020062ifndef WINDOWS
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010063 find . \( -name \*.gcno -o -name \*.gcda -o -name *.info \) -exec rm {} +
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020064endif
Paul Bakker5121ce52009-01-03 21:22:43 +000065
Manuel Pégourié-Gonnardcf26e212015-07-02 19:47:06 +020066check: lib
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020067 $(MAKE) -C tests check
Paul Bakker37ca75d2011-01-06 12:28:03 +000068
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020069test: check
Manuel Pégourié-Gonnard6529ff02014-01-31 13:41:07 +010070
Manuel Pégourié-Gonnard85113842015-07-08 21:20:03 +010071ifndef WINDOWS
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010072# note: for coverage testing, build with:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020073# make CFLAGS='--coverage -g3 -O0'
Manuel Pégourié-Gonnard79d090b2014-02-26 19:39:01 +010074covtest:
Manuel Pégourié-Gonnardfc367082015-06-26 16:50:24 +020075 $(MAKE) check
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010076 programs/test/selftest
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +010077 tests/compat.sh
78 tests/ssl-opt.sh
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010079
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010080lcov:
81 rm -rf Coverage
Manuel Pégourié-Gonnard53c6e962014-06-13 12:22:07 +020082 lcov --capture --initial --directory library -o files.info
83 lcov --capture --directory library -o tests.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +020084 lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
85 lcov --remove all.info -o final.info '*.h'
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010086 gendesc tests/Descriptions.txt -o descriptions
Manuel Pégourié-Gonnardafe8f532015-01-23 17:40:33 +000087 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 +020088 rm -f files.info tests.info all.info final.info descriptions
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010089
Paul Bakker37ca75d2011-01-06 12:28:03 +000090apidoc:
91 mkdir -p apidoc
Manuel Pégourié-Gonnardf234ff82015-01-22 17:01:27 +000092 doxygen doxygen/mbedtls.doxyfile
Paul Bakker37ca75d2011-01-06 12:28:03 +000093
94apidoc_clean:
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020095 rm -rf apidoc
96endif