blob: 2424dba75b2418dd03a2d047f3205188294774de [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",
24]
25liblog_host_sources = [
Dan Willemsen489ca272015-09-16 15:54:14 -070026 "fake_log_device.c",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080027 "fake_writer.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070028]
29liblog_target_sources = [
Mark Salyzyna4097592016-11-21 12:00:03 -080030 "event_tag_map.cpp",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080031 "config_read.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070032 "log_time.cpp",
Mark Salyzyn21bc9ad2016-12-14 12:52:50 -080033 "properties.c",
Dan Willemsen489ca272015-09-16 15:54:14 -070034 "logprint.c",
Mark Salyzyn6cdd5312016-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 Willemsen489ca272015-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 Salyzyn6cdd5312016-03-01 13:45:42 -080048 srcs: liblog_sources,
49
Dan Willemsen489ca272015-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 Crossd7b701c2016-04-07 13:30:22 -070058 sanitize: {
59 never: true,
60 },
Dan Willemsen489ca272015-09-16 15:54:14 -070061 },
62 android_arm: {
Dmitriy Ivanov35cea272015-09-28 10:40:35 -070063 // TODO: This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen489ca272015-09-16 15:54:14 -070064 ldflags: ["-Wl,--hash-style=both"],
65 },
66 windows: {
67 srcs: ["uio.c"],
Dan Willemsen34a3d492015-11-30 15:35:09 -080068 enabled: true,
Dan Willemsen489ca272015-09-16 15:54:14 -070069 },
70 not_windows: {
Mark Salyzyna4097592016-11-21 12:00:03 -080071 srcs: ["event_tag_map.cpp"],
Dan Willemsen489ca272015-09-16 15:54:14 -070072 },
73 linux: {
74 host_ldlibs: ["-lrt"],
75 },
Dan Willemsena00f44a2016-11-29 13:39:55 -080076 linux_bionic: {
77 enabled: true,
78 },
Dan Willemsen489ca272015-09-16 15:54:14 -070079 },
80
81 cflags: [
82 "-Werror",
Mark Salyzyn6cdd5312016-03-01 13:45:42 -080083 "-fvisibility=hidden",
Dan Willemsen489ca272015-09-16 15:54:14 -070084 // This is what we want to do:
85 // liblog_cflags := $(shell \
86 // sed -n \
87 // 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
88 // $(LOCAL_PATH)/event.logtags)
89 // so make sure we do not regret hard-coding it as follows:
Mark Salyzyn74e408e2016-09-12 14:51:48 -070090 "-DLIBLOG_LOG_TAG=1006",
Mark Salyzyn509c1422016-03-25 15:50:46 -070091 "-DSNET_EVENT_LOG_TAG=1397638484",
Dan Willemsen489ca272015-09-16 15:54:14 -070092 ],
Dan Willemsen1fdb20d2016-06-01 15:32:35 -070093 logtags: ["event.logtags"],
Dan Willemsen489ca272015-09-16 15:54:14 -070094 compile_multilib: "both",
Dan Willemsen489ca272015-09-16 15:54:14 -070095}
Dan Albert0eb04bf2016-09-23 15:43:23 -070096
Dan Albert6de176a2016-10-05 13:47:31 -070097// system/core/android/log.h needs some work before it can be included in the
98// NDK. It defines a *lot* of macros that previously were usable names in NDK
99// sources that used android/log.h. As an example, the following file defines
100// LOG_TAG as a variable, but the variable name gets macro replaced if we use
101// the current android/log.h.
102// https://android.googlesource.com/platform/external/deqp/+/4adc1515f867b26c19c2f7498e9de93a230a234d/framework/platform/android/tcuTestLogParserJNI.cpp#41
103//
104// For now, we keep a copy of the old NDK android/log.h in legacy-ndk-includes.
105ndk_headers {
106 name: "liblog_headers",
107 from: "legacy-ndk-includes",
108 to: "android",
109 srcs: ["legacy-ndk-includes/log.h"],
Dan Albert17587a12016-10-20 10:18:27 -0700110 license: "NOTICE",
Dan Albert6de176a2016-10-05 13:47:31 -0700111}
112
Dan Albert0eb04bf2016-09-23 15:43:23 -0700113ndk_library {
114 name: "liblog.ndk",
115 symbol_file: "liblog.map.txt",
116 first_version: "9",
117}