16
16
17
17
LOCAL_PATH := $(call my-dir)
18
18
19
- simpleperf_common_cppflags := -Wall - Wextra -Werror - Wunused \
19
+ simpleperf_common_cppflags := -Wextra -Wunused -Wno-unknown-pragmas
20
20
21
- simpleperf_cppflags_target := $(simpleperf_common_cppflags ) \
21
+ simpleperf_cppflags_target := $(simpleperf_common_cppflags )
22
22
23
23
simpleperf_cppflags_host := $(simpleperf_common_cppflags ) \
24
24
-DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
25
25
26
- simpleperf_cppflags_host_linux := $(simpleperf_cppflags_host ) \
26
+ simpleperf_cppflags_host_darwin := -I $(LOCAL_PATH ) /nonlinux_support/include
27
+ simpleperf_cppflags_host_windows := -I $(LOCAL_PATH ) /nonlinux_support/include
27
28
28
- simpleperf_cppflags_host_darwin := $(simpleperf_cppflags_host ) \
29
- -I $(LOCAL_PATH ) /darwin_support/include \
30
29
31
30
LLVM_ROOT_PATH := external/llvm
32
31
include $(LLVM_ROOT_PATH ) /llvm.mk
@@ -36,15 +35,15 @@ simpleperf_shared_libraries_target := \
36
35
libbase \
37
36
libLLVM \
38
37
39
- simpleperf_shared_libraries_host_linux := \
40
- libbacktrace \
41
- libbase \
38
+ simpleperf_shared_libraries_host := libbase
42
39
43
- simpleperf_shared_libraries_host_darwin := \
44
- libbase \
45
- libLLVM \
40
+ simpleperf_shared_libraries_host_linux := libbacktrace
41
+
42
+ simpleperf_shared_libraries_host_darwin := libLLVM
46
43
47
- simpleperf_ldlibs_host_linux := -lrt \
44
+ simpleperf_shared_libraries_host_windows := libLLVM
45
+
46
+ simpleperf_ldlibs_host_linux := -lrt
48
47
49
48
50
49
# libsimpleperf
@@ -78,58 +77,48 @@ libsimpleperf_src_files_linux := \
78
77
workload.cpp \
79
78
80
79
libsimpleperf_src_files_darwin := \
81
- darwin_support/darwin_support.cpp \
80
+ nonlinux_support/nonlinux_support.cpp \
81
+
82
+ libsimpleperf_src_files_windows := \
83
+ nonlinux_support/nonlinux_support.cpp \
82
84
83
85
# libsimpleperf target
84
86
include $(CLEAR_VARS )
85
87
LOCAL_CLANG := true
88
+ LOCAL_MODULE := libsimpleperf
89
+ LOCAL_MODULE_TAGS := debug
90
+ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
86
91
LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
87
92
LOCAL_SRC_FILES := \
88
93
$(libsimpleperf_src_files ) \
89
94
$(libsimpleperf_src_files_linux ) \
90
95
91
96
LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
92
97
LOCAL_MULTILIB := first
93
- LOCAL_MODULE := libsimpleperf
94
- LOCAL_MODULE_TAGS := debug
95
- LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
96
98
include $(LLVM_DEVICE_BUILD_MK )
97
99
include $(BUILD_STATIC_LIBRARY )
98
100
99
- # libsimpleperf linux host
100
- ifeq ($(HOST_OS ) ,linux)
101
+ # libsimpleperf host
101
102
include $(CLEAR_VARS )
102
- LOCAL_CLANG := true
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
103
+ # LOCAL_CLANG := true # Comment it to build on windows.
111
104
LOCAL_MODULE := libsimpleperf
112
- LOCAL_MODULE_TAGS := optional
113
- include $(LLVM_HOST_BUILD_MK )
114
- include $(BUILD_HOST_STATIC_LIBRARY )
115
- endif
116
-
117
- # libsimpleperf darwin host
118
- ifeq ($(HOST_OS ) ,darwin)
119
- include $(CLEAR_VARS )
120
- LOCAL_CLANG := true
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 )
105
+ LOCAL_MODULE_HOST_OS := darwin linux windows
106
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host )
107
+ LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin )
108
+ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux )
109
+ LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows )
110
+ LOCAL_SRC_FILES := $(libsimpleperf_src_files )
111
+ LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin )
112
+ LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux )
113
+ LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows )
114
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host )
115
+ LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin )
116
+ LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux )
117
+ LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows )
118
+ LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux )
127
119
LOCAL_MULTILIB := first
128
- LOCAL_MODULE := libsimpleperf
129
- LOCAL_MODULE_TAGS := optional
130
120
include $(LLVM_HOST_BUILD_MK )
131
- include $(BUILD_HOST_SHARED_LIBRARY )
132
- endif
121
+ include $(BUILD_HOST_STATIC_LIBRARY )
133
122
134
123
135
124
# simpleperf
@@ -138,46 +127,33 @@ endif
138
127
# simpleperf target
139
128
include $(CLEAR_VARS )
140
129
LOCAL_CLANG := true
130
+ LOCAL_MODULE := simpleperf
131
+ LOCAL_MODULE_TAGS := debug
132
+ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
141
133
LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
142
134
LOCAL_SRC_FILES := main.cpp
143
135
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
144
136
LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
145
137
LOCAL_MULTILIB := first
146
- LOCAL_MODULE := simpleperf
147
- LOCAL_MODULE_TAGS := debug
148
- LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES )
149
138
include $(BUILD_EXECUTABLE )
150
139
151
- # simpleperf linux host
152
- ifeq ($(HOST_OS ) ,linux)
140
+ # simpleperf host
153
141
include $(CLEAR_VARS )
154
- LOCAL_CLANG := true
155
- LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
156
- LOCAL_SRC_FILES := main.cpp
157
- LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
158
- LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
159
- LOCAL_MULTILIB := first
160
- LOCAL_LDLIBS := $(simpleperf_ldlibs_host_linux )
161
142
LOCAL_MODULE := simpleperf
162
- LOCAL_MODULE_TAGS := optional
163
- include $(BUILD_HOST_EXECUTABLE )
164
- endif
165
-
166
- # simpleperf darwin host
167
- ifeq ($(HOST_OS ) ,darwin)
168
- include $(CLEAR_VARS )
169
- LOCAL_CLANG := true
170
- LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin )
143
+ LOCAL_MODULE_HOST_OS := darwin linux windows
144
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host )
145
+ LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin )
146
+ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux )
147
+ LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows )
171
148
LOCAL_SRC_FILES := main.cpp
172
- LOCAL_SHARED_LIBRARIES := \
173
- libsimpleperf \
174
- $(simpleperf_shared_libraries_host_darwin ) \
175
-
149
+ LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
150
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host )
151
+ LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin )
152
+ LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux )
153
+ LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows )
154
+ LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux )
176
155
LOCAL_MULTILIB := first
177
- LOCAL_MODULE := simpleperf
178
- LOCAL_MODULE_TAGS := optional
179
156
include $(BUILD_HOST_EXECUTABLE )
180
- endif
181
157
182
158
183
159
# simpleperf_unit_test
@@ -202,6 +178,7 @@ simpleperf_unit_test_src_files_linux := \
202
178
# simpleperf_unit_test target
203
179
include $(CLEAR_VARS )
204
180
LOCAL_CLANG := true
181
+ LOCAL_MODULE := simpleperf_unit_test
205
182
LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
206
183
LOCAL_SRC_FILES := \
207
184
$(simpleperf_unit_test_src_files ) \
@@ -210,42 +187,26 @@ LOCAL_SRC_FILES := \
210
187
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
211
188
LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
212
189
LOCAL_MULTILIB := first
213
- LOCAL_MODULE := simpleperf_unit_test
214
- LOCAL_MODULE_TAGS := optional
215
190
include $(BUILD_NATIVE_TEST )
216
191
217
- # simpleperf_unit_test linux host
218
- ifeq ($(HOST_OS ) ,linux)
192
+ # simpleperf_unit_test host
219
193
include $(CLEAR_VARS )
220
- LOCAL_CLANG := true
221
- LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
222
- LOCAL_SRC_FILES := \
223
- $(simpleperf_unit_test_src_files ) \
224
- $(simpleperf_unit_test_src_files_linux ) \
225
-
226
- LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
227
- LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
228
- LOCAL_MULTILIB := first
229
194
LOCAL_MODULE := simpleperf_unit_test
230
- LOCAL_MODULE_TAGS := optional
231
- include $(BUILD_HOST_NATIVE_TEST )
232
- endif
233
-
234
- # simpleperf_unit_test darwin host
235
- ifeq ($(HOST_OS ) ,darwin)
236
- include $(CLEAR_VARS )
237
- LOCAL_CLANG := true
238
- LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin )
195
+ LOCAL_MODULE_HOST_OS := darwin linux windows
196
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host )
197
+ LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin )
198
+ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux )
199
+ LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows )
239
200
LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files )
240
- LOCAL_SHARED_LIBRARIES := \
241
- libsimpleperf \
242
- $(simpleperf_shared_libraries_host_darwin ) \
243
-
201
+ LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux )
202
+ LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
203
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host )
204
+ LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin )
205
+ LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux )
206
+ LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows )
207
+ LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux )
244
208
LOCAL_MULTILIB := first
245
- LOCAL_MODULE := simpleperf_unit_test
246
- LOCAL_MODULE_TAGS := optional
247
209
include $(BUILD_HOST_NATIVE_TEST )
248
- endif
249
210
250
211
251
212
# simpleperf_cpu_hotplug_test
@@ -257,27 +218,27 @@ simpleperf_cpu_hotplug_test_src_files := \
257
218
# simpleperf_cpu_hotplug_test target
258
219
include $(CLEAR_VARS )
259
220
LOCAL_CLANG := true
221
+ LOCAL_MODULE := simpleperf_cpu_hotplug_test
260
222
LOCAL_CPPFLAGS := $(simpleperf_cppflags_target )
261
223
LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files )
262
224
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
263
225
LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target )
264
226
LOCAL_MULTILIB := first
265
- LOCAL_MODULE := simpleperf_cpu_hotplug_test
266
- LOCAL_MODULE_TAGS := optional
267
227
include $(BUILD_NATIVE_TEST )
268
228
269
229
# simpleperf_cpu_hotplug_test linux host
270
- ifeq ($(HOST_OS ) ,linux)
271
230
include $(CLEAR_VARS )
272
231
LOCAL_CLANG := true
273
- LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux )
232
+ LOCAL_MODULE := simpleperf_cpu_hotplug_test
233
+ LOCAL_MODULE_HOST_OS := linux
234
+ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host )
235
+ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux )
274
236
LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files )
275
237
LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
276
- LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux )
238
+ LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host )
239
+ LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux )
240
+ LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux )
277
241
LOCAL_MULTILIB := first
278
- LOCAL_MODULE := simpleperf_cpu_hotplug_test
279
- LOCAL_MODULE_TAGS := optional
280
242
include $(BUILD_HOST_NATIVE_TEST )
281
- endif
282
243
283
244
include $(call first-makefiles-under,$(LOCAL_PATH ) )
0 commit comments