Colin Cross | f45fa6b | 2012-03-26 12:38:26 -0700 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
Todd Poynor | 4f5b9a7 | 2013-08-13 16:30:01 -0700 | [diff] [blame] | 2 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 3 | # ================# |
| 4 | # Common settings # |
| 5 | # ================# |
| 6 | # ZipArchive support, the order matters here to get all symbols. |
Jaekyun Seok | d56dec8 | 2016-11-25 16:20:40 +0900 | [diff] [blame] | 7 | COMMON_ZIP_LIBRARIES := libziparchive libz libcrypto |
Colin Cross | f45fa6b | 2012-03-26 12:38:26 -0700 | [diff] [blame] | 8 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 9 | # 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 |
| 12 | COMMON_LOCAL_CFLAGS := \ |
| 13 | -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter |
| 14 | COMMON_SRC_FILES := \ |
Felipe Leme | f029297 | 2016-11-22 13:57:05 -0800 | [diff] [blame] | 15 | DumpstateInternal.cpp \ |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 16 | utils.cpp |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 17 | COMMON_SHARED_LIBRARIES := \ |
Felipe Leme | 6f674ae | 2016-11-18 17:10:33 -0800 | [diff] [blame] | 18 | android.hardware.dumpstate@1.0 \ |
Steven Moreland | c655a2a | 2016-12-13 17:42:19 -0800 | [diff] [blame] | 19 | libhidlbase \ |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 20 | libbase \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 21 | libbinder \ |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 22 | libcutils \ |
Josh Gao | 00ac89e | 2017-01-18 16:01:25 -0800 | [diff] [blame] | 23 | libdebuggerd_client \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 24 | libdumpstateaidl \ |
Felipe Leme | 47e9be2 | 2016-12-21 15:37:07 -0800 | [diff] [blame] | 25 | libdumpstateutil \ |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 26 | liblog \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 27 | libselinux \ |
Jaekyun Seok | d56dec8 | 2016-11-25 16:20:40 +0900 | [diff] [blame] | 28 | libutils \ |
Felipe Leme | bda15a0 | 2016-11-16 17:48:25 -0800 | [diff] [blame] | 29 | $(COMMON_ZIP_LIBRARIES) |
| 30 | |
| 31 | # ====================# |
| 32 | # libdumpstateutil # |
| 33 | # ====================# |
| 34 | include $(CLEAR_VARS) |
| 35 | |
| 36 | LOCAL_MODULE := libdumpstateutil |
| 37 | |
| 38 | LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS) |
| 39 | LOCAL_C_INCLUDES := $(LOCAL_PATH) |
| 40 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 41 | LOCAL_SRC_FILES := \ |
Felipe Leme | f029297 | 2016-11-22 13:57:05 -0800 | [diff] [blame] | 42 | DumpstateInternal.cpp \ |
| 43 | DumpstateUtil.cpp |
| 44 | LOCAL_SHARED_LIBRARIES := \ |
Felipe Leme | 47e9be2 | 2016-12-21 15:37:07 -0800 | [diff] [blame] | 45 | libbase \ |
| 46 | liblog \ |
Felipe Leme | bda15a0 | 2016-11-16 17:48:25 -0800 | [diff] [blame] | 47 | |
Felipe Leme | 47e9be2 | 2016-12-21 15:37:07 -0800 | [diff] [blame] | 48 | include $(BUILD_SHARED_LIBRARY) |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 49 | |
Felipe Leme | f6d37e3 | 2016-10-27 16:58:06 -0700 | [diff] [blame] | 50 | # ====================# |
| 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. |
| 55 | include $(CLEAR_VARS) |
| 56 | |
| 57 | LOCAL_EXPORT_C_INCLUDE_DIRS = $(LOCAL_PATH) |
| 58 | LOCAL_MODULE := libdumpstateheaders |
| 59 | LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \ |
| 60 | $(COMMON_SHARED_LIBRARIES) |
| 61 | LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := \ |
Felipe Leme | bda15a0 | 2016-11-16 17:48:25 -0800 | [diff] [blame] | 62 | $(COMMON_STATIC_LIBRARIES) |
Felipe Leme | f6d37e3 | 2016-10-27 16:58:06 -0700 | [diff] [blame] | 63 | # Soong requires that whats is on LOCAL_EXPORTED_ is also on LOCAL_ |
| 64 | LOCAL_SHARED_LIBRARIES := $(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS) |
| 65 | LOCAL_STATIC_LIBRARIES := $(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS) |
| 66 | |
| 67 | include $(BUILD_STATIC_LIBRARY) |
| 68 | |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 69 | # ================ # |
| 70 | # libdumpstateaidl # |
| 71 | # =================# |
| 72 | include $(CLEAR_VARS) |
| 73 | |
| 74 | LOCAL_MODULE := libdumpstateaidl |
| 75 | |
| 76 | LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS) |
| 77 | |
| 78 | LOCAL_SHARED_LIBRARIES := \ |
| 79 | libbinder \ |
| 80 | libutils |
| 81 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder |
| 82 | LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder |
| 83 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder |
| 84 | LOCAL_SRC_FILES := \ |
Felipe Leme | 009ecbb | 2016-11-07 10:18:44 -0800 | [diff] [blame] | 85 | binder/android/os/IDumpstate.aidl \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 86 | binder/android/os/IDumpstateListener.aidl \ |
Felipe Leme | 009ecbb | 2016-11-07 10:18:44 -0800 | [diff] [blame] | 87 | binder/android/os/IDumpstateToken.aidl |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 88 | |
| 89 | include $(BUILD_SHARED_LIBRARY) |
| 90 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 91 | # ==========# |
| 92 | # dumpstate # |
| 93 | # ==========# |
| 94 | include $(CLEAR_VARS) |
Felipe Leme | e844a9d | 2016-09-21 15:01:39 -0700 | [diff] [blame] | 95 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 96 | LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 97 | DumpstateService.cpp \ |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 98 | dumpstate.cpp |
| 99 | |
| 100 | LOCAL_MODULE := dumpstate |
| 101 | |
Felipe Leme | 35b8cf1 | 2017-02-10 15:47:29 -0800 | [diff] [blame] | 102 | LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 103 | |
Felipe Leme | bda15a0 | 2016-11-16 17:48:25 -0800 | [diff] [blame] | 104 | LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 105 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 106 | LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS) |
| 107 | |
Tom Cherry | 7415599 | 2015-08-14 13:01:23 -0700 | [diff] [blame] | 108 | LOCAL_INIT_RC := dumpstate.rc |
Jeff Brown | bf7f492 | 2012-06-07 16:40:01 -0700 | [diff] [blame] | 109 | |
Colin Cross | f45fa6b | 2012-03-26 12:38:26 -0700 | [diff] [blame] | 110 | include $(BUILD_EXECUTABLE) |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 111 | |
| 112 | # ===============# |
| 113 | # dumpstate_test # |
| 114 | # ===============# |
| 115 | include $(CLEAR_VARS) |
| 116 | |
| 117 | LOCAL_MODULE := dumpstate_test |
| 118 | |
| 119 | LOCAL_MODULE_TAGS := tests |
| 120 | |
| 121 | LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS) |
| 122 | |
| 123 | LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \ |
Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 124 | DumpstateService.cpp \ |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 125 | tests/dumpstate_test.cpp |
| 126 | |
Felipe Leme | bda15a0 | 2016-11-16 17:48:25 -0800 | [diff] [blame] | 127 | LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) \ |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 128 | libgmock |
| 129 | |
| 130 | LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) |
| 131 | |
| 132 | include $(BUILD_NATIVE_TEST) |
| 133 | |
| 134 | # =======================# |
| 135 | # dumpstate_test_fixture # |
| 136 | # =======================# |
| 137 | include $(CLEAR_VARS) |
| 138 | |
| 139 | LOCAL_MODULE := dumpstate_test_fixture |
| 140 | |
| 141 | LOCAL_MODULE_TAGS := tests |
| 142 | |
| 143 | LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS) |
| 144 | |
Felipe Leme | cef0298 | 2016-10-03 17:22:22 -0700 | [diff] [blame] | 145 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 146 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 147 | LOCAL_SRC_FILES := \ |
| 148 | tests/dumpstate_test_fixture.cpp |
| 149 | |
Colin Cross | 5273792 | 2016-12-02 19:27:04 -0800 | [diff] [blame] | 150 | LOCAL_MODULE_CLASS := NATIVE_TESTS |
| 151 | |
| 152 | dumpstate_tests_intermediates := $(local-intermediates-dir)/DATA |
Felipe Leme | cef0298 | 2016-10-03 17:22:22 -0700 | [diff] [blame] | 153 | dumpstate_tests_subpath_from_data := nativetest/dumpstate_test_fixture |
| 154 | dumpstate_tests_root_in_device := /data/$(dumpstate_tests_subpath_from_data) |
Colin Cross | 5273792 | 2016-12-02 19:27:04 -0800 | [diff] [blame] | 155 | dumpstate_tests_root_for_test_zip := $(dumpstate_tests_intermediates)/$(dumpstate_tests_subpath_from_data) |
Felipe Leme | cef0298 | 2016-10-03 17:22:22 -0700 | [diff] [blame] | 156 | testdata_files := $(call find-subdir-files, testdata/*) |
| 157 | |
Colin Cross | 5273792 | 2016-12-02 19:27:04 -0800 | [diff] [blame] | 158 | # Copy test data files to intermediates/DATA for use with LOCAL_PICKUP_FILES |
Felipe Leme | cef0298 | 2016-10-03 17:22:22 -0700 | [diff] [blame] | 159 | GEN := $(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) |
| 164 | LOCAL_GENERATED_SOURCES += $(GEN) |
Colin Cross | 5273792 | 2016-12-02 19:27:04 -0800 | [diff] [blame] | 165 | |
| 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 |
| 168 | GEN := $(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) |
| 173 | LOCAL_GENERATED_SOURCES += $(GEN) |
| 174 | |
| 175 | LOCAL_PICKUP_FILES := $(dumpstate_tests_intermediates) |
Felipe Leme | cef0298 | 2016-10-03 17:22:22 -0700 | [diff] [blame] | 176 | |
Felipe Leme | 4c2d663 | 2016-09-28 14:32:00 -0700 | [diff] [blame] | 177 | include $(BUILD_NATIVE_TEST) |