blob: 40cdcee11f863662d8fe8b61f5b8aead6d5b051a [file] [log] [blame]
Dan Willemsen489ca272015-09-16 15:54:14 -07001//
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 Salyzyn6cdd5312016-03-01 13:45:42 -080017liblog_sources = [
18 "log_event_list.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070019 "log_event_write.c",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080020 "logger_write.c",
21 "config_write.c",
22 "logger_name.c",
23 "logger_lock.c",
Mark Salyzyneaece252016-12-14 12:52:50 -080024 "log_ratelimit.cpp",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080025]
26liblog_host_sources = [
Dan Willemsen489ca272015-09-16 15:54:14 -070027 "fake_log_device.c",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080028 "fake_writer.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070029]
30liblog_target_sources = [
Mark Salyzyna4097592016-11-21 12:00:03 -080031 "event_tag_map.cpp",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080032 "config_read.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070033 "log_time.cpp",
Mark Salyzyn21bc9ad2016-12-14 12:52:50 -080034 "properties.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070035 "logprint.c",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080036 "pmsg_reader.c",
37 "pmsg_writer.c",
38 "logd_reader.c",
39 "logd_writer.c",
40 "logger_read.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070041]
42
43// Shared and static library for host and device
44// ========================================================
45cc_library {
46 name: "liblog",
47 host_supported: true,
48
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080049 srcs: liblog_sources,
50
Dan Willemsen489ca272015-09-16 15:54:14 -070051 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 Crossd7b701c2016-04-07 13:30:22 -070059 sanitize: {
Evgenii Stepanov37115612016-11-29 15:02:30 -080060 address: false,
Colin Crossd7b701c2016-04-07 13:30:22 -070061 },
Dan Willemsen489ca272015-09-16 15:54:14 -070062 },
63 android_arm: {
Dmitriy Ivanov35cea272015-09-28 10:40:35 -070064 // TODO: This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen489ca272015-09-16 15:54:14 -070065 ldflags: ["-Wl,--hash-style=both"],
66 },
67 windows: {
68 srcs: ["uio.c"],
Dan Willemsen34a3d492015-11-30 15:35:09 -080069 enabled: true,
Dan Willemsen489ca272015-09-16 15:54:14 -070070 },
71 not_windows: {
Mark Salyzyna4097592016-11-21 12:00:03 -080072 srcs: ["event_tag_map.cpp"],
Dan Willemsen489ca272015-09-16 15:54:14 -070073 },
74 linux: {
75 host_ldlibs: ["-lrt"],
76 },
Dan Willemsena00f44a2016-11-29 13:39:55 -080077 linux_bionic: {
78 enabled: true,
79 },
Dan Willemsen489ca272015-09-16 15:54:14 -070080 },
81
82 cflags: [
83 "-Werror",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080084 "-fvisibility=hidden",
Dan Willemsen489ca272015-09-16 15:54:14 -070085 // 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 Salyzyn74e408e2016-09-12 14:51:48 -070091 "-DLIBLOG_LOG_TAG=1006",
Mark Salyzyn509c1422016-03-25 15:50:46 -070092 "-DSNET_EVENT_LOG_TAG=1397638484",
Dan Willemsen489ca272015-09-16 15:54:14 -070093 ],
Dan Willemsen1fdb20d2016-06-01 15:32:35 -070094 logtags: ["event.logtags"],
Dan Willemsen489ca272015-09-16 15:54:14 -070095 compile_multilib: "both",
Dan Willemsen489ca272015-09-16 15:54:14 -070096}
Dan Albert0eb04bf2016-09-23 15:43:23 -070097
Dan Albert6de176a2016-10-05 13:47:31 -070098// 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.
106ndk_headers {
107 name: "liblog_headers",
108 from: "legacy-ndk-includes",
109 to: "android",
110 srcs: ["legacy-ndk-includes/log.h"],
Dan Albert17587a12016-10-20 10:18:27 -0700111 license: "NOTICE",
Dan Albert6de176a2016-10-05 13:47:31 -0700112}
113
Dan Albert0eb04bf2016-09-23 15:43:23 -0700114ndk_library {
115 name: "liblog.ndk",
116 symbol_file: "liblog.map.txt",
117 first_version: "9",
Dan Albert89ebcb72017-01-05 15:55:49 -0800118 unversioned_until: "current",
Dan Albert0eb04bf2016-09-23 15:43:23 -0700119}