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 17metrics_cpp_extension := .cc 18libmetrics_sources := \ 19 c_metrics_library.cc \ 20 metrics_library.cc \ 21 timer.cc 22 23metrics_client_sources := \ 24 metrics_client.cc 25 26metrics_collector_common := \ 27 collectors/averaged_statistics_collector.cc \ 28 collectors/cpu_usage_collector.cc \ 29 collectors/disk_usage_collector.cc \ 30 metrics_collector.cc \ 31 metrics_collector_service_impl.cc \ 32 persistent_integer.cc 33 34metricsd_common := \ 35 persistent_integer.cc \ 36 uploader/bn_metricsd_impl.cc \ 37 uploader/crash_counters.cc \ 38 uploader/metrics_hashes.cc \ 39 uploader/metrics_log_base.cc \ 40 uploader/metrics_log.cc \ 41 uploader/metricsd_service_runner.cc \ 42 uploader/sender_http.cc \ 43 uploader/system_profile_cache.cc \ 44 uploader/upload_service.cc 45 46metrics_collector_tests_sources := \ 47 collectors/averaged_statistics_collector_test.cc \ 48 collectors/cpu_usage_collector_test.cc \ 49 metrics_collector_test.cc \ 50 metrics_library_test.cc \ 51 persistent_integer_test.cc \ 52 timer_test.cc 53 54metricsd_tests_sources := \ 55 uploader/metrics_hashes_unittest.cc \ 56 uploader/metrics_log_base_unittest.cc \ 57 uploader/mock/sender_mock.cc \ 58 uploader/upload_service_test.cc 59 60metrics_CFLAGS := -Wall \ 61 -Wno-char-subscripts \ 62 -Wno-missing-field-initializers \ 63 -Wno-unused-parameter \ 64 -Werror \ 65 -fvisibility=default 66metrics_CPPFLAGS := -Wno-non-virtual-dtor \ 67 -Wno-sign-promo \ 68 -Wno-strict-aliasing \ 69 -fvisibility=default 70metrics_includes := external/gtest/include \ 71 $(LOCAL_PATH)/include 72libmetrics_shared_libraries := libchrome libbinder libbrillo libutils 73metrics_collector_shared_libraries := $(libmetrics_shared_libraries) \ 74 libbrillo-binder \ 75 libbrillo-http \ 76 libmetrics \ 77 librootdev \ 78 libweaved 79 80metrics_collector_static_libraries := libmetricscollectorservice 81 82metricsd_shared_libraries := \ 83 libbinder \ 84 libbrillo \ 85 libbrillo-binder \ 86 libbrillo-http \ 87 libchrome \ 88 libprotobuf-cpp-lite \ 89 libupdate_engine_client \ 90 libutils 91 92# Static proxy library for the metricsd binder interface. 93# ======================================================== 94include $(CLEAR_VARS) 95LOCAL_MODULE := metricsd_binder_proxy 96LOCAL_SHARED_LIBRARIES := libbinder libutils 97LOCAL_SRC_FILES := aidl/android/brillo/metrics/IMetricsd.aidl 98include $(BUILD_STATIC_LIBRARY) 99 100# Static library for the metrics_collector binder interface. 101# ========================================================== 102include $(CLEAR_VARS) 103LOCAL_MODULE := libmetricscollectorservice 104LOCAL_CLANG := true 105LOCAL_SHARED_LIBRARIES := libbinder libbrillo-binder libchrome libutils 106LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 107LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 108LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 109LOCAL_SRC_FILES := \ 110 aidl/android/brillo/metrics/IMetricsCollectorService.aidl \ 111 metrics_collector_service_client.cc 112include $(BUILD_STATIC_LIBRARY) 113 114# Shared library for metrics. 115# ======================================================== 116include $(CLEAR_VARS) 117LOCAL_MODULE := libmetrics 118LOCAL_C_INCLUDES := $(metrics_includes) 119LOCAL_CFLAGS := $(metrics_CFLAGS) 120LOCAL_CLANG := true 121LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 122LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) 123LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 124LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries) 125LOCAL_SRC_FILES := $(libmetrics_sources) 126LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy 127include $(BUILD_SHARED_LIBRARY) 128 129# CLI client for metrics. 130# ======================================================== 131include $(CLEAR_VARS) 132LOCAL_MODULE := metrics_client 133LOCAL_C_INCLUDES := $(metrics_includes) 134LOCAL_CFLAGS := $(metrics_CFLAGS) 135LOCAL_CLANG := true 136LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 137LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) 138LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries) \ 139 libmetrics 140LOCAL_SRC_FILES := $(metrics_client_sources) 141LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy 142include $(BUILD_EXECUTABLE) 143 144# Protobuf library for metricsd. 145# ======================================================== 146include $(CLEAR_VARS) 147LOCAL_MODULE := metricsd_protos 148LOCAL_MODULE_CLASS := STATIC_LIBRARIES 149generated_sources_dir := $(call local-generated-sources-dir) 150LOCAL_EXPORT_C_INCLUDE_DIRS += \ 151 $(generated_sources_dir)/proto/system/core/metricsd 152LOCAL_SRC_FILES := $(call all-proto-files-under,uploader/proto) 153include $(BUILD_STATIC_LIBRARY) 154 155# metrics_collector daemon. 156# ======================================================== 157include $(CLEAR_VARS) 158LOCAL_MODULE := metrics_collector 159LOCAL_C_INCLUDES := $(metrics_includes) 160LOCAL_CFLAGS := $(metrics_CFLAGS) 161LOCAL_CLANG := true 162LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 163LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) 164LOCAL_INIT_RC := metrics_collector.rc 165LOCAL_REQUIRED_MODULES := metrics.json 166LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries) 167LOCAL_SRC_FILES := $(metrics_collector_common) \ 168 metrics_collector_main.cc 169LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy \ 170 $(metrics_collector_static_libraries) 171include $(BUILD_EXECUTABLE) 172 173# metricsd daemon. 174# ======================================================== 175include $(CLEAR_VARS) 176LOCAL_MODULE := metricsd 177LOCAL_C_INCLUDES := $(metrics_includes) 178LOCAL_CFLAGS := $(metrics_CFLAGS) 179LOCAL_CLANG := true 180LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 181LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) 182LOCAL_INIT_RC := metricsd.rc 183LOCAL_REQUIRED_MODULES := \ 184 metrics_collector 185LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries) 186LOCAL_STATIC_LIBRARIES := metricsd_protos metricsd_binder_proxy 187LOCAL_SRC_FILES := $(metricsd_common) \ 188 metricsd_main.cc 189include $(BUILD_EXECUTABLE) 190 191# Unit tests for metricsd. 192# ======================================================== 193include $(CLEAR_VARS) 194LOCAL_MODULE := metricsd_tests 195LOCAL_CFLAGS := $(metrics_CFLAGS) 196LOCAL_CLANG := true 197LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 198LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare 199LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries) 200LOCAL_SRC_FILES := $(metricsd_tests_sources) $(metricsd_common) 201LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_protos metricsd_binder_proxy 202ifdef BRILLO 203LOCAL_MODULE_TAGS := eng 204endif 205include $(BUILD_NATIVE_TEST) 206 207# Unit tests for metrics_collector. 208# ======================================================== 209include $(CLEAR_VARS) 210LOCAL_MODULE := metrics_collector_tests 211LOCAL_CFLAGS := $(metrics_CFLAGS) 212LOCAL_CLANG := true 213LOCAL_CPP_EXTENSION := $(metrics_cpp_extension) 214LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare 215LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries) 216LOCAL_SRC_FILES := $(metrics_collector_tests_sources) \ 217 $(metrics_collector_common) 218LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_binder_proxy \ 219 $(metrics_collector_static_libraries) 220ifdef BRILLO 221LOCAL_MODULE_TAGS := eng 222endif 223include $(BUILD_NATIVE_TEST) 224 225# Weave schema files 226# ======================================================== 227include $(CLEAR_VARS) 228LOCAL_MODULE := metrics.json 229LOCAL_MODULE_CLASS := ETC 230LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits 231LOCAL_SRC_FILES := etc/weaved/traits/$(LOCAL_MODULE) 232include $(BUILD_PREBUILT) 233