blob: c58ccd1270f2d4aa0be0858ff81365c8e7801707 [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
Alon Bar-Lev06f0d262015-02-18 17:18:28 +02007all: programs tests
Paul Bakker5121ce52009-01-03 21:22:43 +00008
Alon Bar-Lev06f0d262015-02-18 17:18:28 +02009no_test: programs
10
11programs: lib
12 $(MAKE) -C programs
Paul Bakkerf9964ab2012-04-05 12:07:50 +000013
14lib:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020015 $(MAKE) -C library
16
17tests: lib
18 $(MAKE) -C tests
Paul Bakkerf9964ab2012-04-05 12:07:50 +000019
Paul Bakker5121ce52009-01-03 21:22:43 +000020install:
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000021 mkdir -p $(DESTDIR)/include/mbedtls
22 cp -r include/mbedtls $(DESTDIR)/include
Paul Bakker5121ce52009-01-03 21:22:43 +000023
24 mkdir -p $(DESTDIR)/lib
Manuel Pégourié-Gonnardda61ed32015-04-30 10:28:51 +020025 cp -RP library/libmbedtls.* $(DESTDIR)/lib
Paul Bakker5121ce52009-01-03 21:22:43 +000026
27 mkdir -p $(DESTDIR)/bin
28 for p in programs/*/* ; do \
29 if [ -x $$p ] && [ ! -d $$p ] ; \
30 then \
31 f=$(PREFIX)`basename $$p` ; \
32 cp $$p $(DESTDIR)/bin/$$f ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010033 ln -sf $$f $(DESTDIR)/bin/$$o ; \
Paul Bakker5121ce52009-01-03 21:22:43 +000034 fi \
35 done
36
Paul Bakker9a736322012-11-14 12:39:52 +000037uninstall:
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000038 rm -rf $(DESTDIR)/include/mbedtls
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010039 rm -f $(DESTDIR)/lib/libmbedtls.*
Paul Bakker9a736322012-11-14 12:39:52 +000040
41 for p in programs/*/* ; do \
42 if [ -x $$p ] && [ ! -d $$p ] ; \
43 then \
44 f=$(PREFIX)`basename $$p` ; \
45 rm -f $(DESTDIR)/bin/$$f ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010046 rm -f $(DESTDIR)/bin/$$o ; \
Paul Bakker9a736322012-11-14 12:39:52 +000047 fi \
48 done
49
Paul Bakker5121ce52009-01-03 21:22:43 +000050clean:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020051 $(MAKE) -C library clean
52 $(MAKE) -C programs clean
53 $(MAKE) -C tests clean
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010054 find . \( -name \*.gcno -o -name \*.gcda -o -name *.info \) -exec rm {} +
Paul Bakker5121ce52009-01-03 21:22:43 +000055
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020056check: tests
57 $(MAKE) -C tests check
Paul Bakker37ca75d2011-01-06 12:28:03 +000058
Manuel Pégourié-Gonnard6529ff02014-01-31 13:41:07 +010059test-ref-configs:
60 tests/scripts/test-ref-configs.pl
61
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010062# note: for coverage testing, build with:
63# CFLAGS='--coverage' make OFLAGS='-g3 -O0'
Manuel Pégourié-Gonnard79d090b2014-02-26 19:39:01 +010064covtest:
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010065 make check
66 programs/test/selftest
67 ( cd tests && ./compat.sh )
68 ( cd tests && ./ssl-opt.sh )
69
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010070lcov:
71 rm -rf Coverage
Manuel Pégourié-Gonnard53c6e962014-06-13 12:22:07 +020072 lcov --capture --initial --directory library -o files.info
73 lcov --capture --directory library -o tests.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +020074 lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
75 lcov --remove all.info -o final.info '*.h'
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010076 gendesc tests/Descriptions.txt -o descriptions
Manuel Pégourié-Gonnardafe8f532015-01-23 17:40:33 +000077 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 +020078 rm -f files.info tests.info all.info final.info descriptions
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010079
Paul Bakker37ca75d2011-01-06 12:28:03 +000080apidoc:
81 mkdir -p apidoc
Manuel Pégourié-Gonnardf234ff82015-01-22 17:01:27 +000082 doxygen doxygen/mbedtls.doxyfile
Paul Bakker37ca75d2011-01-06 12:28:03 +000083
84apidoc_clean:
85 if [ -d apidoc ] ; \
86 then \
87 rm -rf apidoc ; \
88 fi