Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 1 | # Copyright (C) 2016 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) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 16 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 17 | # proto files used in incidentd to generate cppstream proto headers. |
Kweku Adams | eadd123 | 2018-02-05 16:45:13 -0800 | [diff] [blame] | 18 | PROTO_FILES:= \ |
| 19 | frameworks/base/core/proto/android/os/backtrace.proto \ |
| 20 | frameworks/base/core/proto/android/os/data.proto \ |
| 21 | frameworks/base/core/proto/android/util/log.proto |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 22 | |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 23 | # ========= # |
| 24 | # incidentd # |
| 25 | # ========= # |
| 26 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 27 | include $(CLEAR_VARS) |
| 28 | |
| 29 | LOCAL_MODULE := incidentd |
| 30 | |
Yi Jin | 4e84310 | 2018-02-14 15:36:18 -0800 | [diff] [blame] | 31 | LOCAL_SRC_FILES := $(call all-cpp-files-under, src) \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 32 | |
| 33 | LOCAL_CFLAGS += \ |
| 34 | -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter |
| 35 | |
| 36 | ifeq (debug,) |
| 37 | LOCAL_CFLAGS += \ |
| 38 | -g -O0 |
| 39 | else |
| 40 | # optimize for size (protobuf glop can get big) |
| 41 | LOCAL_CFLAGS += \ |
| 42 | -Os |
| 43 | endif |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 44 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/src |
| 45 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 46 | LOCAL_SHARED_LIBRARIES := \ |
| 47 | libbase \ |
| 48 | libbinder \ |
Kweku Adams | eadd123 | 2018-02-05 16:45:13 -0800 | [diff] [blame] | 49 | libdebuggerd_client \ |
| 50 | libdumputils \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 51 | libincident \ |
| 52 | liblog \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 53 | libprotoutil \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 54 | libservices \ |
| 55 | libutils |
| 56 | |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 57 | LOCAL_MODULE_CLASS := EXECUTABLES |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 58 | |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 59 | gen_src_dir := $(local-generated-sources-dir) |
| 60 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 61 | # generate section_list.cpp |
| 62 | GEN_LIST := $(gen_src_dir)/src/section_list.cpp |
| 63 | $(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen |
| 64 | $(GEN_LIST): PRIVATE_CUSTOM_TOOL = \ |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 65 | $(HOST_OUT_EXECUTABLES)/incident-section-gen incidentd > $@ |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 66 | $(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 67 | $(transform-generated-source) |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 68 | LOCAL_GENERATED_SOURCES += $(GEN_LIST) |
| 69 | GEN_LIST:= |
| 70 | |
| 71 | # generate cppstream proto, add proto files to PROTO_FILES |
| 72 | GEN_PROTO := $(gen_src_dir)/proto.timestamp |
| 73 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES) |
| 74 | $(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir) |
| 75 | $(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \ |
| 76 | $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \ |
| 77 | --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \ |
| 78 | $(PROTO_FILES) \ |
| 79 | && touch $@ |
| 80 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc |
| 81 | $(transform-generated-source) |
| 82 | LOCAL_GENERATED_SOURCES += $(GEN_PROTO) |
| 83 | GEN_PROTO:= |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 84 | |
| 85 | gen_src_dir:= |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 86 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 87 | LOCAL_INIT_RC := incidentd.rc |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 88 | |
| 89 | include $(BUILD_EXECUTABLE) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 90 | |
| 91 | # ============== # |
| 92 | # incidentd_test # |
| 93 | # ============== # |
| 94 | |
| 95 | include $(CLEAR_VARS) |
| 96 | |
| 97 | LOCAL_MODULE := incidentd_test |
| 98 | LOCAL_COMPATIBILITY_SUITE := device-tests |
| 99 | LOCAL_MODULE_TAGS := tests |
| 100 | |
| 101 | LOCAL_CFLAGS := -Werror -Wall -Wno-unused-variable -Wunused-parameter |
| 102 | |
| 103 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/src |
| 104 | |
Yi Jin | 4e84310 | 2018-02-14 15:36:18 -0800 | [diff] [blame] | 105 | LOCAL_SRC_FILES := $(call all-cpp-files-under, tests) \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 106 | src/PrivacyBuffer.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 107 | src/FdBuffer.cpp \ |
Yi Jin | 99c248f | 2017-08-25 18:11:58 -0700 | [diff] [blame] | 108 | src/Privacy.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 109 | src/Reporter.cpp \ |
| 110 | src/Section.cpp \ |
Yi Jin | 4e84310 | 2018-02-14 15:36:18 -0800 | [diff] [blame] | 111 | src/Throttler.cpp \ |
Yi Jin | b592e3b | 2018-02-01 15:17:04 -0800 | [diff] [blame] | 112 | src/incidentd_util.cpp \ |
Yi Jin | add11e9 | 2017-07-30 16:10:07 -0700 | [diff] [blame] | 113 | src/report_directory.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 114 | |
| 115 | LOCAL_STATIC_LIBRARIES := \ |
| 116 | libgmock \ |
| 117 | |
| 118 | LOCAL_SHARED_LIBRARIES := \ |
| 119 | libbase \ |
| 120 | libbinder \ |
Kweku Adams | eadd123 | 2018-02-05 16:45:13 -0800 | [diff] [blame] | 121 | libdebuggerd_client \ |
| 122 | libdumputils \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 123 | libincident \ |
| 124 | liblog \ |
Yi Jin | 437aa6e | 2018-01-10 11:34:26 -0800 | [diff] [blame] | 125 | libprotobuf-cpp-lite \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 126 | libprotoutil \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 127 | libservices \ |
| 128 | libutils \ |
| 129 | |
Yi Jin | 5e4ce2c | 2017-11-13 21:06:26 -0800 | [diff] [blame] | 130 | LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, testdata) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 131 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 132 | LOCAL_MODULE_CLASS := NATIVE_TESTS |
| 133 | gen_src_dir := $(local-generated-sources-dir) |
| 134 | # generate cppstream proto for testing |
Yi Jin | 1a11fa1 | 2018-02-22 16:44:10 -0800 | [diff] [blame] | 135 | GEN_PROTO := $(gen_src_dir)/test.proto.timestamp |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 136 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES) |
| 137 | $(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir) |
| 138 | $(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \ |
| 139 | $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \ |
| 140 | --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \ |
| 141 | $(PROTO_FILES) \ |
| 142 | && touch $@ |
| 143 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc |
| 144 | $(transform-generated-source) |
| 145 | LOCAL_GENERATED_SOURCES += $(GEN_PROTO) |
| 146 | GEN_PROTO:= |
| 147 | |
| 148 | gen_src_dir:= |
| 149 | |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 150 | include $(BUILD_NATIVE_TEST) |