blob: a533adc0e2e7b821d63b2bfb642cbb83ee858135 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
BASE=../..
SUBS=system/core \
hardware/libhardware \
external/gtest
GTEST=$(BASE)/external/gtest
INCLUDES=$(foreach dir,$(SUBS),-I $(BASE)/$(dir)/include) \
-I $(BASE)/libnativehelper/include/nativehelper \
-I $(GTEST) -Iinclude
ifdef USE_CLANG
CC=/usr/bin/clang
CXX=/usr/bin/clang
CLANG_TEST_DEFINE=-DKEYMASTER_CLANG_TEST_BUILD
COMPILER_SPECIFIC_ARGS=-std=c++11 $(CLANG_TEST_DEFINE)
else
COMPILER_SPECIFIC_ARGS=-std=c++0x -fprofile-arcs
endif
CPPFLAGS=$(INCLUDES) -g -O0 -MD
CXXFLAGS=-Wall -Werror -Wno-unused -Winit-self -Wpointer-arith -Wunused-parameter \
-Wmissing-declarations -ftest-coverage \
-Wno-deprecated-declarations -fno-exceptions -DKEYMASTER_NAME_TAGS \
$(COMPILER_SPECIFIC_ARGS)
LDLIBS=-lcrypto -lpthread -lstdc++
CPPSRCS=\
asymmetric_key.cpp \
authorization_set.cpp \
authorization_set_test.cpp \
dsa_operation.cpp \
ecdsa_operation.cpp \
google_keymaster.cpp \
google_keymaster_messages.cpp \
google_keymaster_messages_test.cpp \
google_keymaster_test.cpp \
google_keymaster_test_utils.cpp \
google_keymaster_utils.cpp \
key.cpp \
key_blob.cpp \
key_blob_test.cpp \
rsa_operation.cpp \
serializable.cpp
CCSRCS=$(GTEST)/src/gtest-all.cc
CSRCS=ocb.c
OBJS=$(CPPSRCS:.cpp=.o) $(CCSRCS:.cc=.o) $(CSRCS:.c=.o)
DEPS=$(CPPSRCS:.cpp=.d) $(CCSRCS:.cc=.d) $(CSRCS:.c=.d)
LINK.o=$(LINK.cc)
BINARIES=authorization_set_test \
google_keymaster_test \
google_keymaster_messages_test \
key_blob_test
.PHONY: coverage memcheck massif clean run
%.run: %
./$<
touch $@
run: $(BINARIES:=.run)
coverage: coverage.info
genhtml coverage.info --output-directory coverage
coverage.info: run
lcov --capture --directory=. --output-file coverage.info
%.coverage : %
$(MAKE) clean && $(MAKE) $<
./$<
lcov --capture --directory=. --output-file coverage.info
genhtml coverage.info --output-directory coverage
#UNINIT_OPTS=--track-origins=yes
UNINIT_OPTS=--undef-value-errors=no
MEMCHECK_OPTS=--leak-check=full \
--show-reachable=yes \
--vgdb=full \
$(UNINIT_OPTS) \
--error-exitcode=1
MASSIF_OPTS=--tool=massif \
--stacks=yes
%.memcheck : %
valgrind $(MEMCHECK_OPTS) ./$< && \
touch $@
%.massif : %
valgrind $(MASSIF_OPTS) --massif-out-file=$@ ./$<
memcheck: $(BINARIES:=.memcheck)
massif: $(BINARIES:=.massif)
authorization_set_test: authorization_set_test.o \
authorization_set.o \
google_keymaster_test_utils.o \
serializable.o \
$(GTEST)/src/gtest-all.o
key_blob_test: key_blob_test.o \
authorization_set.o \
google_keymaster_test_utils.o \
key_blob.o \
ocb.o \
serializable.o \
$(GTEST)/src/gtest-all.o
google_keymaster_messages_test: google_keymaster_messages_test.o \
authorization_set.o \
google_keymaster_messages.o \
google_keymaster_test_utils.o \
google_keymaster_utils.o \
serializable.o \
$(GTEST)/src/gtest-all.o
google_keymaster_test: google_keymaster_test.o \
asymmetric_key.o \
authorization_set.o \
dsa_operation.o \
ecdsa_operation.o \
google_keymaster.o \
google_keymaster_messages.o \
google_keymaster_test_utils.o \
google_keymaster_utils.o \
key.o \
key_blob.o \
ocb.o \
rsa_operation.o \
serializable.o \
$(GTEST)/src/gtest-all.o
$(GTEST)/src/gtest-all.o: CXXFLAGS:=$(subst -Wmissing-declarations,,$(CXXFLAGS))
ocb.o: CFLAGS=$(CLANG_TEST_DEFINE)
clean:
rm -f $(OBJS) $(DEPS) $(BINARIES) \
$(BINARIES:=.run) $(BINARIES:=.memcheck) $(BINARIES:=.massif) \
*gcno *gcda coverage.info
rm -rf coverage
-include $(CPPSRCS:.cpp=.d)
-include $(CCSRCS:.cc=.d)
|