Makefile 2.41 KB
Newer Older
1 2

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

.SILENT:

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

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

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

20
install:
Paul Bakker's avatar
Paul Bakker committed
21 22
	mkdir -p $(DESTDIR)/include/polarssl
	cp -r include/polarssl $(DESTDIR)/include
23 24
	
	mkdir -p $(DESTDIR)/lib
25
	cp library/libpolarssl.* library/libmbedtls.* $(DESTDIR)/lib
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` ;     \
32
	        o=$(OLDPREFIX)`basename $$p` ;  \
33
	        cp $$p $(DESTDIR)/bin/$$f ;     \
34
	        ln -sf $$f $(DESTDIR)/bin/$$o ; \
35 36 37
	    fi                                  \
	done

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

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

59 60
check: lib
	( cd tests && $(MAKE) && $(MAKE) check )
61

62 63 64
test-ref-configs:
	tests/scripts/test-ref-configs.pl

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

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

83 84
apidoc:
	mkdir -p apidoc
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
85
	doxygen doxygen/mbedtls.doxyfile
86 87 88 89 90 91

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