Android.mk revision f0f55340a10fea9d106b832cd1392441a5efcfd4
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# TODO(avakulenko): Remove this condition when libchromeos can be built on
18# non-Linux host.
19ifeq ($(HOST_OS),linux)
20
21# Common variables
22# ========================================================
23
24buffetCommonCppExtension := .cc
25buffetCommonCFlags := -DBUFFET_USE_WIFI_BOOTSTRAPPING -Wall -Werror \
26	-Wno-char-subscripts -Wno-missing-field-initializers \
27	-Wno-unused-function -Wno-unused-parameter \
28
29buffetCommonCppFlags := \
30	-Wno-deprecated-register \
31	-Wno-sign-compare \
32	-Wno-sign-promo \
33	-Wno-non-virtual-dtor \
34
35buffetCommonCIncludes := \
36	$(LOCAL_PATH)/.. \
37	$(LOCAL_PATH)/dbus-proxies \
38	external/gtest/include \
39
40buffetSharedLibraries := \
41	libchrome \
42	libchrome-dbus \
43	libchromeos \
44	libchromeos-dbus \
45	libchromeos-http \
46	libchromeos-stream \
47	libdbus \
48	libweave \
49
50ifdef BRILLO
51buffetCommonCFlags += -D__BRILLO__
52buffetSharedLibraries += libconnectivity
53endif
54
55# buffet-common
56# ========================================================
57include $(CLEAR_VARS)
58LOCAL_MODULE := buffet-common
59LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
60LOCAL_CFLAGS := $(buffetCommonCFlags)
61LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
62LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
63LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
64LOCAL_STATIC_LIBRARIES :=
65LOCAL_RTTI_FLAG := -frtti
66LOCAL_CLANG := true
67LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
68
69LOCAL_SRC_FILES := \
70	buffet/buffet_config.cc \
71	buffet/dbus_command_dispatcher.cc \
72	buffet/dbus_command_proxy.cc \
73	buffet/dbus_conversion.cc \
74	buffet/dbus_constants.cc \
75	buffet/http_transport_client.cc \
76	buffet/manager.cc \
77	buffet/socket_stream.cc \
78
79ifdef BRILLO
80
81LOCAL_SRC_FILES += \
82	buffet/avahi_mdns_client.cc \
83	buffet/brillo_network_client.cc \
84
85else # BRILLO
86
87LOCAL_SRC_FILES += \
88	buffet/stub_mdns_client.cc \
89	buffet/stub_network_client.cc \
90
91endif # BRILLO
92
93include $(BUILD_STATIC_LIBRARY)
94
95# buffet
96# ========================================================
97include $(CLEAR_VARS)
98LOCAL_MODULE := weaved
99LOCAL_REQUIRED_MODULES := \
100	base_state.defaults.json \
101	base_state.schema.json \
102	gcd.json \
103	org.chromium.Buffet.conf \
104
105ifdef INITRC_TEMPLATE
106LOCAL_REQUIRED_MODULES += init.weaved.rc
107endif
108
109LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
110LOCAL_CFLAGS := $(buffetCommonCFlags)
111LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
112LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
113LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
114LOCAL_WHOLE_STATIC_LIBRARIES := buffet-common
115LOCAL_CLANG := true
116LOCAL_RTTI_FLAG := -frtti
117
118LOCAL_SRC_FILES := \
119	buffet/main.cc
120
121include $(BUILD_EXECUTABLE)
122
123ifdef INITRC_TEMPLATE
124include $(CLEAR_VARS)
125LOCAL_MODULE := init.weaved.rc
126LOCAL_MODULE_CLASS := ETC
127LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
128
129include $(BUILD_SYSTEM)/base_rules.mk
130
131$(LOCAL_BUILT_MODULE): $(INITRC_TEMPLATE)
132	$(call generate-initrc-file,weaved,,)
133endif
134
135# buffet_testrunner
136# ========================================================
137include $(CLEAR_VARS)
138LOCAL_MODULE := buffet_testrunner
139LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
140LOCAL_CFLAGS := $(buffetCommonCFlags)
141LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
142LOCAL_C_INCLUDES := \
143	$(buffetCommonCIncludes) \
144	external/gmock/include \
145
146LOCAL_SHARED_LIBRARIES := \
147	$(buffetSharedLibraries) \
148
149LOCAL_STATIC_LIBRARIES := \
150	buffet-common \
151	libchrome_dbus_test_helpers \
152	libchrome_test_helpers \
153	libchromeos-test-helpers \
154	libgtest \
155	libgmock \
156	libweave-test \
157
158LOCAL_RTTI_FLAG := -frtti
159LOCAL_CLANG := true
160
161LOCAL_SRC_FILES := \
162	buffet/buffet_testrunner.cc \
163	buffet/dbus_command_proxy_unittest.cc \
164	buffet/dbus_conversion_unittest.cc \
165
166include $(BUILD_NATIVE_TEST)
167
168# Config files for /etc/buffet
169# ========================================================
170include $(CLEAR_VARS)
171LOCAL_MODULE := base_state.defaults.json
172LOCAL_MODULE_CLASS := ETC
173LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/buffet
174LOCAL_SRC_FILES := buffet/etc/buffet/base_state.defaults.json
175include $(BUILD_PREBUILT)
176
177include $(CLEAR_VARS)
178LOCAL_MODULE := base_state.schema.json
179LOCAL_MODULE_CLASS := ETC
180LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/buffet
181LOCAL_SRC_FILES := buffet/etc/buffet/base_state.schema.json
182include $(BUILD_PREBUILT)
183
184include $(CLEAR_VARS)
185LOCAL_MODULE := gcd.json
186LOCAL_MODULE_CLASS := ETC
187LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/buffet
188LOCAL_SRC_FILES := buffet/etc/buffet/gcd.json
189include $(BUILD_PREBUILT)
190
191# DBus config files for /etc/dbus-1
192# ========================================================
193include $(CLEAR_VARS)
194LOCAL_MODULE := org.chromium.Buffet.conf
195LOCAL_MODULE_CLASS := ETC
196LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/dbus-1
197LOCAL_SRC_FILES := buffet/etc/dbus-1/org.chromium.Buffet.conf
198include $(BUILD_PREBUILT)
199
200endif # HOST_OS == linux
201