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# ========================================================
19
20buffetCommonCppExtension := .cc
21buffetCommonCFlags := -DBUFFET_USE_WIFI_BOOTSTRAPPING -Wall -Werror \
22	-Wno-char-subscripts -Wno-missing-field-initializers \
23	-Wno-unused-function -Wno-unused-parameter \
24
25buffetCommonCppFlags := \
26	-Wno-deprecated-register \
27	-Wno-sign-compare \
28	-Wno-sign-promo \
29	-Wno-non-virtual-dtor \
30
31buffetCommonCIncludes := \
32	$(LOCAL_PATH)/.. \
33	external/cros/system_api \
34	external/gtest/include \
35
36buffetSharedLibraries := \
37	libapmanager-client \
38	libavahi-common \
39	libavahi-client \
40	libbinder \
41	libbinderwrapper \
42	libbrillo \
43	libbrillo-binder \
44	libbrillo-dbus \
45	libbrillo-http \
46	libbrillo-stream \
47	libchrome \
48	libchrome-dbus \
49	libcutils \
50	libdbus \
51	libnativepower \
52	libshill-client \
53	libutils \
54	libweave \
55	libwebserv \
56
57ifdef BRILLO
58
59buffetSharedLibraries += \
60	libkeymaster_messages \
61	libkeystore_binder \
62
63endif
64
65# weave-common
66# Code shared between weaved daemon and libweaved client library
67# ========================================================
68include $(CLEAR_VARS)
69LOCAL_MODULE := weave-common
70LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
71LOCAL_CFLAGS := $(buffetCommonCFlags)
72LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
73LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
74LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/brillo
75LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
76LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
77LOCAL_CLANG := true
78
79LOCAL_SRC_FILES := \
80	brillo/android/weave/IWeaveClient.aidl \
81	brillo/android/weave/IWeaveCommand.aidl \
82	brillo/android/weave/IWeaveService.aidl \
83	brillo/android/weave/IWeaveServiceManager.aidl \
84	brillo/android/weave/IWeaveServiceManagerNotificationListener.aidl \
85	common/binder_constants.cc \
86	common/binder_utils.cc \
87
88include $(BUILD_STATIC_LIBRARY)
89
90# weave-daemon-common
91# Code shared between weaved daemon and unit test runner.
92# This is essentially the implementation of weaved in a static library format.
93# ========================================================
94include $(CLEAR_VARS)
95LOCAL_MODULE := weave-daemon-common
96LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
97LOCAL_CFLAGS := $(buffetCommonCFlags)
98# TODO(avakulenko): Remove -Wno-deprecated-declarations when legacy libweave
99# APIs are removed (see: b/25917708).
100LOCAL_CPPFLAGS := $(buffetCommonCppFlags) -Wno-deprecated-declarations
101LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
102LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
103LOCAL_STATIC_LIBRARIES := weave-common
104LOCAL_CLANG := true
105LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
106
107LOCAL_SRC_FILES := \
108	brillo/weaved_system_properties.cc \
109	buffet/ap_manager_client.cc \
110	buffet/avahi_mdns_client.cc \
111	buffet/binder_command_proxy.cc \
112	buffet/binder_weave_service.cc \
113	buffet/buffet_config.cc \
114	buffet/dbus_constants.cc \
115	buffet/flouride_socket_bluetooth_client.cc \
116	buffet/http_transport_client.cc \
117	buffet/manager.cc \
118	buffet/shill_client.cc \
119	buffet/socket_stream.cc \
120	buffet/webserv_client.cc \
121
122ifdef BRILLO
123LOCAL_SRC_FILES += buffet/keystore_encryptor.cc
124else
125LOCAL_SRC_FILES += buffet/fake_encryptor.cc
126endif
127
128include $(BUILD_STATIC_LIBRARY)
129
130# weaved
131# The main binary of the weave daemon.
132# ========================================================
133include $(CLEAR_VARS)
134LOCAL_MODULE := weaved
135LOCAL_REQUIRED_MODULES := \
136	avahi-daemon \
137	libweaved \
138	webservd \
139
140LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
141LOCAL_CFLAGS := $(buffetCommonCFlags)
142LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
143LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
144LOCAL_INIT_RC := weaved.rc
145LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
146LOCAL_STATIC_LIBRARIES := weave-common \
147
148LOCAL_WHOLE_STATIC_LIBRARIES := weave-daemon-common
149LOCAL_CLANG := true
150
151LOCAL_SRC_FILES := \
152	buffet/main.cc
153
154include $(BUILD_EXECUTABLE)
155
156# libweaved
157# The client library for the weave daemon. You should link to libweaved,
158# if you need to communicate with weaved.
159# ========================================================
160include $(CLEAR_VARS)
161LOCAL_MODULE := libweaved
162LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
163LOCAL_CFLAGS := $(buffetCommonCFlags)
164LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
165LOCAL_C_INCLUDES := external/gtest/include
166LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
167LOCAL_SHARED_LIBRARIES := \
168	libbinder \
169	libbinderwrapper \
170	libbrillo \
171	libchrome \
172	libutils \
173
174LOCAL_STATIC_LIBRARIES := weave-common
175
176LOCAL_CLANG := true
177
178LOCAL_SRC_FILES := \
179	libweaved/command.cc \
180	libweaved/service.cc \
181
182include $(BUILD_SHARED_LIBRARY)
183
184# weaved_test
185# ========================================================
186include $(CLEAR_VARS)
187LOCAL_MODULE := weaved_test
188LOCAL_MODULE_TAGS := eng
189LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
190LOCAL_CFLAGS := $(buffetCommonCFlags)
191LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
192LOCAL_C_INCLUDES := \
193	$(buffetCommonCIncludes) \
194	external/gmock/include \
195
196LOCAL_SHARED_LIBRARIES := \
197	$(buffetSharedLibraries) \
198
199LOCAL_STATIC_LIBRARIES := \
200	libbrillo-test-helpers \
201	libchrome_test_helpers \
202	libgtest \
203	libgmock \
204	libweave-test \
205	weave-daemon-common \
206	weave-common \
207
208LOCAL_CLANG := true
209
210LOCAL_SRC_FILES := \
211	buffet/binder_command_proxy_unittest.cc \
212	buffet/buffet_config_unittest.cc \
213	buffet/buffet_testrunner.cc \
214
215include $(BUILD_NATIVE_TEST)
216