blob: 302a947a30a09775de39ca4224c7535c6a3ed885 [file] [log] [blame]
Colin Crossf45fa6b2012-03-26 12:38:26 -07001LOCAL_PATH:= $(call my-dir)
Todd Poynor4f5b9a72013-08-13 16:30:01 -07002
Felipe Leme4c2d6632016-09-28 14:32:00 -07003# ================#
4# Common settings #
5# ================#
6# ZipArchive support, the order matters here to get all symbols.
Jaekyun Seokd56dec82016-11-25 16:20:40 +09007COMMON_ZIP_LIBRARIES := libziparchive libz libcrypto
Colin Crossf45fa6b2012-03-26 12:38:26 -07008
Felipe Leme4c2d6632016-09-28 14:32:00 -07009# TODO: ideally the tests should depend on a shared dumpstate library, but currently libdumpstate
10# is used to define the device-specific HAL library. Instead, both dumpstate and dumpstate_test
11# shares a lot of common settings
12COMMON_LOCAL_CFLAGS := \
13 -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
14COMMON_SRC_FILES := \
Felipe Lemef0292972016-11-22 13:57:05 -080015 DumpstateInternal.cpp \
Felipe Lemee844a9d2016-09-21 15:01:39 -070016 utils.cpp
Felipe Leme4c2d6632016-09-28 14:32:00 -070017COMMON_SHARED_LIBRARIES := \
Felipe Leme6f674ae2016-11-18 17:10:33 -080018 android.hardware.dumpstate@1.0 \
Steven Morelandc655a2a2016-12-13 17:42:19 -080019 libhidlbase \
Felipe Lemee844a9d2016-09-21 15:01:39 -070020 libbase \
Felipe Leme75876a22016-10-27 16:31:27 -070021 libbinder \
Felipe Lemee844a9d2016-09-21 15:01:39 -070022 libcutils \
Josh Gao00ac89e2017-01-18 16:01:25 -080023 libdebuggerd_client \
Felipe Leme75876a22016-10-27 16:31:27 -070024 libdumpstateaidl \
Felipe Leme47e9be22016-12-21 15:37:07 -080025 libdumpstateutil \
Felipe Lemee844a9d2016-09-21 15:01:39 -070026 liblog \
Felipe Leme75876a22016-10-27 16:31:27 -070027 libselinux \
Jaekyun Seokd56dec82016-11-25 16:20:40 +090028 libutils \
Felipe Lemebda15a02016-11-16 17:48:25 -080029 $(COMMON_ZIP_LIBRARIES)
30
31# ====================#
32# libdumpstateutil #
33# ====================#
34include $(CLEAR_VARS)
35
36LOCAL_MODULE := libdumpstateutil
37
38LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
39LOCAL_C_INCLUDES := $(LOCAL_PATH)
40LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
41LOCAL_SRC_FILES := \
Felipe Lemef0292972016-11-22 13:57:05 -080042 DumpstateInternal.cpp \
43 DumpstateUtil.cpp
44LOCAL_SHARED_LIBRARIES := \
Felipe Leme47e9be22016-12-21 15:37:07 -080045 libbase \
46 liblog \
Felipe Lemebda15a02016-11-16 17:48:25 -080047
Felipe Leme47e9be22016-12-21 15:37:07 -080048include $(BUILD_SHARED_LIBRARY)
Felipe Lemee844a9d2016-09-21 15:01:39 -070049
Felipe Lemef6d37e32016-10-27 16:58:06 -070050# ====================#
51# libdumpstateheaders #
52# ====================#
53# TODO: this module is necessary so the device-specific libdumpstate implementations do not
54# need to add any other dependency (like libbase). Should go away once dumpstate HAL changes.
55include $(CLEAR_VARS)
56
57LOCAL_EXPORT_C_INCLUDE_DIRS = $(LOCAL_PATH)
58LOCAL_MODULE := libdumpstateheaders
59LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
60 $(COMMON_SHARED_LIBRARIES)
61LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := \
Felipe Lemebda15a02016-11-16 17:48:25 -080062 $(COMMON_STATIC_LIBRARIES)
Felipe Lemef6d37e32016-10-27 16:58:06 -070063# Soong requires that whats is on LOCAL_EXPORTED_ is also on LOCAL_
64LOCAL_SHARED_LIBRARIES := $(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS)
65LOCAL_STATIC_LIBRARIES := $(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS)
66
67include $(BUILD_STATIC_LIBRARY)
68
Felipe Leme75876a22016-10-27 16:31:27 -070069# ================ #
70# libdumpstateaidl #
71# =================#
72include $(CLEAR_VARS)
73
74LOCAL_MODULE := libdumpstateaidl
75
76LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
77
78LOCAL_SHARED_LIBRARIES := \
79 libbinder \
80 libutils
81LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
82LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
83LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
84LOCAL_SRC_FILES := \
Felipe Leme009ecbb2016-11-07 10:18:44 -080085 binder/android/os/IDumpstate.aidl \
Felipe Leme75876a22016-10-27 16:31:27 -070086 binder/android/os/IDumpstateListener.aidl \
Felipe Leme009ecbb2016-11-07 10:18:44 -080087 binder/android/os/IDumpstateToken.aidl
Felipe Leme75876a22016-10-27 16:31:27 -070088
89include $(BUILD_SHARED_LIBRARY)
90
Felipe Leme4c2d6632016-09-28 14:32:00 -070091# ==========#
92# dumpstate #
93# ==========#
94include $(CLEAR_VARS)
Felipe Lemee844a9d2016-09-21 15:01:39 -070095
Felipe Leme4c2d6632016-09-28 14:32:00 -070096LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
Felipe Leme75876a22016-10-27 16:31:27 -070097 DumpstateService.cpp \
Felipe Leme4c2d6632016-09-28 14:32:00 -070098 dumpstate.cpp
99
100LOCAL_MODULE := dumpstate
101
Felipe Leme35b8cf12017-02-10 15:47:29 -0800102LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700103
Felipe Lemebda15a02016-11-16 17:48:25 -0800104LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700105
Felipe Leme4c2d6632016-09-28 14:32:00 -0700106LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS)
107
Tom Cherry74155992015-08-14 13:01:23 -0700108LOCAL_INIT_RC := dumpstate.rc
Jeff Brownbf7f4922012-06-07 16:40:01 -0700109
Colin Crossf45fa6b2012-03-26 12:38:26 -0700110include $(BUILD_EXECUTABLE)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700111
112# ===============#
113# dumpstate_test #
114# ===============#
115include $(CLEAR_VARS)
116
117LOCAL_MODULE := dumpstate_test
118
119LOCAL_MODULE_TAGS := tests
120
121LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
122
123LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
Felipe Leme75876a22016-10-27 16:31:27 -0700124 DumpstateService.cpp \
Felipe Leme4c2d6632016-09-28 14:32:00 -0700125 tests/dumpstate_test.cpp
126
Felipe Lemebda15a02016-11-16 17:48:25 -0800127LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) \
Felipe Leme4c2d6632016-09-28 14:32:00 -0700128 libgmock
129
130LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
131
132include $(BUILD_NATIVE_TEST)
133
134# =======================#
135# dumpstate_test_fixture #
136# =======================#
137include $(CLEAR_VARS)
138
139LOCAL_MODULE := dumpstate_test_fixture
140
141LOCAL_MODULE_TAGS := tests
142
143LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
144
Felipe Lemecef02982016-10-03 17:22:22 -0700145LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
146
Felipe Leme4c2d6632016-09-28 14:32:00 -0700147LOCAL_SRC_FILES := \
148 tests/dumpstate_test_fixture.cpp
149
Colin Cross52737922016-12-02 19:27:04 -0800150LOCAL_MODULE_CLASS := NATIVE_TESTS
151
152dumpstate_tests_intermediates := $(local-intermediates-dir)/DATA
Felipe Lemecef02982016-10-03 17:22:22 -0700153dumpstate_tests_subpath_from_data := nativetest/dumpstate_test_fixture
154dumpstate_tests_root_in_device := /data/$(dumpstate_tests_subpath_from_data)
Colin Cross52737922016-12-02 19:27:04 -0800155dumpstate_tests_root_for_test_zip := $(dumpstate_tests_intermediates)/$(dumpstate_tests_subpath_from_data)
Felipe Lemecef02982016-10-03 17:22:22 -0700156testdata_files := $(call find-subdir-files, testdata/*)
157
Colin Cross52737922016-12-02 19:27:04 -0800158# Copy test data files to intermediates/DATA for use with LOCAL_PICKUP_FILES
Felipe Lemecef02982016-10-03 17:22:22 -0700159GEN := $(addprefix $(dumpstate_tests_root_for_test_zip)/, $(testdata_files))
160$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
161$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@
162$(GEN): $(dumpstate_tests_root_for_test_zip)/testdata/% : $(LOCAL_PATH)/testdata/%
163 $(transform-generated-source)
164LOCAL_GENERATED_SOURCES += $(GEN)
Colin Cross52737922016-12-02 19:27:04 -0800165
166# Copy test data files again to $OUT/data so the tests can be run with adb sync
167# TODO: the build system should do this automatically
168GEN := $(addprefix $(TARGET_OUT_DATA)/$(dumpstate_tests_subpath_from_data)/, $(testdata_files))
169$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
170$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@
171$(GEN): $(TARGET_OUT_DATA)/$(dumpstate_tests_subpath_from_data)/testdata/% : $(LOCAL_PATH)/testdata/%
172 $(transform-generated-source)
173LOCAL_GENERATED_SOURCES += $(GEN)
174
175LOCAL_PICKUP_FILES := $(dumpstate_tests_intermediates)
Felipe Lemecef02982016-10-03 17:22:22 -0700176
Felipe Leme4c2d6632016-09-28 14:32:00 -0700177include $(BUILD_NATIVE_TEST)