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 17crash_reporter_cpp_extension := .cc 18 19crash_reporter_src := crash_collector.cc \ 20 kernel_collector.cc \ 21 kernel_warning_collector.cc \ 22 unclean_shutdown_collector.cc \ 23 user_collector.cc 24 25crash_reporter_includes := external/gtest/include 26 27crash_reporter_test_src := crash_collector_test.cc \ 28 crash_reporter_logs_test.cc \ 29 kernel_collector_test.cc \ 30 testrunner.cc \ 31 unclean_shutdown_collector_test.cc \ 32 user_collector_test.cc 33 34warn_collector_src := warn_collector.l 35 36# Crash reporter static library. 37# ======================================================== 38include $(CLEAR_VARS) 39LOCAL_MODULE := libcrash 40LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) 41LOCAL_C_INCLUDES := $(crash_reporter_includes) 42LOCAL_SHARED_LIBRARIES := libchrome \ 43 libbinder \ 44 libbrillo \ 45 libcutils \ 46 libmetrics \ 47 libpcrecpp 48LOCAL_STATIC_LIBRARIES := libmetricscollectorservice 49LOCAL_SRC_FILES := $(crash_reporter_src) 50include $(BUILD_STATIC_LIBRARY) 51 52# Crash reporter client. 53# ======================================================== 54include $(CLEAR_VARS) 55LOCAL_MODULE := crash_reporter 56LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) 57LOCAL_C_INCLUDES := $(crash_reporter_includes) 58LOCAL_REQUIRED_MODULES := core2md \ 59 crash_reporter_logs.conf \ 60 crash_sender \ 61 crash_server 62LOCAL_INIT_RC := crash_reporter.rc 63LOCAL_SHARED_LIBRARIES := libchrome \ 64 libbinder \ 65 libbrillo \ 66 libcutils \ 67 libmetrics \ 68 libpcrecpp \ 69 libutils 70LOCAL_SRC_FILES := crash_reporter.cc 71LOCAL_STATIC_LIBRARIES := libcrash \ 72 libmetricscollectorservice 73include $(BUILD_EXECUTABLE) 74 75# Crash sender script. 76# ======================================================== 77include $(CLEAR_VARS) 78LOCAL_MODULE := crash_sender 79LOCAL_MODULE_CLASS := EXECUTABLES 80LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES) 81LOCAL_REQUIRED_MODULES := curl grep periodic_scheduler 82LOCAL_SRC_FILES := crash_sender 83include $(BUILD_PREBUILT) 84 85# Warn collector client. 86# ======================================================== 87include $(CLEAR_VARS) 88LOCAL_MODULE := warn_collector 89LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) 90LOCAL_SHARED_LIBRARIES := libmetrics 91LOCAL_SRC_FILES := $(warn_collector_src) 92include $(BUILD_EXECUTABLE) 93 94# /etc/os-release.d/crash_server configuration file. 95# ======================================================== 96ifdef OSRELEASED_DIRECTORY 97include $(CLEAR_VARS) 98LOCAL_MODULE := crash_server 99LOCAL_MODULE_CLASS := ETC 100LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) 101include $(BUILD_SYSTEM)/base_rules.mk 102 103# Optionally populate the BRILLO_CRASH_SERVER variable from a product 104# configuration file: brillo/crash_server. 105LOADED_BRILLO_CRASH_SERVER := $(call cfgtree-get-if-exists,brillo/crash_server) 106 107# If the crash server isn't set, use a blank value. crash_sender 108# will log it as a configuration error. 109$(LOCAL_BUILT_MODULE): BRILLO_CRASH_SERVER ?= "$(LOADED_BRILLO_CRASH_SERVER)" 110$(LOCAL_BUILT_MODULE): 111 $(hide)mkdir -p $(dir $@) 112 echo $(BRILLO_CRASH_SERVER) > $@ 113endif 114 115# Crash reporter logs conf file. 116# ======================================================== 117include $(CLEAR_VARS) 118LOCAL_MODULE := crash_reporter_logs.conf 119LOCAL_MODULE_CLASS := ETC 120LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/etc 121LOCAL_SRC_FILES := crash_reporter_logs.conf 122include $(BUILD_PREBUILT) 123 124# Periodic Scheduler. 125# ======================================================== 126include $(CLEAR_VARS) 127LOCAL_MODULE := periodic_scheduler 128LOCAL_MODULE_CLASS := EXECUTABLES 129LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES) 130LOCAL_SRC_FILES := periodic_scheduler 131include $(BUILD_PREBUILT) 132 133# Crash reporter tests. 134# ======================================================== 135include $(CLEAR_VARS) 136LOCAL_MODULE := crash_reporter_tests 137LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension) 138ifdef BRILLO 139LOCAL_MODULE_TAGS := eng 140endif 141LOCAL_SHARED_LIBRARIES := libchrome \ 142 libbrillo \ 143 libcutils \ 144 libpcrecpp 145LOCAL_SRC_FILES := $(crash_reporter_test_src) 146LOCAL_STATIC_LIBRARIES := libcrash libgmock 147include $(BUILD_NATIVE_TEST) 148