Dan Willemsen | 489ca27 | 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 | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 17 | liblog_sources = [ |
| 18 | "log_event_list.c", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 19 | "log_event_write.c", |
Mark Salyzyn | 6cdd531 | 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", |
Mark Salyzyn | eaece25 | 2016-12-14 12:52:50 -0800 | [diff] [blame] | 24 | "log_ratelimit.cpp", |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 25 | ] |
| 26 | liblog_host_sources = [ |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 27 | "fake_log_device.c", |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 28 | "fake_writer.c", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 29 | ] |
| 30 | liblog_target_sources = [ |
Mark Salyzyn | a409759 | 2016-11-21 12:00:03 -0800 | [diff] [blame] | 31 | "event_tag_map.cpp", |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 32 | "config_read.c", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 33 | "log_time.cpp", |
Mark Salyzyn | 21bc9ad | 2016-12-14 12:52:50 -0800 | [diff] [blame] | 34 | "properties.c", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 35 | "logprint.c", |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 36 | "pmsg_reader.c", |
| 37 | "pmsg_writer.c", |
| 38 | "logd_reader.c", |
| 39 | "logd_writer.c", |
| 40 | "logger_read.c", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 41 | ] |
| 42 | |
| 43 | // Shared and static library for host and device |
| 44 | // ======================================================== |
| 45 | cc_library { |
| 46 | name: "liblog", |
| 47 | host_supported: true, |
| 48 | |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 49 | srcs: liblog_sources, |
| 50 | |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 51 | target: { |
| 52 | host: { |
| 53 | srcs: liblog_host_sources, |
| 54 | cflags: ["-DFAKE_LOG_DEVICE=1"], |
| 55 | }, |
| 56 | android: { |
| 57 | srcs: liblog_target_sources, |
| 58 | // AddressSanitizer runtime library depends on liblog. |
Colin Cross | d7b701c | 2016-04-07 13:30:22 -0700 | [diff] [blame] | 59 | sanitize: { |
Evgenii Stepanov | 3711561 | 2016-11-29 15:02:30 -0800 | [diff] [blame^] | 60 | address: false, |
Colin Cross | d7b701c | 2016-04-07 13:30:22 -0700 | [diff] [blame] | 61 | }, |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 62 | }, |
| 63 | android_arm: { |
Dmitriy Ivanov | 35cea27 | 2015-09-28 10:40:35 -0700 | [diff] [blame] | 64 | // TODO: This is to work around b/24465209. Remove after root cause is fixed |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 65 | ldflags: ["-Wl,--hash-style=both"], |
| 66 | }, |
| 67 | windows: { |
| 68 | srcs: ["uio.c"], |
Dan Willemsen | 34a3d49 | 2015-11-30 15:35:09 -0800 | [diff] [blame] | 69 | enabled: true, |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 70 | }, |
| 71 | not_windows: { |
Mark Salyzyn | a409759 | 2016-11-21 12:00:03 -0800 | [diff] [blame] | 72 | srcs: ["event_tag_map.cpp"], |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 73 | }, |
| 74 | linux: { |
| 75 | host_ldlibs: ["-lrt"], |
| 76 | }, |
Dan Willemsen | a00f44a | 2016-11-29 13:39:55 -0800 | [diff] [blame] | 77 | linux_bionic: { |
| 78 | enabled: true, |
| 79 | }, |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 80 | }, |
| 81 | |
| 82 | cflags: [ |
| 83 | "-Werror", |
Mark Salyzyn | 6cdd531 | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 84 | "-fvisibility=hidden", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 85 | // This is what we want to do: |
| 86 | // liblog_cflags := $(shell \ |
| 87 | // sed -n \ |
| 88 | // 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \ |
| 89 | // $(LOCAL_PATH)/event.logtags) |
| 90 | // so make sure we do not regret hard-coding it as follows: |
Mark Salyzyn | 74e408e | 2016-09-12 14:51:48 -0700 | [diff] [blame] | 91 | "-DLIBLOG_LOG_TAG=1006", |
Mark Salyzyn | 509c142 | 2016-03-25 15:50:46 -0700 | [diff] [blame] | 92 | "-DSNET_EVENT_LOG_TAG=1397638484", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 93 | ], |
Dan Willemsen | 1fdb20d | 2016-06-01 15:32:35 -0700 | [diff] [blame] | 94 | logtags: ["event.logtags"], |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 95 | compile_multilib: "both", |
Dan Willemsen | 489ca27 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 96 | } |
Dan Albert | 0eb04bf | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 97 | |
Dan Albert | 6de176a | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 98 | // system/core/android/log.h needs some work before it can be included in the |
| 99 | // NDK. It defines a *lot* of macros that previously were usable names in NDK |
| 100 | // sources that used android/log.h. As an example, the following file defines |
| 101 | // LOG_TAG as a variable, but the variable name gets macro replaced if we use |
| 102 | // the current android/log.h. |
| 103 | // https://android.googlesource.com/platform/external/deqp/+/4adc1515f867b26c19c2f7498e9de93a230a234d/framework/platform/android/tcuTestLogParserJNI.cpp#41 |
| 104 | // |
| 105 | // For now, we keep a copy of the old NDK android/log.h in legacy-ndk-includes. |
| 106 | ndk_headers { |
| 107 | name: "liblog_headers", |
| 108 | from: "legacy-ndk-includes", |
| 109 | to: "android", |
| 110 | srcs: ["legacy-ndk-includes/log.h"], |
Dan Albert | 17587a1 | 2016-10-20 10:18:27 -0700 | [diff] [blame] | 111 | license: "NOTICE", |
Dan Albert | 6de176a | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Dan Albert | 0eb04bf | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 114 | ndk_library { |
| 115 | name: "liblog.ndk", |
| 116 | symbol_file: "liblog.map.txt", |
| 117 | first_version: "9", |
Dan Albert | 89ebcb7 | 2017-01-05 15:55:49 -0800 | [diff] [blame] | 118 | unversioned_until: "current", |
Dan Albert | 0eb04bf | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 119 | } |