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#
16LOCAL_PATH := $(my-dir)
17include $(CLEAR_VARS)
18
19ifneq ($(TARGET_USES_LOGD),false)
20liblog_sources := logd_write.c
21else
22liblog_sources := logd_write_kern.c
23endif
24
25# some files must not be compiled when building against Mingw
26# they correspond to features not used by our host development tools
27# which are also hard or even impossible to port to native Win32
28WITH_MINGW :=
29ifeq ($(HOST_OS),windows)
30    ifeq ($(strip $(USE_CYGWIN)),)
31        WITH_MINGW := true
32    endif
33endif
34# USE_MINGW is defined when we build against Mingw on Linux
35ifneq ($(strip $(USE_MINGW)),)
36    WITH_MINGW := true
37endif
38
39ifndef WITH_MINGW
40    liblog_sources += \
41        logprint.c \
42        event_tag_map.c
43else
44    liblog_sources += \
45        uio.c
46endif
47
48liblog_host_sources := $(liblog_sources) fake_log_device.c
49liblog_target_sources := $(liblog_sources) log_time.cpp
50ifneq ($(TARGET_USES_LOGD),false)
51liblog_target_sources += log_read.c
52else
53liblog_target_sources += log_read_kern.c
54endif
55
56# Shared and static library for host
57# ========================================================
58LOCAL_MODULE := liblog
59LOCAL_SRC_FILES := $(liblog_host_sources)
60LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror
61LOCAL_MULTILIB := both
62include $(BUILD_HOST_STATIC_LIBRARY)
63
64include $(CLEAR_VARS)
65LOCAL_MODULE := liblog
66LOCAL_WHOLE_STATIC_LIBRARIES := liblog
67ifeq ($(strip $(HOST_OS)),linux)
68LOCAL_LDLIBS := -lrt
69endif
70LOCAL_MULTILIB := both
71include $(BUILD_HOST_SHARED_LIBRARY)
72
73
74# Shared and static library for target
75# ========================================================
76include $(CLEAR_VARS)
77LOCAL_MODULE := liblog
78LOCAL_SRC_FILES := $(liblog_target_sources)
79LOCAL_CFLAGS := -Werror
80include $(BUILD_STATIC_LIBRARY)
81
82include $(CLEAR_VARS)
83LOCAL_MODULE := liblog
84LOCAL_WHOLE_STATIC_LIBRARIES := liblog
85LOCAL_CFLAGS := -Werror
86include $(BUILD_SHARED_LIBRARY)
87
88include $(call first-makefiles-under,$(LOCAL_PATH))
89