blob: def9c9a4a0c8ce2b190374acf1d62a7a14df4b7f [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_
4OLDPREFIX=polarssl_
Paul Bakker5121ce52009-01-03 21:22:43 +00005
6.SILENT:
7
Alon Bar-Lev06f0d262015-02-18 17:18:28 +02008all: programs tests
Paul Bakker5121ce52009-01-03 21:22:43 +00009
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020010no_test: programs
11
12programs: lib
13 $(MAKE) -C programs
Paul Bakkerf9964ab2012-04-05 12:07:50 +000014
15lib:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020016 $(MAKE) -C library
17
18tests: lib
19 $(MAKE) -C tests
Paul Bakkerf9964ab2012-04-05 12:07:50 +000020
Paul Bakker5121ce52009-01-03 21:22:43 +000021install:
Paul Bakker41d6e3a2009-01-04 16:05:10 +000022 mkdir -p $(DESTDIR)/include/polarssl
23 cp -r include/polarssl $(DESTDIR)/include
Paul Bakker5121ce52009-01-03 21:22:43 +000024
25 mkdir -p $(DESTDIR)/lib
Manuel Pégourié-Gonnardf5203e02015-04-29 09:58:00 +020026 cp -RP library/libpolarssl.* library/libmbedtls.* $(DESTDIR)/lib
Paul Bakker5121ce52009-01-03 21:22:43 +000027
28 mkdir -p $(DESTDIR)/bin
29 for p in programs/*/* ; do \
30 if [ -x $$p ] && [ ! -d $$p ] ; \
31 then \
32 f=$(PREFIX)`basename $$p` ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010033 o=$(OLDPREFIX)`basename $$p` ; \
Paul Bakker5121ce52009-01-03 21:22:43 +000034 cp $$p $(DESTDIR)/bin/$$f ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010035 ln -sf $$f $(DESTDIR)/bin/$$o ; \
Paul Bakker5121ce52009-01-03 21:22:43 +000036 fi \
37 done
38
Paul Bakker9a736322012-11-14 12:39:52 +000039uninstall:
40 rm -rf $(DESTDIR)/include/polarssl
41 rm -f $(DESTDIR)/lib/libpolarssl.*
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010042 rm -f $(DESTDIR)/lib/libmbedtls.*
Paul Bakker9a736322012-11-14 12:39:52 +000043
44 for p in programs/*/* ; do \
45 if [ -x $$p ] && [ ! -d $$p ] ; \
46 then \
47 f=$(PREFIX)`basename $$p` ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010048 o=$(OLDPREFIX)`basename $$p` ; \
Paul Bakker9a736322012-11-14 12:39:52 +000049 rm -f $(DESTDIR)/bin/$$f ; \
Manuel Pégourié-Gonnard52859702015-01-27 14:05:16 +010050 rm -f $(DESTDIR)/bin/$$o ; \
Paul Bakker9a736322012-11-14 12:39:52 +000051 fi \
52 done
53
Paul Bakker5121ce52009-01-03 21:22:43 +000054clean:
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020055 $(MAKE) -C library clean
56 $(MAKE) -C programs clean
57 $(MAKE) -C tests clean
Andres Amaya Garcia97818fb2017-07-06 13:09:26 +010058ifndef WINDOWS
Andres Amaya Garcia5c912702017-07-13 09:29:30 +010059 find . \( -name \*.gcno -o -name \*.gcda -o -name \*.info \) -exec rm {} +
Andres Amaya Garcia97818fb2017-07-06 13:09:26 +010060endif
Paul Bakker5121ce52009-01-03 21:22:43 +000061
Alon Bar-Lev06f0d262015-02-18 17:18:28 +020062check: tests
63 $(MAKE) -C tests check
Paul Bakker37ca75d2011-01-06 12:28:03 +000064
Andres Amaya Garcia97818fb2017-07-06 13:09:26 +010065ifndef WINDOWS
Manuel Pégourié-Gonnard6529ff02014-01-31 13:41:07 +010066test-ref-configs:
67 tests/scripts/test-ref-configs.pl
68
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010069# note: for coverage testing, build with:
70# CFLAGS='--coverage' make OFLAGS='-g3 -O0'
Manuel Pégourié-Gonnard79d090b2014-02-26 19:39:01 +010071covtest:
Manuel Pégourié-Gonnard61137df2014-02-24 11:57:36 +010072 make check
73 programs/test/selftest
74 ( cd tests && ./compat.sh )
75 ( cd tests && ./ssl-opt.sh )
76
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010077lcov:
78 rm -rf Coverage
Manuel Pégourié-Gonnard53c6e962014-06-13 12:22:07 +020079 lcov --capture --initial --directory library -o files.info
80 lcov --capture --directory library -o tests.info
Manuel Pégourié-Gonnarde41072e2014-06-16 16:24:24 +020081 lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
82 lcov --remove all.info -o final.info '*.h'
Manuel Pégourié-Gonnard720375e2014-02-24 12:39:18 +010083 gendesc tests/Descriptions.txt -o descriptions
Manuel Pégourié-Gonnardafe8f532015-01-23 17:40:33 +000084 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 +020085 rm -f files.info tests.info all.info final.info descriptions
Manuel Pégourié-Gonnard546d86c2014-01-31 16:19:43 +010086
Paul Bakker37ca75d2011-01-06 12:28:03 +000087apidoc:
88 mkdir -p apidoc
Manuel Pégourié-Gonnardf234ff82015-01-22 17:01:27 +000089 doxygen doxygen/mbedtls.doxyfile
Paul Bakker37ca75d2011-01-06 12:28:03 +000090
91apidoc_clean:
92 if [ -d apidoc ] ; \
93 then \
94 rm -rf apidoc ; \
95 fi
Andres Amaya Garcia97818fb2017-07-06 13:09:26 +010096endif