16
16
17
17
LOCAL_PATH := $(call my-dir)
18
18
19
- simpleperf_common_cppflags := -std=c++11 -Wall -Wextra -Werror -Wunused
19
+ simpleperf_common_cppflags := -std=c++11 -Wall -Wextra -Werror -Wunused \
20
20
21
- simpleperf_host_common_cppflags := $(simpleperf_common_cppflags ) \
22
- -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
21
+ simpleperf_cppflags_target := $(simpleperf_common_cppflags ) \
23
22
24
- simpleperf_host_darwin_cppflags := $(simpleperf_host_common_cppflags ) \
25
- -I $( LOCAL_PATH ) /darwin_support \
23
+ simpleperf_cppflags_host := $(simpleperf_common_cppflags ) \
24
+ -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
26
25
27
- simpleperf_common_shared_libraries := \
26
+ simpleperf_cppflags_host_linux := $(simpleperf_cppflags_host ) \
27
+
28
+ simpleperf_cppflags_host_darwin := $(simpleperf_cppflags_host ) \
29
+ -I $(LOCAL_PATH ) /darwin_support/include \
30
+
31
+ LLVM_ROOT_PATH := external/llvm
32
+ include $(LLVM_ROOT_PATH ) /llvm.mk
33
+
34
+ simpleperf_shared_libraries_target := \
35
+ libbacktrace \
28
36
libbase \
29
37
libLLVM \
30
38
31
- LLVM_ROOT_PATH := external/llvm
39
+ simpleperf_shared_libraries_host_linux := \
40
+ libbacktrace \
41
+ libbase \
42
+
43
+ simpleperf_shared_libraries_host_darwin := \
44
+ libbase \
45
+ libLLVM \
46
+
47
+ simpleperf_ldlibs_host_linux := -lrt \
48
+
32
49
33
50
# libsimpleperf
34
51
# =========================================================
35
- libsimpleperf_common_src_files := \
52
+ libsimpleperf_src_files := \
36
53
callchain.cpp \
37
54
cmd_dumprecord.cpp \
38
55
cmd_help.cpp \
@@ -49,113 +66,129 @@ libsimpleperf_common_src_files := \
49
66
thread_tree.cpp \
50
67
utils.cpp \
51
68
52
- libsimpleperf_src_files := \
53
- $(libsimpleperf_common_src_files ) \
69
+ libsimpleperf_src_files_linux := \
54
70
cmd_list.cpp \
55
71
cmd_record.cpp \
56
72
cmd_stat.cpp \
73
+ dwarf_unwind.cpp \
57
74
environment.cpp \
58
75
event_fd.cpp \
59
76
event_selection_set.cpp \
60
77
record_file_writer.cpp \
61
78
workload.cpp \
62
79
63
- libsimpleperf_darwin_src_files := \
64
- $(libsimpleperf_common_src_files ) \
65
- environment_fake.cpp \
80
+ libsimpleperf_src_files_darwin := \
81
+ darwin_support/darwin_support.cpp \
66
82
83
+ # libsimpleperf target
67
84
include $(CLEAR_VARS )
68
85
LOCAL_CLANG := true
69
- LOCAL_CPPFLAGS := $(simpleperf_common_cppflags )
70
- LOCAL_SRC_FILES := $(libsimpleperf_src_files )
71
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
86
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
87
+ LOCAL_SRC_FILES := \
88
+ $(libsimpleperf_src_files ) \
89
+ $(libsimpleperf_src_files_linux ) \
90
+
91
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
92
+ LOCAL_MULTILIB := first
72
93
LOCAL_MODULE := libsimpleperf
73
94
LOCAL_MODULE_TAGS := debug
74
95
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
75
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
76
- include $(LLVM_ROOT_PATH ) /llvm.mk
77
96
include $(LLVM_DEVICE_BUILD_MK )
78
97
include $(BUILD_STATIC_LIBRARY )
79
98
99
+ # libsimpleperf linux host
80
100
ifeq ($(HOST_OS ) ,linux)
81
101
include $(CLEAR_VARS )
82
102
LOCAL_CLANG := true
83
- LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags )
84
- LOCAL_SRC_FILES := $(libsimpleperf_src_files )
85
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
86
- LOCAL_LDLIBS := -lrt
103
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
104
+ LOCAL_SRC_FILES := \
105
+ $(libsimpleperf_src_files ) \
106
+ $(libsimpleperf_src_files_linux ) \
107
+
108
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
109
+ LOCAL_LDLIBS := $(simpleperf_ldlibs_host_linux )
110
+ LOCAL_MULTILIB := first
87
111
LOCAL_MODULE := libsimpleperf
88
112
LOCAL_MODULE_TAGS := optional
89
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
90
- include $(LLVM_ROOT_PATH ) /llvm.mk
91
113
include $(LLVM_HOST_BUILD_MK )
92
114
include $(BUILD_HOST_STATIC_LIBRARY )
93
115
endif
94
116
117
+ # libsimpleperf darwin host
95
118
ifeq ($(HOST_OS ) ,darwin)
96
119
include $(CLEAR_VARS )
97
120
LOCAL_CLANG := true
98
- LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags )
99
- LOCAL_SRC_FILES := $(libsimpleperf_darwin_src_files )
100
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
121
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin )
122
+ LOCAL_SRC_FILES := \
123
+ $(libsimpleperf_src_files ) \
124
+ $(libsimpleperf_src_files_darwin ) \
125
+
126
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_darwin )
127
+ LOCAL_MULTILIB := first
101
128
LOCAL_MODULE := libsimpleperf
102
129
LOCAL_MODULE_TAGS := optional
103
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
104
- include $(LLVM_ROOT_PATH ) /llvm.mk
105
130
include $(LLVM_HOST_BUILD_MK )
106
131
include $(BUILD_HOST_SHARED_LIBRARY )
107
132
endif
108
133
134
+
109
135
# simpleperf
110
136
# =========================================================
137
+
138
+ # simpleperf target
111
139
include $(CLEAR_VARS )
112
140
LOCAL_CLANG := true
113
- LOCAL_CPPFLAGS := $(simpleperf_common_cppflags )
141
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
114
142
LOCAL_SRC_FILES := main.cpp
115
143
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
116
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
144
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
145
+ LOCAL_MULTILIB := first
117
146
LOCAL_MODULE := simpleperf
118
147
LOCAL_MODULE_TAGS := debug
119
148
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
120
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
121
149
include $(BUILD_EXECUTABLE )
122
150
151
+ # simpleperf linux host
123
152
ifeq ($(HOST_OS ) ,linux)
124
153
include $(CLEAR_VARS )
125
154
LOCAL_CLANG := true
126
- LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags )
155
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
127
156
LOCAL_SRC_FILES := main.cpp
128
157
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
129
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
130
- LOCAL_LDLIBS := -lrt
158
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
159
+ LOCAL_MULTILIB := first
160
+ LOCAL_LDLIBS := $(simpleperf_ldlibs_host_linux )
131
161
LOCAL_MODULE := simpleperf
132
162
LOCAL_MODULE_TAGS := optional
133
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
134
163
include $(BUILD_HOST_EXECUTABLE )
135
164
endif
136
165
166
+ # simpleperf darwin host
137
167
ifeq ($(HOST_OS ) ,darwin)
138
168
include $(CLEAR_VARS )
139
169
LOCAL_CLANG := true
140
- LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags )
170
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin )
141
171
LOCAL_SRC_FILES := main.cpp
142
- LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries )
172
+ LOCAL_SHARED_LIBRARIES := \
173
+ libsimpleperf \
174
+ $(simpleperf_shared_libraries_host_darwin ) \
175
+
176
+ LOCAL_MULTILIB := first
143
177
LOCAL_MODULE := simpleperf
144
178
LOCAL_MODULE_TAGS := optional
145
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
146
179
include $(BUILD_HOST_EXECUTABLE )
147
180
endif
148
181
182
+
149
183
# simpleperf_unit_test
150
184
# =========================================================
151
- simpleperf_unit_test_common_src_files := \
185
+ simpleperf_unit_test_src_files := \
152
186
command_test.cpp \
153
187
gtest_main.cpp \
154
188
record_test.cpp \
155
189
sample_tree_test.cpp \
156
190
157
- simpleperf_unit_test_src_files := \
158
- $(simpleperf_unit_test_common_src_files ) \
191
+ simpleperf_unit_test_src_files_linux := \
159
192
cmd_dumprecord_test.cpp \
160
193
cmd_list_test.cpp \
161
194
cmd_record_test.cpp \
@@ -167,38 +200,50 @@ simpleperf_unit_test_src_files := \
167
200
record_file_test.cpp \
168
201
workload_test.cpp \
169
202
203
+ # simpleperf_unit_test target
170
204
include $(CLEAR_VARS )
171
205
LOCAL_CLANG := true
172
- LOCAL_CPPFLAGS := $(simpleperf_common_cppflags )
173
- LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files )
206
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
207
+ LOCAL_SRC_FILES := \
208
+ $(simpleperf_unit_test_src_files ) \
209
+ $(simpleperf_unit_test_src_files_linux ) \
210
+
174
211
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
175
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
212
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
213
+ LOCAL_MULTILIB := first
176
214
LOCAL_MODULE := simpleperf_unit_test
177
215
LOCAL_MODULE_TAGS := optional
178
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
179
216
include $(BUILD_NATIVE_TEST )
180
217
218
+ # simpleperf_unit_test linux host
181
219
ifeq ($(HOST_OS ) ,linux)
182
220
include $(CLEAR_VARS )
183
221
LOCAL_CLANG := true
184
- LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags )
185
- LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files )
222
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
223
+ LOCAL_SRC_FILES := \
224
+ $(simpleperf_unit_test_src_files ) \
225
+ $(simpleperf_unit_test_src_files_linux ) \
226
+
186
227
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
187
- LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries )
228
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
229
+ LOCAL_MULTILIB := first
188
230
LOCAL_MODULE := simpleperf_unit_test
189
231
LOCAL_MODULE_TAGS := optional
190
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
191
232
include $(BUILD_HOST_NATIVE_TEST )
192
233
endif
193
234
235
+ # simpleperf_unit_test darwin host
194
236
ifeq ($(HOST_OS ) ,darwin)
195
237
include $(CLEAR_VARS )
196
238
LOCAL_CLANG := true
197
- LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags )
198
- LOCAL_SRC_FILES := $(simpleperf_unit_test_common_src_files )
199
- LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries )
239
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin )
240
+ LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files )
241
+ LOCAL_SHARED_LIBRARIES := \
242
+ libsimpleperf \
243
+ $(simpleperf_shared_libraries_host_darwin ) \
244
+
245
+ LOCAL_MULTILIB := first
200
246
LOCAL_MODULE := simpleperf_unit_test
201
247
LOCAL_MODULE_TAGS := optional
202
- LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH ) /Android.mk
203
248
include $(BUILD_HOST_NATIVE_TEST )
204
249
endif
0 commit comments