1# Copyright (C) 2016 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# ========================================================
19defaultCppExtension := .cc
20defaultCFlags := \
21  -Wall -Werror \
22  -Wno-unused-parameter \
23  -fvisibility=hidden \
24  -DUSE_TPM2 \
25  -DUSE_BINDER_IPC
26defaultIncludes := $(LOCAL_PATH)/..
27defaultSharedLibraries := \
28  libbase \
29  libbinder \
30  libbinderwrapper \
31  libbrillo \
32  libbrillo-binder \
33  libchrome \
34  libchrome-crypto \
35  libcrypto \
36  libprotobuf-cpp-lite \
37  libtrunks \
38  libutils
39
40# libtpm_manager_generated
41# ========================================================
42include $(CLEAR_VARS)
43LOCAL_MODULE := libtpm_manager_generated
44LOCAL_MODULE_CLASS := STATIC_LIBRARIES
45LOCAL_CPP_EXTENSION := $(defaultCppExtension)
46LOCAL_CFLAGS := $(defaultCFlags) -fvisibility=default
47LOCAL_CLANG := true
48proto_include := $(call local-generated-sources-dir)/proto/$(LOCAL_PATH)/..
49aidl_include := $(call local-generated-sources-dir)/aidl-generated/include
50LOCAL_C_INCLUDES := $(proto_include) $(aidl_include) $(defaultIncludes)
51LOCAL_EXPORT_C_INCLUDE_DIRS := $(proto_include) $(aidl_include)
52LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
53LOCAL_SRC_FILES := \
54  common/tpm_manager.proto \
55  aidl/android/tpm_manager/ITpmManagerClient.aidl \
56  aidl/android/tpm_manager/ITpmNvram.aidl \
57  aidl/android/tpm_manager/ITpmOwnership.aidl
58LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl
59include $(BUILD_STATIC_LIBRARY)
60
61# libtpm_manager_common
62# ========================================================
63include $(CLEAR_VARS)
64LOCAL_MODULE := libtpm_manager_common
65LOCAL_CPP_EXTENSION := $(defaultCppExtension)
66LOCAL_CFLAGS := $(defaultCFlags) -fvisibility=default
67LOCAL_CLANG := true
68LOCAL_C_INCLUDES := $(defaultIncludes)
69LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
70LOCAL_STATIC_LIBRARIES := libtpm_manager_generated
71LOCAL_SRC_FILES := \
72  common/print_tpm_manager_proto.cc
73include $(BUILD_STATIC_LIBRARY)
74
75# libtpm_manager_server
76# ========================================================
77include $(CLEAR_VARS)
78LOCAL_MODULE := libtpm_manager_server
79LOCAL_CPP_EXTENSION := $(defaultCppExtension)
80LOCAL_CFLAGS := $(defaultCFlags)
81LOCAL_CLANG := true
82LOCAL_C_INCLUDES := $(defaultIncludes)
83LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
84LOCAL_STATIC_LIBRARIES := libtpm_manager_generated
85LOCAL_SRC_FILES := \
86  server/binder_service.cc \
87  server/local_data_store_impl.cc \
88  server/openssl_crypto_util_impl.cc \
89  server/tpm2_initializer_impl.cc \
90  server/tpm2_nvram_impl.cc \
91  server/tpm2_status_impl.cc \
92  server/tpm_manager_service.cc
93include $(BUILD_STATIC_LIBRARY)
94
95# tpm_managerd
96# ========================================================
97include $(CLEAR_VARS)
98LOCAL_MODULE := tpm_managerd
99LOCAL_CPP_EXTENSION := $(defaultCppExtension)
100LOCAL_CFLAGS := $(defaultCFlags)
101LOCAL_CLANG := true
102LOCAL_INIT_RC := server/tpm_managerd.rc
103LOCAL_C_INCLUDES := $(defaultIncludes)
104LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
105LOCAL_STATIC_LIBRARIES := \
106  libtpm_manager_server \
107  libtpm_manager_common \
108  libtpm_manager_generated
109LOCAL_SRC_FILES := \
110  server/main.cc
111
112include $(BUILD_EXECUTABLE)
113
114# libtpm_manager
115# ========================================================
116include $(CLEAR_VARS)
117LOCAL_MODULE := libtpm_manager
118LOCAL_CPP_EXTENSION := $(defaultCppExtension)
119LOCAL_CFLAGS := $(defaultCFlags)
120LOCAL_CLANG := true
121LOCAL_C_INCLUDES := $(defaultIncludes)
122LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
123LOCAL_WHOLE_STATIC_LIBRARIES := \
124  libtpm_manager_common \
125  libtpm_manager_generated
126LOCAL_SRC_FILES := \
127  client/tpm_nvram_binder_proxy.cc \
128  client/tpm_ownership_binder_proxy.cc
129include $(BUILD_SHARED_LIBRARY)
130
131# tpm_manager_client
132# ========================================================
133include $(CLEAR_VARS)
134LOCAL_MODULE := tpm_manager_client
135LOCAL_CPP_EXTENSION := $(defaultCppExtension)
136LOCAL_CFLAGS := $(defaultCFlags)
137LOCAL_CLANG := true
138LOCAL_C_INCLUDES := $(defaultIncludes)
139LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries) libtpm_manager
140LOCAL_SRC_FILES := \
141  client/main.cc
142include $(BUILD_EXECUTABLE)
143
144# Target unit tests
145# ========================================================
146include $(CLEAR_VARS)
147LOCAL_MODULE := tpm_manager_test
148LOCAL_MODULE_TAGS := eng
149LOCAL_CPP_EXTENSION := $(defaultCppExtension)
150LOCAL_CFLAGS := $(defaultCFlags) -Wno-sign-compare
151LOCAL_CLANG := true
152LOCAL_C_INCLUDES := $(defaultIncludes)
153LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries) libtpm_manager
154LOCAL_SRC_FILES := \
155  common/mock_tpm_nvram_interface.cc \
156  common/mock_tpm_ownership_interface.cc \
157  server/binder_service_test.cc \
158  server/mock_local_data_store.cc \
159  server/mock_openssl_crypto_util.cc \
160  server/mock_tpm_initializer.cc \
161  server/mock_tpm_nvram.cc \
162  server/mock_tpm_status.cc \
163  server/tpm2_initializer_test.cc \
164  server/tpm2_nvram_test.cc \
165  server/tpm2_status_test.cc \
166  server/tpm_manager_service_test.cc
167LOCAL_STATIC_LIBRARIES := \
168  libBionicGtestMain \
169  libgmock \
170  libtpm_manager_common \
171  libtpm_manager_generated \
172  libtpm_manager_server \
173  libtrunks_test
174include $(BUILD_NATIVE_TEST)
175