OSDN Git Service

am 9f441da9: am dd22cb33: Actually encrypt stuff
[android-x86/system-extras.git] / simpleperf / Android.mk
1 #
2 # Copyright (C) 2015 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
17 LOCAL_PATH := $(call my-dir)
18
19 simpleperf_common_cppflags := -std=c++11 -Wall -Wextra -Werror -Wunused
20
21 simpleperf_host_common_cppflags := $(simpleperf_common_cppflags) \
22                                    -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
23
24 simpleperf_host_darwin_cppflags := $(simpleperf_host_common_cppflags) \
25                                    -I $(LOCAL_PATH)/darwin_support \
26
27 simpleperf_common_shared_libraries := \
28   libbase \
29   libLLVM \
30
31 LLVM_ROOT_PATH := external/llvm
32
33 # libsimpleperf
34 # =========================================================
35 libsimpleperf_common_src_files := \
36   callchain.cpp \
37   cmd_dumprecord.cpp \
38   cmd_help.cpp \
39   cmd_report.cpp \
40   command.cpp \
41   dso.cpp \
42   event_attr.cpp \
43   event_type.cpp \
44   perf_regs.cpp \
45   read_elf.cpp \
46   record.cpp \
47   record_file_reader.cpp \
48   sample_tree.cpp \
49   utils.cpp \
50
51 libsimpleperf_src_files := \
52   $(libsimpleperf_common_src_files) \
53   cmd_list.cpp \
54   cmd_record.cpp \
55   cmd_stat.cpp \
56   environment.cpp \
57   event_fd.cpp \
58   event_selection_set.cpp \
59   record_file_writer.cpp \
60   workload.cpp \
61
62 libsimpleperf_darwin_src_files := \
63   $(libsimpleperf_common_src_files) \
64   environment_fake.cpp \
65
66 include $(CLEAR_VARS)
67 LOCAL_CLANG := true
68 LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
69 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
70 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
71 LOCAL_MODULE := libsimpleperf
72 LOCAL_MODULE_TAGS := debug
73 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
74 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
75 include $(LLVM_ROOT_PATH)/llvm.mk
76 include $(LLVM_DEVICE_BUILD_MK)
77 include $(BUILD_STATIC_LIBRARY)
78
79 ifeq ($(HOST_OS),linux)
80 include $(CLEAR_VARS)
81 LOCAL_CLANG := true
82 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
83 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
84 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
85 LOCAL_LDLIBS := -lrt
86 LOCAL_MODULE := libsimpleperf
87 LOCAL_MODULE_TAGS := optional
88 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
89 include $(LLVM_ROOT_PATH)/llvm.mk
90 include $(LLVM_HOST_BUILD_MK)
91 include $(BUILD_HOST_STATIC_LIBRARY)
92 endif
93
94 ifeq ($(HOST_OS),darwin)
95 include $(CLEAR_VARS)
96 LOCAL_CLANG := true
97 LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
98 LOCAL_SRC_FILES := $(libsimpleperf_darwin_src_files)
99 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
100 LOCAL_MODULE := libsimpleperf
101 LOCAL_MODULE_TAGS := optional
102 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
103 include $(LLVM_ROOT_PATH)/llvm.mk
104 include $(LLVM_HOST_BUILD_MK)
105 include $(BUILD_HOST_SHARED_LIBRARY)
106 endif
107
108 # simpleperf
109 # =========================================================
110 include $(CLEAR_VARS)
111 LOCAL_CLANG := true
112 LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
113 LOCAL_SRC_FILES := main.cpp
114 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
115 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
116 LOCAL_MODULE := simpleperf
117 LOCAL_MODULE_TAGS := debug
118 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
119 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
120 include $(BUILD_EXECUTABLE)
121
122 ifeq ($(HOST_OS),linux)
123 include $(CLEAR_VARS)
124 LOCAL_CLANG := true
125 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
126 LOCAL_SRC_FILES := main.cpp
127 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
128 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
129 LOCAL_LDLIBS := -lrt
130 LOCAL_MODULE := simpleperf
131 LOCAL_MODULE_TAGS := optional
132 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
133 include $(BUILD_HOST_EXECUTABLE)
134 endif
135
136 ifeq ($(HOST_OS),darwin)
137 include $(CLEAR_VARS)
138 LOCAL_CLANG := true
139 LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
140 LOCAL_SRC_FILES := main.cpp
141 LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries)
142 LOCAL_MODULE := simpleperf
143 LOCAL_MODULE_TAGS := optional
144 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
145 include $(BUILD_HOST_EXECUTABLE)
146 endif
147
148 # simpleperf_unit_test
149 # =========================================================
150 simpleperf_unit_test_common_src_files := \
151   command_test.cpp \
152   gtest_main.cpp \
153   record_test.cpp \
154   sample_tree_test.cpp \
155
156 simpleperf_unit_test_src_files := \
157   $(simpleperf_unit_test_common_src_files) \
158   cmd_dumprecord_test.cpp \
159   cmd_list_test.cpp \
160   cmd_record_test.cpp \
161   cmd_report_test.cpp \
162   cmd_stat_test.cpp \
163   cpu_offline_test.cpp \
164   environment_test.cpp \
165   read_elf_test.cpp \
166   record_file_test.cpp \
167   workload_test.cpp \
168
169 include $(CLEAR_VARS)
170 LOCAL_CLANG := true
171 LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
172 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
173 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
174 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
175 LOCAL_MODULE := simpleperf_unit_test
176 LOCAL_MODULE_TAGS := optional
177 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
178 include $(BUILD_NATIVE_TEST)
179
180 ifeq ($(HOST_OS),linux)
181 include $(CLEAR_VARS)
182 LOCAL_CLANG := true
183 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
184 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
185 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
186 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
187 LOCAL_MODULE := simpleperf_unit_test
188 LOCAL_MODULE_TAGS := optional
189 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
190 include $(BUILD_HOST_NATIVE_TEST)
191 endif
192
193 ifeq ($(HOST_OS),darwin)
194 include $(CLEAR_VARS)
195 LOCAL_CLANG := true
196 LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
197 LOCAL_SRC_FILES := $(simpleperf_unit_test_common_src_files)
198 LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries)
199 LOCAL_MODULE := simpleperf_unit_test
200 LOCAL_MODULE_TAGS := optional
201 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
202 include $(BUILD_HOST_NATIVE_TEST)
203 endif