blob: 16aa4fa298be12edcd72eaea73229ae1c92bc232 [file] [log] [blame]
Dan Willemsen63aa47a2015-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 Salyzyn93101be2016-03-01 13:45:42 -080017liblog_sources = [
18 "log_event_list.c",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070019 "log_event_write.c",
Mark Salyzyn93101be2016-03-01 13:45:42 -080020 "logger_write.c",
21 "config_write.c",
22 "logger_name.c",
23 "logger_lock.c",
24]
25liblog_host_sources = [
Dan Willemsen63aa47a2015-09-16 15:54:14 -070026 "fake_log_device.c",
Mark Salyzyn93101be2016-03-01 13:45:42 -080027 "fake_writer.c",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070028]
29liblog_target_sources = [
Dan Willemsen63aa47a2015-09-16 15:54:14 -070030 "event_tag_map.c",
Mark Salyzyn93101be2016-03-01 13:45:42 -080031 "config_read.c",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070032 "log_time.cpp",
33 "log_is_loggable.c",
34 "logprint.c",
Mark Salyzyn93101be2016-03-01 13:45:42 -080035 "pmsg_reader.c",
36 "pmsg_writer.c",
37 "logd_reader.c",
38 "logd_writer.c",
39 "logger_read.c",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070040]
41
42// Shared and static library for host and device
43// ========================================================
44cc_library {
45 name: "liblog",
46 host_supported: true,
47
Mark Salyzyn93101be2016-03-01 13:45:42 -080048 srcs: liblog_sources,
49
Dan Willemsen63aa47a2015-09-16 15:54:14 -070050 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 Cross5d35ce62016-04-07 13:30:22 -070058 sanitize: {
59 never: true,
60 },
Dan Willemsen63aa47a2015-09-16 15:54:14 -070061 },
62 android_arm: {
Dmitriy Ivanov58558a52015-09-28 10:40:35 -070063 // TODO: This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen63aa47a2015-09-16 15:54:14 -070064 ldflags: ["-Wl,--hash-style=both"],
65 },
66 windows: {
67 srcs: ["uio.c"],
Dan Willemsena3f41bf2015-11-30 15:35:09 -080068 enabled: true,
Dan Willemsen63aa47a2015-09-16 15:54:14 -070069 },
70 not_windows: {
71 srcs: ["event_tag_map.c"],
72 },
73 linux: {
74 host_ldlibs: ["-lrt"],
75 },
76 },
77
78 cflags: [
79 "-Werror",
Mark Salyzyn93101be2016-03-01 13:45:42 -080080 "-fvisibility=hidden",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070081 // 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 Salyzyn9633b912016-09-12 14:51:48 -070087 "-DLIBLOG_LOG_TAG=1006",
Mark Salyzyn7ef52492016-03-25 15:50:46 -070088 "-DSNET_EVENT_LOG_TAG=1397638484",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070089 ],
Dan Willemsend1191012016-06-01 15:32:35 -070090 logtags: ["event.logtags"],
Dan Willemsen63aa47a2015-09-16 15:54:14 -070091 compile_multilib: "both",
Dan Willemsen63aa47a2015-09-16 15:54:14 -070092}
Dan Albertddce8c72016-09-23 15:43:23 -070093
Dan Albertb7c39962016-10-05 13:47:31 -070094// 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.
102ndk_headers {
103 name: "liblog_headers",
104 from: "legacy-ndk-includes",
105 to: "android",
106 srcs: ["legacy-ndk-includes/log.h"],
Dan Albert286b2ea2016-10-20 10:18:27 -0700107 license: "NOTICE",
Dan Albertb7c39962016-10-05 13:47:31 -0700108}
109
Dan Albertddce8c72016-09-23 15:43:23 -0700110ndk_library {
111 name: "liblog.ndk",
112 symbol_file: "liblog.map.txt",
113 first_version: "9",
114}