• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17# Common variables
18# ========================================================
19trunksCppExtension := .cc
20trunksCFlags := -Wall -Werror -Wno-unused-parameter -DUSE_BINDER_IPC
21trunksIncludes := $(LOCAL_PATH)/.. external/gtest/include
22trunksSharedLibraries := \
23  libbinder \
24  libbinderwrapper \
25  libbrillo \
26  libbrillo-binder \
27  libchrome \
28  libchrome-crypto \
29  libcrypto \
30  libprotobuf-cpp-lite \
31  libutils \
32
33# libtrunks_generated
34# ========================================================
35include $(CLEAR_VARS)
36LOCAL_MODULE := libtrunks_generated
37LOCAL_MODULE_CLASS := STATIC_LIBRARIES
38LOCAL_CPP_EXTENSION := $(trunksCppExtension)
39LOCAL_CFLAGS := $(trunksCFlags)
40LOCAL_CLANG := true
41proto_include := $(call local-generated-sources-dir)/proto/$(LOCAL_PATH)/..
42aidl_include := $(call local-generated-sources-dir)/aidl-generated/include
43LOCAL_C_INCLUDES := $(proto_include) $(aidl_include) $(trunksIncludes)
44LOCAL_EXPORT_C_INCLUDE_DIRS := $(proto_include) $(aidl_include)
45LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries)
46LOCAL_SRC_FILES := \
47  interface.proto \
48  aidl/android/trunks/ITrunks.aidl \
49  aidl/android/trunks/ITrunksClient.aidl \
50
51LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl
52include $(BUILD_STATIC_LIBRARY)
53
54# libtrunks_common
55# ========================================================
56include $(CLEAR_VARS)
57LOCAL_MODULE := libtrunks_common
58LOCAL_CPP_EXTENSION := $(trunksCppExtension)
59LOCAL_CFLAGS := $(trunksCFlags)
60LOCAL_CLANG := true
61LOCAL_C_INCLUDES := $(trunksIncludes)
62LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries)
63LOCAL_STATIC_LIBRARIES := libtrunks_generated
64LOCAL_SRC_FILES := \
65  background_command_transceiver.cc \
66  blob_parser.cc \
67  error_codes.cc \
68  hmac_authorization_delegate.cc \
69  hmac_session_impl.cc \
70  password_authorization_delegate.cc \
71  policy_session_impl.cc \
72  scoped_key_handle.cc \
73  session_manager_impl.cc \
74  tpm_generated.cc \
75  tpm_state_impl.cc \
76  tpm_utility_impl.cc \
77  trunks_factory_impl.cc \
78
79include $(BUILD_STATIC_LIBRARY)
80
81# trunksd
82# ========================================================
83include $(CLEAR_VARS)
84LOCAL_MODULE := trunksd
85LOCAL_CPP_EXTENSION := $(trunksCppExtension)
86LOCAL_CFLAGS := $(trunksCFlags)
87ifeq ($(BRILLOEMULATOR),true)
88LOCAL_CFLAGS += -DUSE_SIMULATOR
89endif
90LOCAL_CLANG := true
91ifeq ($(BRILLOEMULATOR),true)
92LOCAL_INIT_RC := trunksd-simulator.rc
93else
94LOCAL_INIT_RC := trunksd.rc
95endif
96LOCAL_C_INCLUDES := $(trunksIncludes)
97LOCAL_SHARED_LIBRARIES := \
98  $(trunksSharedLibraries) \
99  libbrillo-minijail \
100  libminijail \
101
102ifeq ($(BRILLOEMULATOR),true)
103LOCAL_SHARED_LIBRARIES += libtpm2
104endif
105LOCAL_STATIC_LIBRARIES := \
106  libtrunks_generated \
107  libtrunks_common \
108
109LOCAL_REQUIRED_MODULES := \
110  com.android.Trunks.conf \
111  trunksd-seccomp.policy \
112
113LOCAL_SRC_FILES := \
114  resource_manager.cc \
115  tpm_handle.cc \
116  tpm_simulator_handle.cc \
117  trunks_binder_service.cc \
118  trunksd.cc \
119
120include $(BUILD_EXECUTABLE)
121
122# trunksd-seccomp.policy
123# ========================================================
124include $(CLEAR_VARS)
125LOCAL_MODULE := trunksd-seccomp.policy
126LOCAL_MODULE_CLASS := ETC
127LOCAL_MODULE_PATH := $(TARGET_OUT)/usr/share/policy/
128LOCAL_SRC_FILES := trunksd-seccomp-$(TARGET_ARCH).policy
129include $(BUILD_PREBUILT)
130
131# libtrunks
132# ========================================================
133include $(CLEAR_VARS)
134LOCAL_MODULE := libtrunks
135LOCAL_CPP_EXTENSION := $(trunksCppExtension)
136LOCAL_CFLAGS := $(trunksCFlags)
137LOCAL_CLANG := true
138LOCAL_C_INCLUDES := $(trunksIncludes)
139LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries)
140LOCAL_STATIC_LIBRARIES := \
141  libtrunks_common \
142  libtrunks_generated \
143
144LOCAL_SRC_FILES := \
145  trunks_binder_proxy.cc \
146
147include $(BUILD_SHARED_LIBRARY)
148
149# trunks_client
150# ========================================================
151include $(CLEAR_VARS)
152LOCAL_MODULE := trunks_client
153LOCAL_CPP_EXTENSION := $(trunksCppExtension)
154LOCAL_CFLAGS := $(trunksCFlags)
155LOCAL_CLANG := true
156LOCAL_C_INCLUDES := $(trunksIncludes)
157LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) libtrunks
158LOCAL_STATIC_LIBRARIES := libtrunks_common
159LOCAL_SRC_FILES := \
160  trunks_client.cc \
161  trunks_client_test.cc \
162
163include $(BUILD_EXECUTABLE)
164
165# Target unit tests
166# ========================================================
167include $(CLEAR_VARS)
168LOCAL_MODULE := trunks_test
169LOCAL_MODULE_TAGS := eng
170LOCAL_CPP_EXTENSION := $(trunksCppExtension)
171LOCAL_CFLAGS := $(trunksCFlags)
172LOCAL_CLANG := true
173LOCAL_C_INCLUDES := $(trunksIncludes)
174LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries)
175LOCAL_SRC_FILES := \
176  background_command_transceiver_test.cc \
177  hmac_authorization_delegate_test.cc \
178  hmac_session_test.cc \
179  mock_authorization_delegate.cc \
180  mock_blob_parser.cc \
181  mock_command_transceiver.cc \
182  mock_hmac_session.cc \
183  mock_policy_session.cc \
184  mock_session_manager.cc \
185  mock_tpm.cc \
186  mock_tpm_state.cc \
187  mock_tpm_utility.cc \
188  password_authorization_delegate_test.cc \
189  policy_session_test.cc \
190  resource_manager.cc \
191  resource_manager_test.cc \
192  scoped_key_handle_test.cc \
193  session_manager_test.cc \
194  tpm_generated_test.cc \
195  tpm_state_test.cc \
196  tpm_utility_test.cc \
197  trunks_factory_for_test.cc \
198
199LOCAL_STATIC_LIBRARIES := \
200  libgmock \
201  libgtest \
202  libBionicGtestMain \
203  libtrunks_common \
204  libtrunks_generated \
205
206include $(BUILD_NATIVE_TEST)
207