blob: 81cb458f51c9335b1d27f36709d9c56f6a7598fc [file] [log] [blame]
Steve Fungf085a1f2015-08-07 13:46:22 -07001# 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
Steve Fungf085a1f2015-08-07 13:46:22 -070017crash_reporter_cpp_extension := .cc
18
19crash_reporter_src := crash_collector.cc \
20 kernel_collector.cc \
21 kernel_warning_collector.cc \
22 udev_collector.cc \
23 unclean_shutdown_collector.cc \
24 user_collector.cc
25
26crash_reporter_includes := external/gtest/include
27
28crash_reporter_test_src := crash_collector_test.cc \
29 crash_reporter_logs_test.cc \
30 kernel_collector_test.cc \
31 testrunner.cc \
32 udev_collector_test.cc \
33 unclean_shutdown_collector_test.cc \
34 user_collector_test.cc
35
36warn_collector_src := warn_collector.l
37
38# Crash reporter static library.
39# ========================================================
40include $(CLEAR_VARS)
41LOCAL_MODULE := libcrash
42LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
43LOCAL_C_INCLUDES := $(crash_reporter_includes)
44LOCAL_RTTI_FLAG := -frtti
45LOCAL_SHARED_LIBRARIES := libchrome \
Alex Vakulenko26aef372015-10-27 11:46:37 -070046 libbrillo \
Steve Fungf085a1f2015-08-07 13:46:22 -070047 libcutils \
48 libdbus \
49 libmetrics \
50 libpcrecpp
51LOCAL_SRC_FILES := $(crash_reporter_src)
52include $(BUILD_STATIC_LIBRARY)
53
54# Crash reporter client.
55# ========================================================
56include $(CLEAR_VARS)
57LOCAL_MODULE := crash_reporter
58LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
59LOCAL_C_INCLUDES := $(crash_reporter_includes)
60LOCAL_REQUIRED_MODULES := core2md \
61 crash_reporter_logs.conf \
62 crash_sender \
Steve Fung56833662015-10-16 02:17:53 -070063 crash_server \
Jorge Lucangeli Obes96408df2015-09-28 12:51:54 -070064 dbus-send
65LOCAL_INIT_RC := crash_reporter.rc
Steve Fungf085a1f2015-08-07 13:46:22 -070066LOCAL_RTTI_FLAG := -frtti
67LOCAL_SHARED_LIBRARIES := libchrome \
Alex Vakulenko26aef372015-10-27 11:46:37 -070068 libbrillo \
Steve Fungf085a1f2015-08-07 13:46:22 -070069 libcutils \
70 libdbus \
71 libmetrics \
72 libpcrecpp
73LOCAL_SRC_FILES := crash_reporter.cc
74LOCAL_STATIC_LIBRARIES := libcrash
75include $(BUILD_EXECUTABLE)
76
77# Crash sender script.
78# ========================================================
79include $(CLEAR_VARS)
80LOCAL_MODULE := crash_sender
81LOCAL_MODULE_CLASS := EXECUTABLES
82LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
Steve Fung4a1bc382015-09-14 02:56:07 -070083LOCAL_REQUIRED_MODULES := curl grep periodic_scheduler
Steve Fungf085a1f2015-08-07 13:46:22 -070084LOCAL_SRC_FILES := crash_sender
85include $(BUILD_PREBUILT)
86
87# Warn collector client.
88# ========================================================
89include $(CLEAR_VARS)
90LOCAL_MODULE := warn_collector
91LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
92LOCAL_SHARED_LIBRARIES := libmetrics
93LOCAL_SRC_FILES := $(warn_collector_src)
94include $(BUILD_EXECUTABLE)
95
Steve Fung56833662015-10-16 02:17:53 -070096# /etc/os-release.d/crash_server configuration file.
97# ========================================================
98ifdef OSRELEASED_DIRECTORY
99include $(CLEAR_VARS)
100LOCAL_MODULE := crash_server
101LOCAL_MODULE_CLASS := ETC
102LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
103include $(BUILD_SYSTEM)/base_rules.mk
104
Will Drewrye680f352015-11-04 18:48:30 -0800105# Optionally populate the BRILLO_CRASH_SERVER variable from a product
106# configuration file: brillo/crash_server.
107LOADED_BRILLO_CRASH_SERVER := $(call cfgtree-get-if-exists,brillo/crash_server)
108
Steve Fung56833662015-10-16 02:17:53 -0700109# If the crash server isn't set, use a blank value. crash_sender
110# will log it as a configuration error.
Will Drewrye680f352015-11-04 18:48:30 -0800111$(LOCAL_BUILT_MODULE): BRILLO_CRASH_SERVER ?= "$(LOADED_BRILLO_CRASH_SERVER)"
Steve Fung56833662015-10-16 02:17:53 -0700112$(LOCAL_BUILT_MODULE):
Mike Frysingercb31b1d2015-10-20 14:09:23 -0400113 $(hide)mkdir -p $(dir $@)
Steve Fung56833662015-10-16 02:17:53 -0700114 echo $(BRILLO_CRASH_SERVER) > $@
115endif
116
Steve Fungf085a1f2015-08-07 13:46:22 -0700117# Crash reporter logs conf file.
118# ========================================================
119include $(CLEAR_VARS)
120LOCAL_MODULE := crash_reporter_logs.conf
121LOCAL_MODULE_CLASS := ETC
122LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/etc
123LOCAL_SRC_FILES := crash_reporter_logs.conf
124include $(BUILD_PREBUILT)
125
Steve Fung0e8746d2015-08-20 17:07:50 -0700126# Periodic Scheduler.
127# ========================================================
128include $(CLEAR_VARS)
129LOCAL_MODULE := periodic_scheduler
130LOCAL_MODULE_CLASS := EXECUTABLES
131LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
132LOCAL_SRC_FILES := periodic_scheduler
133include $(BUILD_PREBUILT)
134
Steve Fungf085a1f2015-08-07 13:46:22 -0700135# Crash reporter tests.
136# ========================================================
137include $(CLEAR_VARS)
138LOCAL_MODULE := crash_reporter_tests
139LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
140LOCAL_SHARED_LIBRARIES := libchrome \
Alex Vakulenko26aef372015-10-27 11:46:37 -0700141 libbrillo \
Steve Fung48180112015-09-30 16:27:56 -0700142 libcutils \
Steve Fungf085a1f2015-08-07 13:46:22 -0700143 libdbus \
144 libpcrecpp
145LOCAL_SRC_FILES := $(crash_reporter_test_src)
146LOCAL_STATIC_LIBRARIES := libcrash libgmock
147include $(BUILD_NATIVE_TEST)