aboutsummaryrefslogtreecommitdiff
path: root/Android.mk
blob: 9782e6f8798f50d9b94cd222a73ef1fc397d4aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Copyright (C) 2016 The Android Open Source Project
# Copyright (C) 2016 Linaro Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := $(call my-dir)

tcmalloc_common_cflags := \
	-Wno-unused-parameter \
	-Werror \
    -D__linux__\

tcmalloc_cppflags := \
    -Wall \
    -Wno-sign-compare \
    -Wno-unused-parameter \
    -Wno-unused-variable \
    -Werror \
    -std=gnu++11 \
    -Wno-missing-field-initializers \
    -Doff64_t=__off64_t \
    -Wno-unused-function \
    -Wno-unused-local-typedef \
    -Wno-unused-const-variable \
    -fno-exceptions \
    -DNO_TCMALLOC_SAMPLES \
    -DNO_HEAP_CHECK \
    -DHAVE_STRUCT_MALLINFO \
    -DNDEBUG \
    -DTCMALLOC_DONT_REPLACE_SYSTEM_ALLOC \
    -DLINARO_ANDPORT=1

tcmalloc_common_c_includes := \
	$(LOCAL_PATH)/src \
	$(LOCAL_PATH)/src/gperftools \
    external/valgrind/include

libtcmalloc_minimal_internal_SOURCES := \
    src/common.cc \
    src/internal_logging.cc \
    src/system-alloc.cc \
    src/memfs_malloc.cc \
    src/central_freelist.cc \
    src/page_heap.cc \
    src/sampler.cc \
    src/span.cc \
    src/stack_trace_table.cc \
    src/static_vars.cc \
    src/symbolize.cc \
    src/thread_cache.cc \
    src/malloc_hook.cc \
    src/malloc_extension.cc

libtcmalloc_minimal_src := \
    src/base/dynamic_annotations.c \
    src/base/abort.cc \
    src/free_list.cc \
    src/tcmalloc.cc \
    src/central_freelist.cc \
    src/common.cc \
    src/internal_logging.cc \
    src/malloc_extension.cc \
    src/malloc_hook.cc \
    src/page_heap.cc \
    src/sampler.cc \
    src/span.cc \
    src/stack_trace_table.cc \
    src/static_vars.cc \
    src/symbolize.cc \
    src/thread_cache.cc \
    src/system-alloc.cc \
    src/base/logging.cc \
    src/maybe_threads.cc \
    src/base/sysinfo.cc \
    src/base/spinlock.cc \
    src/base/spinlock_internal.cc \
    src/memfs_malloc.cc \

#-----------------------------------------------------------------------
# tcmalloc static library
#-----------------------------------------------------------------------
include $(CLEAR_VARS)
#LOCAL_CLANG := true
LOCAL_CPP_EXTENSION := cc
LOCAL_CPPFLAGS += $(tcmalloc_cppflags)
#LOCAL_MODULE_TAGS := eng debug

LOCAL_CFLAGS := \
    $(tcmalloc_common_cflags) \

LOCAL_C_INCLUDES := \
    $(tcmalloc_common_c_includes) \

LOCAL_SRC_FILES := \
	$(libtcmalloc_minimal_src) \

# This is linked into libc, which asan runtime library depends on.
LOCAL_LDLIBS := -llog -lm

LOCAL_EXPORT_CFLAGS := $(tcmalloc_common_cflags)
LOCAL_EXPORT_CPPFLAGS := $(tcmalloc_cppflags)
LOCAL_EXPORT_C_INCLUDES := $(tcmalloc_common_c_includes)    
LOCAL_EXPORT_LDLIBS := -llog -lm   
LOCAL_MODULE := libtcmalloc
include $(BUILD_STATIC_LIBRARY)