Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 1 | // Copyright (C) 2017 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 | // This is what we want to do: |
| 16 | // event_logtags = $(shell |
| 17 | // sed -n |
| 18 | // "s/^\([0-9]*\)[ \t]*$1[ \t].*/-D`echo $1 | tr a-z A-Z`_LOG_TAG=\1/p" |
| 19 | // $(LOCAL_PATH)/$2/event.logtags) |
| 20 | // event_flag := $(call event_logtags,auditd) |
| 21 | // event_flag += $(call event_logtags,logd) |
| 22 | // event_flag += $(call event_logtags,tag_def) |
| 23 | // so make sure we do not regret hard-coding it as follows: |
| 24 | event_flag = [ |
| 25 | "-DAUDITD_LOG_TAG=1003", |
| 26 | "-DCHATTY_LOG_TAG=1004", |
| 27 | "-DTAG_DEF_LOG_TAG=1005", |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 28 | "-DLIBLOG_LOG_TAG=1006", |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 29 | ] |
| 30 | |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 31 | cc_defaults { |
| 32 | name: "logd_defaults", |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 33 | |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 34 | shared_libs: [ |
| 35 | "libbase", |
| 36 | "libz", |
| 37 | ], |
| 38 | static_libs: ["libzstd"], |
Tom Cherry | 053daca | 2020-04-29 15:38:19 -0700 | [diff] [blame] | 39 | cflags: [ |
| 40 | "-Wextra", |
Tom Cherry | 64e9016 | 2020-05-07 14:44:43 -0700 | [diff] [blame] | 41 | "-Wthread-safety", |
Tom Cherry | 053daca | 2020-04-29 15:38:19 -0700 | [diff] [blame] | 42 | ] + event_flag, |
Tom Cherry | 72f1aa8 | 2020-05-13 11:03:08 -0700 | [diff] [blame] | 43 | |
| 44 | lto: { |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 45 | thin: true, |
| 46 | }, |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 47 | cpp_std: "experimental", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | cc_library_static { |
| 51 | name: "liblogd", |
| 52 | defaults: ["logd_defaults"], |
Tom Cherry | a515197 | 2020-05-15 11:39:58 -0700 | [diff] [blame] | 53 | host_supported: true, |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 54 | srcs: [ |
| 55 | "ChattyLogBuffer.cpp", |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 56 | "CompressionEngine.cpp", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 57 | "LogReaderList.cpp", |
| 58 | "LogReaderThread.cpp", |
| 59 | "LogBufferElement.cpp", |
Tom Cherry | 39dc221 | 2020-08-05 12:14:45 -0700 | [diff] [blame^] | 60 | "LogSize.cpp", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 61 | "LogStatistics.cpp", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 62 | "LogTags.cpp", |
Tom Cherry | 0efb410 | 2020-06-16 10:14:09 -0700 | [diff] [blame] | 63 | "PruneList.cpp", |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 64 | "SerializedFlushToState.cpp", |
| 65 | "SerializedLogBuffer.cpp", |
| 66 | "SerializedLogChunk.cpp", |
Tom Cherry | 8f61346 | 2020-05-12 12:46:43 -0700 | [diff] [blame] | 67 | "SimpleLogBuffer.cpp", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 68 | ], |
| 69 | logtags: ["event.logtags"], |
| 70 | |
| 71 | export_include_dirs: ["."], |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | cc_binary { |
| 75 | name: "logd", |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 76 | defaults: ["logd_defaults"], |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 77 | init_rc: ["logd.rc"], |
| 78 | |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 79 | srcs: [ |
| 80 | "main.cpp", |
| 81 | "LogPermissions.cpp", |
| 82 | "CommandListener.cpp", |
| 83 | "LogListener.cpp", |
| 84 | "LogReader.cpp", |
| 85 | "LogAudit.cpp", |
| 86 | "LogKlog.cpp", |
| 87 | "libaudit.cpp", |
| 88 | ], |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 89 | |
Tom Cherry | 9e12433 | 2019-01-17 11:37:22 -0800 | [diff] [blame] | 90 | static_libs: [ |
| 91 | "liblog", |
| 92 | "liblogd", |
| 93 | ], |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 94 | |
| 95 | shared_libs: [ |
| 96 | "libsysutils", |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 97 | "libcutils", |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 98 | "libpackagelistparser", |
Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 99 | "libprocessgroup", |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 100 | "libcap", |
| 101 | ], |
Steven Moreland | fca20d8 | 2017-06-27 18:20:18 -0700 | [diff] [blame] | 102 | } |
Sasha Smundak | 3a62fc4 | 2019-01-24 21:16:39 -0800 | [diff] [blame] | 103 | |
Nick Kralevich | be5e446 | 2019-04-09 10:59:39 -0700 | [diff] [blame] | 104 | cc_binary { |
| 105 | name: "auditctl", |
| 106 | |
Tom Cherry | 7395396 | 2020-05-15 10:58:43 -0700 | [diff] [blame] | 107 | srcs: [ |
| 108 | "auditctl.cpp", |
| 109 | "libaudit.cpp", |
Nick Kralevich | be5e446 | 2019-04-09 10:59:39 -0700 | [diff] [blame] | 110 | ], |
| 111 | |
| 112 | shared_libs: ["libbase"], |
| 113 | |
| 114 | cflags: [ |
Nick Kralevich | be5e446 | 2019-04-09 10:59:39 -0700 | [diff] [blame] | 115 | "-Wextra", |
Nick Kralevich | be5e446 | 2019-04-09 10:59:39 -0700 | [diff] [blame] | 116 | ], |
| 117 | } |
Sasha Smundak | 3a62fc4 | 2019-01-24 21:16:39 -0800 | [diff] [blame] | 118 | |
| 119 | prebuilt_etc { |
| 120 | name: "logtagd.rc", |
| 121 | src: "logtagd.rc", |
| 122 | sub_dir: "init", |
| 123 | } |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 124 | |
| 125 | // ----------------------------------------------------------------------------- |
| 126 | // Unit tests. |
| 127 | // ----------------------------------------------------------------------------- |
| 128 | |
| 129 | cc_defaults { |
| 130 | name: "logd-unit-test-defaults", |
| 131 | |
| 132 | cflags: [ |
| 133 | "-fstack-protector-all", |
| 134 | "-g", |
| 135 | "-Wall", |
| 136 | "-Wextra", |
| 137 | "-Werror", |
| 138 | "-fno-builtin", |
Tom Cherry | b398a7c | 2020-05-20 12:09:22 -0700 | [diff] [blame] | 139 | ] + event_flag, |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 140 | |
| 141 | srcs: [ |
Tom Cherry | e18346d | 2020-05-21 12:13:20 -0700 | [diff] [blame] | 142 | "ChattyLogBufferTest.cpp", |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 143 | "logd_test.cpp", |
| 144 | "LogBufferTest.cpp", |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 145 | "SerializedLogChunkTest.cpp", |
| 146 | "SerializedFlushToStateTest.cpp", |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 147 | ], |
| 148 | |
| 149 | static_libs: [ |
| 150 | "libbase", |
| 151 | "libcutils", |
| 152 | "liblog", |
| 153 | "liblogd", |
| 154 | "libselinux", |
Tom Cherry | 1a796bc | 2020-05-13 09:28:37 -0700 | [diff] [blame] | 155 | "libz", |
| 156 | "libzstd", |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 157 | ], |
| 158 | } |
| 159 | |
| 160 | // Build tests for the logger. Run with: |
| 161 | // adb shell /data/nativetest/logd-unit-tests/logd-unit-tests |
| 162 | cc_test { |
| 163 | name: "logd-unit-tests", |
Tom Cherry | a515197 | 2020-05-15 11:39:58 -0700 | [diff] [blame] | 164 | host_supported: true, |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 165 | defaults: ["logd-unit-test-defaults"], |
| 166 | } |
| 167 | |
| 168 | cc_test { |
| 169 | name: "CtsLogdTestCases", |
| 170 | defaults: ["logd-unit-test-defaults"], |
| 171 | multilib: { |
| 172 | lib32: { |
| 173 | suffix: "32", |
| 174 | }, |
| 175 | lib64: { |
| 176 | suffix: "64", |
| 177 | }, |
| 178 | }, |
| 179 | test_suites: [ |
| 180 | "cts", |
Tom Cherry | b4bc99e | 2020-07-28 13:21:13 -0700 | [diff] [blame] | 181 | "device-tests", |
Tom Cherry | 43f3f76 | 2020-05-14 22:28:09 -0700 | [diff] [blame] | 182 | "vts10", |
| 183 | ], |
| 184 | } |
Tom Cherry | ec39a3f | 2020-07-09 09:51:16 -0700 | [diff] [blame] | 185 | |
| 186 | cc_binary { |
| 187 | name: "replay_messages", |
| 188 | defaults: ["logd_defaults"], |
| 189 | host_supported: true, |
| 190 | |
| 191 | srcs: [ |
| 192 | "ReplayMessages.cpp", |
| 193 | ], |
| 194 | |
| 195 | static_libs: [ |
| 196 | "libbase", |
| 197 | "libcutils", |
| 198 | "liblog", |
| 199 | "liblogd", |
| 200 | "libselinux", |
| 201 | "libz", |
| 202 | "libzstd", |
| 203 | ], |
| 204 | } |