blob: a407ea276e75fa3a14626c5b3ff678c18aa8ba7a [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 Moreland17b29e12017-03-21 18:38:05 -070019 android.hidl.manager@1.0 \
Steven Morelandc655a2a2016-12-13 17:42:19 -080020 libhidlbase \
Felipe Lemee844a9d2016-09-21 15:01:39 -070021 libbase \
Felipe Leme75876a22016-10-27 16:31:27 -070022 libbinder \
Felipe Lemee844a9d2016-09-21 15:01:39 -070023 libcutils \
Josh Gao00ac89e2017-01-18 16:01:25 -080024 libdebuggerd_client \
Felipe Leme75876a22016-10-27 16:31:27 -070025 libdumpstateaidl \
Felipe Leme47e9be22016-12-21 15:37:07 -080026 libdumpstateutil \
Felipe Lemee844a9d2016-09-21 15:01:39 -070027 liblog \
Felipe Leme75876a22016-10-27 16:31:27 -070028 libselinux \
Jaekyun Seokd56dec82016-11-25 16:20:40 +090029 libutils \
Felipe Lemebda15a02016-11-16 17:48:25 -080030 $(COMMON_ZIP_LIBRARIES)
31
32# ====================#
33# libdumpstateutil #
34# ====================#
35include $(CLEAR_VARS)
36
37LOCAL_MODULE := libdumpstateutil
38
39LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
40LOCAL_C_INCLUDES := $(LOCAL_PATH)
41LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
42LOCAL_SRC_FILES := \
Felipe Lemef0292972016-11-22 13:57:05 -080043 DumpstateInternal.cpp \
44 DumpstateUtil.cpp
45LOCAL_SHARED_LIBRARIES := \
Felipe Leme47e9be22016-12-21 15:37:07 -080046 libbase \
47 liblog \
Felipe Lemebda15a02016-11-16 17:48:25 -080048
Felipe Leme47e9be22016-12-21 15:37:07 -080049include $(BUILD_SHARED_LIBRARY)
Felipe Lemee844a9d2016-09-21 15:01:39 -070050
Felipe Lemef6d37e32016-10-27 16:58:06 -070051# ====================#
52# libdumpstateheaders #
53# ====================#
54# TODO: this module is necessary so the device-specific libdumpstate implementations do not
55# need to add any other dependency (like libbase). Should go away once dumpstate HAL changes.
56include $(CLEAR_VARS)
57
58LOCAL_EXPORT_C_INCLUDE_DIRS = $(LOCAL_PATH)
59LOCAL_MODULE := libdumpstateheaders
60LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
61 $(COMMON_SHARED_LIBRARIES)
62LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := \
Felipe Lemebda15a02016-11-16 17:48:25 -080063 $(COMMON_STATIC_LIBRARIES)
Felipe Lemef6d37e32016-10-27 16:58:06 -070064# Soong requires that whats is on LOCAL_EXPORTED_ is also on LOCAL_
65LOCAL_SHARED_LIBRARIES := $(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS)
66LOCAL_STATIC_LIBRARIES := $(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS)
67
68include $(BUILD_STATIC_LIBRARY)
69
Felipe Leme75876a22016-10-27 16:31:27 -070070# ================ #
71# libdumpstateaidl #
72# =================#
73include $(CLEAR_VARS)
74
75LOCAL_MODULE := libdumpstateaidl
76
77LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
78
79LOCAL_SHARED_LIBRARIES := \
80 libbinder \
81 libutils
82LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
83LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
84LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
85LOCAL_SRC_FILES := \
Felipe Leme009ecbb2016-11-07 10:18:44 -080086 binder/android/os/IDumpstate.aidl \
Felipe Leme75876a22016-10-27 16:31:27 -070087 binder/android/os/IDumpstateListener.aidl \
Felipe Leme009ecbb2016-11-07 10:18:44 -080088 binder/android/os/IDumpstateToken.aidl
Felipe Leme75876a22016-10-27 16:31:27 -070089
90include $(BUILD_SHARED_LIBRARY)
91
Felipe Leme4c2d6632016-09-28 14:32:00 -070092# ==========#
93# dumpstate #
94# ==========#
95include $(CLEAR_VARS)
Felipe Lemee844a9d2016-09-21 15:01:39 -070096
Felipe Leme4c2d6632016-09-28 14:32:00 -070097LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
Felipe Leme75876a22016-10-27 16:31:27 -070098 DumpstateService.cpp \
Felipe Leme4c2d6632016-09-28 14:32:00 -070099 dumpstate.cpp
100
101LOCAL_MODULE := dumpstate
102
Felipe Leme35b8cf12017-02-10 15:47:29 -0800103LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700104
Felipe Lemebda15a02016-11-16 17:48:25 -0800105LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700106
Felipe Leme4c2d6632016-09-28 14:32:00 -0700107LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS)
108
Tom Cherry74155992015-08-14 13:01:23 -0700109LOCAL_INIT_RC := dumpstate.rc
Jeff Brownbf7f4922012-06-07 16:40:01 -0700110
Colin Crossf45fa6b2012-03-26 12:38:26 -0700111include $(BUILD_EXECUTABLE)
Felipe Leme4c2d6632016-09-28 14:32:00 -0700112
113# ===============#
114# dumpstate_test #
115# ===============#
116include $(CLEAR_VARS)
117
118LOCAL_MODULE := dumpstate_test
119
120LOCAL_MODULE_TAGS := tests
121
122LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
123
124LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
Felipe Leme75876a22016-10-27 16:31:27 -0700125 DumpstateService.cpp \
Felipe Leme4c2d6632016-09-28 14:32:00 -0700126 tests/dumpstate_test.cpp
127
Felipe Lemebda15a02016-11-16 17:48:25 -0800128LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) \
Felipe Leme4c2d6632016-09-28 14:32:00 -0700129 libgmock
130
131LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
132
133include $(BUILD_NATIVE_TEST)
134
135# =======================#
136# dumpstate_test_fixture #
137# =======================#
138include $(CLEAR_VARS)
139
140LOCAL_MODULE := dumpstate_test_fixture
141
142LOCAL_MODULE_TAGS := tests
143
144LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
145
Felipe Lemecef02982016-10-03 17:22:22 -0700146LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
147
Felipe Leme4c2d6632016-09-28 14:32:00 -0700148LOCAL_SRC_FILES := \
149 tests/dumpstate_test_fixture.cpp
150
Colin Cross52737922016-12-02 19:27:04 -0800151LOCAL_MODULE_CLASS := NATIVE_TESTS
152
153dumpstate_tests_intermediates := $(local-intermediates-dir)/DATA
Felipe Lemecef02982016-10-03 17:22:22 -0700154dumpstate_tests_subpath_from_data := nativetest/dumpstate_test_fixture
155dumpstate_tests_root_in_device := /data/$(dumpstate_tests_subpath_from_data)
Colin Cross52737922016-12-02 19:27:04 -0800156dumpstate_tests_root_for_test_zip := $(dumpstate_tests_intermediates)/$(dumpstate_tests_subpath_from_data)
Felipe Lemecef02982016-10-03 17:22:22 -0700157testdata_files := $(call find-subdir-files, testdata/*)
158
Colin Cross52737922016-12-02 19:27:04 -0800159# Copy test data files to intermediates/DATA for use with LOCAL_PICKUP_FILES
Felipe Lemecef02982016-10-03 17:22:22 -0700160GEN := $(addprefix $(dumpstate_tests_root_for_test_zip)/, $(testdata_files))
161$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
162$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@
163$(GEN): $(dumpstate_tests_root_for_test_zip)/testdata/% : $(LOCAL_PATH)/testdata/%
164 $(transform-generated-source)
165LOCAL_GENERATED_SOURCES += $(GEN)
Colin Cross52737922016-12-02 19:27:04 -0800166
167# Copy test data files again to $OUT/data so the tests can be run with adb sync
168# TODO: the build system should do this automatically
169GEN := $(addprefix $(TARGET_OUT_DATA)/$(dumpstate_tests_subpath_from_data)/, $(testdata_files))
170$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
171$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@
172$(GEN): $(TARGET_OUT_DATA)/$(dumpstate_tests_subpath_from_data)/testdata/% : $(LOCAL_PATH)/testdata/%
173 $(transform-generated-source)
174LOCAL_GENERATED_SOURCES += $(GEN)
175
176LOCAL_PICKUP_FILES := $(dumpstate_tests_intermediates)
Felipe Lemecef02982016-10-03 17:22:22 -0700177
Felipe Leme4c2d6632016-09-28 14:32:00 -0700178include $(BUILD_NATIVE_TEST)