Makefile 2.25 KB
Newer Older
1 2

DESTDIR=/usr/local
3
PREFIX=mbedtls_
4 5 6 7

.SILENT:

all:
Paul Bakker's avatar
Paul Bakker committed
8 9
	cd library  && $(MAKE) all && cd ..
	cd programs && $(MAKE) all && cd ..
Paul Bakker's avatar
Paul Bakker committed
10
	cd tests    && $(MAKE) all && cd ..
11

Paul Bakker's avatar
Paul Bakker committed
12 13 14 15 16 17 18
no_test:
	cd library  && $(MAKE) all && cd ..
	cd programs && $(MAKE) all && cd ..

lib:
	cd library  && $(MAKE) all && cd ..

19
install:
20 21
	mkdir -p $(DESTDIR)/include/mbedtls
	cp -r include/mbedtls $(DESTDIR)/include
22 23
	
	mkdir -p $(DESTDIR)/lib
24
	cp library/libmbedtls.* $(DESTDIR)/lib
25 26 27 28 29 30 31
	
	mkdir -p $(DESTDIR)/bin
	for p in programs/*/* ; do              \
	    if [ -x $$p ] && [ ! -d $$p ] ;     \
	    then                                \
	        f=$(PREFIX)`basename $$p` ;     \
	        cp $$p $(DESTDIR)/bin/$$f ;     \
32
	        ln -sf $$f $(DESTDIR)/bin/$$o ; \
33 34 35
	    fi                                  \
	done

36
uninstall:
37
	rm -rf $(DESTDIR)/include/mbedtls
38
	rm -f $(DESTDIR)/lib/libmbedtls.*
39 40 41 42 43 44
	
	for p in programs/*/* ; do              \
	    if [ -x $$p ] && [ ! -d $$p ] ;     \
	    then                                \
	        f=$(PREFIX)`basename $$p` ;     \
	        rm -f $(DESTDIR)/bin/$$f ;      \
45
	        rm -f $(DESTDIR)/bin/$$o ;      \
46 47 48
	    fi                                  \
	done

49
clean:
Paul Bakker's avatar
Paul Bakker committed
50 51
	cd library  && $(MAKE) clean && cd ..
	cd programs && $(MAKE) clean && cd ..
Paul Bakker's avatar
Paul Bakker committed
52
	cd tests    && $(MAKE) clean && cd ..
53
	find . \( -name \*.gcno -o -name \*.gcda -o -name *.info \) -exec rm {} +
54

55 56
check: lib
	( cd tests && $(MAKE) && $(MAKE) check )
57

58 59 60
test-ref-configs:
	tests/scripts/test-ref-configs.pl

61 62
# note: for coverage testing, build with:
# CFLAGS='--coverage' make OFLAGS='-g3 -O0'
63
covtest:
64 65 66 67 68
	make check
	programs/test/selftest
	( cd tests && ./compat.sh )
	( cd tests && ./ssl-opt.sh )

69 70
lcov:
	rm -rf Coverage
71 72
	lcov --capture --initial --directory library -o files.info
	lcov --capture --directory library -o tests.info
73 74
	lcov --add-tracefile files.info --add-tracefile tests.info -o all.info
	lcov --remove all.info -o final.info '*.h'
75
	gendesc tests/Descriptions.txt -o descriptions
76
	genhtml --title "mbed TLS" --description-file descriptions --keep-descriptions --legend --no-branch-coverage -o Coverage final.info
77
	rm -f files.info tests.info all.info final.info descriptions
78

79 80
apidoc:
	mkdir -p apidoc
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
81
	doxygen doxygen/mbedtls.doxyfile
82 83 84 85 86 87

apidoc_clean:
	if [ -d apidoc ] ;			\
	then				    	\
		rm -rf apidoc ;			\
	fi