Makefile 2.16 KB
Newer Older
1 2

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

.SILENT:

7
.PHONY: all no_test programs lib tests install uninstall clean test check covtest lcov apidoc apidoc_clean
8

9
all: programs tests
10

11 12
no_test: programs

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
13
programs: lib
14
	$(MAKE) -C programs
Paul Bakker's avatar
Paul Bakker committed
15 16

lib:
17 18
	$(MAKE) -C library

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
19
tests: lib
20
	$(MAKE) -C tests
Paul Bakker's avatar
Paul Bakker committed
21

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

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

54
clean:
55 56 57
	$(MAKE) -C library clean
	$(MAKE) -C programs clean
	$(MAKE) -C tests clean
58
ifndef WINDOWS
59
	find . \( -name \*.gcno -o -name \*.gcda -o -name *.info \) -exec rm {} +
60
endif
61

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
62
check: lib
63
	$(MAKE) -C tests check
64

65
test: check
66

67
ifndef WINDOWS
68
# note: for coverage testing, build with:
69
# make CFLAGS='--coverage -g3 -O0'
70
covtest:
71
	$(MAKE) check
72 73 74 75
	programs/test/selftest
	( cd tests && ./compat.sh )
	( cd tests && ./ssl-opt.sh )

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

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

apidoc_clean:
91 92
	rm -rf apidoc
endif