Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2008-2014 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 17 | liblog_sources = [ |
| 18 | "log_event_list.c", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 19 | "log_event_write.c", |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 20 | "logger_write.c", |
| 21 | "config_write.c", |
| 22 | "logger_name.c", |
| 23 | "logger_lock.c", |
| 24 | ] |
| 25 | liblog_host_sources = [ |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 26 | "fake_log_device.c", |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 27 | "fake_writer.c", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 28 | ] |
| 29 | liblog_target_sources = [ |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 30 | "event_tag_map.c", |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 31 | "config_read.c", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 32 | "log_time.cpp", |
| 33 | "log_is_loggable.c", |
| 34 | "logprint.c", |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 35 | "pmsg_reader.c", |
| 36 | "pmsg_writer.c", |
| 37 | "logd_reader.c", |
| 38 | "logd_writer.c", |
| 39 | "logger_read.c", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 40 | ] |
| 41 | |
| 42 | // Shared and static library for host and device |
| 43 | // ======================================================== |
| 44 | cc_library { |
| 45 | name: "liblog", |
| 46 | host_supported: true, |
| 47 | |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 48 | srcs: liblog_sources, |
| 49 | |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 50 | target: { |
| 51 | host: { |
| 52 | srcs: liblog_host_sources, |
| 53 | cflags: ["-DFAKE_LOG_DEVICE=1"], |
| 54 | }, |
| 55 | android: { |
| 56 | srcs: liblog_target_sources, |
| 57 | // AddressSanitizer runtime library depends on liblog. |
Colin Cross | 5d35ce6 | 2016-04-07 13:30:22 -0700 | [diff] [blame] | 58 | sanitize: { |
| 59 | never: true, |
| 60 | }, |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 61 | }, |
| 62 | android_arm: { |
Dmitriy Ivanov | 58558a5 | 2015-09-28 10:40:35 -0700 | [diff] [blame] | 63 | // TODO: This is to work around b/24465209. Remove after root cause is fixed |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 64 | ldflags: ["-Wl,--hash-style=both"], |
| 65 | }, |
| 66 | windows: { |
| 67 | srcs: ["uio.c"], |
Dan Willemsen | a3f41bf | 2015-11-30 15:35:09 -0800 | [diff] [blame] | 68 | enabled: true, |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 69 | }, |
| 70 | not_windows: { |
| 71 | srcs: ["event_tag_map.c"], |
| 72 | }, |
| 73 | linux: { |
| 74 | host_ldlibs: ["-lrt"], |
| 75 | }, |
| 76 | }, |
| 77 | |
| 78 | cflags: [ |
| 79 | "-Werror", |
Mark Salyzyn | 93101be | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 80 | "-fvisibility=hidden", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 81 | // This is what we want to do: |
| 82 | // liblog_cflags := $(shell \ |
| 83 | // sed -n \ |
| 84 | // 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \ |
| 85 | // $(LOCAL_PATH)/event.logtags) |
| 86 | // so make sure we do not regret hard-coding it as follows: |
Mark Salyzyn | 9633b91 | 2016-09-12 14:51:48 -0700 | [diff] [blame] | 87 | "-DLIBLOG_LOG_TAG=1006", |
Mark Salyzyn | 7ef5249 | 2016-03-25 15:50:46 -0700 | [diff] [blame] | 88 | "-DSNET_EVENT_LOG_TAG=1397638484", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 89 | ], |
Dan Willemsen | d119101 | 2016-06-01 15:32:35 -0700 | [diff] [blame] | 90 | logtags: ["event.logtags"], |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 91 | compile_multilib: "both", |
Dan Willemsen | 63aa47a | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 92 | } |
Dan Albert | ddce8c7 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 93 | |
Dan Albert | b7c3996 | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 94 | // system/core/android/log.h needs some work before it can be included in the |
| 95 | // NDK. It defines a *lot* of macros that previously were usable names in NDK |
| 96 | // sources that used android/log.h. As an example, the following file defines |
| 97 | // LOG_TAG as a variable, but the variable name gets macro replaced if we use |
| 98 | // the current android/log.h. |
| 99 | // https://android.googlesource.com/platform/external/deqp/+/4adc1515f867b26c19c2f7498e9de93a230a234d/framework/platform/android/tcuTestLogParserJNI.cpp#41 |
| 100 | // |
| 101 | // For now, we keep a copy of the old NDK android/log.h in legacy-ndk-includes. |
| 102 | ndk_headers { |
| 103 | name: "liblog_headers", |
| 104 | from: "legacy-ndk-includes", |
| 105 | to: "android", |
| 106 | srcs: ["legacy-ndk-includes/log.h"], |
Dan Albert | 286b2ea | 2016-10-20 10:18:27 -0700 | [diff] [blame] | 107 | license: "NOTICE", |
Dan Albert | b7c3996 | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Dan Albert | ddce8c7 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 110 | ndk_library { |
| 111 | name: "liblog.ndk", |
| 112 | symbol_file: "liblog.map.txt", |
| 113 | first_version: "9", |
| 114 | } |