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