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