blob: b96ba6b6a981c060ddac4fee0b34fa3877a41485 [file] [log] [blame]
The Android Open Source Project46c012c2008-10-21 07:00:00 -07001#
Christopher Wiley130e6862015-10-18 17:53:11 -07002# 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
17LOCAL_PATH := $(call my-dir)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070018
Christopher Wileyc5a9e282015-10-23 11:45:28 -070019aidl_cflags := -Wall -Wextra -Werror
20
Joe Onorato54fba422010-06-10 18:34:55 -070021# This tool is prebuilt if we're doing an app-only build.
Ying Wangc7cf53e2014-03-07 15:55:14 -080022ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
Joe Onorato54fba422010-06-10 18:34:55 -070023
Christopher Wileyb8b59f62015-09-15 12:19:53 -070024aidl_static_libraries := libbase libcutils
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070025
Christopher Wiley3616d132015-09-01 11:07:48 -070026# Logic shared between aidl and its unittests
The Android Open Source Project46c012c2008-10-21 07:00:00 -070027include $(CLEAR_VARS)
Christopher Wiley3616d132015-09-01 11:07:48 -070028LOCAL_MODULE := libaidl-common
Dan Willemseneada0252015-09-04 14:21:26 -070029LOCAL_MODULE_HOST_OS := darwin linux windows
The Android Open Source Project46c012c2008-10-21 07:00:00 -070030
Christopher Wiley4427d862015-09-14 11:07:39 -070031LOCAL_C_INCLUDES := external/gtest/include
Christopher Wileyc5a9e282015-10-23 11:45:28 -070032LOCAL_CLANG_CFLAGS := $(aidl_cflags)
Christopher Wileye0146cf2015-08-24 15:06:58 -070033# Tragically, the code is riddled with unused parameters.
34LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
35# yacc dumps a lot of code *just in case*.
36LOCAL_CLANG_CFLAGS += -Wno-unused-function
37LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
38# yacc is a tool from a more civilized age.
39LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
40# yacc also has a habit of using char* over const char*.
41LOCAL_CLANG_CFLAGS += -Wno-writable-strings
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070042LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
Christopher Wileye0146cf2015-08-24 15:06:58 -070043
The Android Open Source Project46c012c2008-10-21 07:00:00 -070044LOCAL_SRC_FILES := \
Christopher Wiley89e35862015-08-30 10:57:07 -070045 aidl.cpp \
46 aidl_language.cpp \
47 aidl_language_l.l \
48 aidl_language_y.y \
Christopher Wileyf600a552015-09-12 14:07:44 -070049 ast_cpp.cpp \
Christopher Wiley038485e2015-09-12 11:14:14 -070050 ast_java.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070051 code_writer.cpp \
Christopher Wileyeb1acc12015-09-16 11:25:13 -070052 generate_cpp.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070053 generate_java.cpp \
54 generate_java_binder.cpp \
Christopher Wiley72877ac2015-10-06 14:41:42 -070055 import_resolver.cpp \
Christopher Wileyef140932015-11-03 09:29:19 -080056 line_reader.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -070057 io_delegate.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070058 options.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -070059 type_cpp.cpp \
Christopher Wiley775fa1f2015-09-22 15:00:12 -070060 type_java.cpp \
Christopher Wileyfb4b22d2015-09-25 15:16:13 -070061 type_namespace.cpp \
The Android Open Source Project46c012c2008-10-21 07:00:00 -070062
Christopher Wiley3616d132015-09-01 11:07:48 -070063include $(BUILD_HOST_STATIC_LIBRARY)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070064
Christopher Wiley3616d132015-09-01 11:07:48 -070065
66# aidl executable
67include $(CLEAR_VARS)
68LOCAL_MODULE := aidl
69
70LOCAL_MODULE_HOST_OS := darwin linux windows
Christopher Wileyc5a9e282015-10-23 11:45:28 -070071LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wiley4427d862015-09-14 11:07:39 -070072LOCAL_C_INCLUDES := external/gtest/include
Christopher Wiley89eaab52015-09-15 14:46:46 -070073LOCAL_SRC_FILES := main_java.cpp
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070074LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070075include $(BUILD_HOST_EXECUTABLE)
76
Christopher Wileya590de82015-09-15 15:46:28 -070077# aidl-cpp executable
78include $(CLEAR_VARS)
79LOCAL_MODULE := aidl-cpp
80
81LOCAL_MODULE_HOST_OS := darwin linux windows
Christopher Wileyc5a9e282015-10-23 11:45:28 -070082LOCAL_CFLAGS := $(aidl_cflags)
Christopher Wileya590de82015-09-15 15:46:28 -070083LOCAL_C_INCLUDES := external/gtest/include
84LOCAL_SRC_FILES := main_cpp.cpp
85LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
86include $(BUILD_HOST_EXECUTABLE)
87
Christopher Wiley3616d132015-09-01 11:07:48 -070088
Christopher Wiley856a8692015-08-31 17:36:41 -070089# TODO(wiley) Compile these for mac as well after b/22771504
90ifeq ($(HOST_OS),linux)
Casey Dahlind8cc5092015-08-28 15:46:48 -070091# Unit tests
92include $(CLEAR_VARS)
93LOCAL_MODULE := aidl_unittests
Christopher Wiley3616d132015-09-01 11:07:48 -070094
Christopher Wileyc5a9e282015-10-23 11:45:28 -070095LOCAL_CFLAGS := $(aidl_cflags) -g -DUNIT_TEST
Christopher Wiley856a8692015-08-31 17:36:41 -070096# Tragically, the code is riddled with unused parameters.
97LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
Christopher Wiley3616d132015-09-01 11:07:48 -070098LOCAL_SRC_FILES := \
Christopher Wiley90be4e32015-10-20 14:55:25 -070099 aidl_unittest.cpp \
Christopher Wileyf600a552015-09-12 14:07:44 -0700100 ast_cpp_unittest.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700101 ast_java_unittest.cpp \
Casey Dahlina834dd42015-09-23 11:52:15 -0700102 generate_cpp_unittest.cpp \
Christopher Wiley3616d132015-09-01 11:07:48 -0700103 options_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700104 tests/end_to_end_tests.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700105 tests/fake_io_delegate.cpp \
Christopher Wileydb6c7112015-10-18 12:10:12 -0700106 tests/main.cpp \
Christopher Wileyaf2d5102015-10-18 11:36:23 -0700107 tests/test_data_example_interface.cpp \
108 tests/test_data_ping_responder.cpp \
Christopher Wileyea6e3822015-10-07 13:16:34 -0700109 tests/test_util.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -0700110 type_cpp_unittest.cpp \
Christopher Wiley4582ecb2015-09-25 13:27:45 -0700111 type_java_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700112
Christopher Wiley3616d132015-09-01 11:07:48 -0700113LOCAL_STATIC_LIBRARIES := \
114 libaidl-common \
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -0700115 $(aidl_static_libraries) \
Christopher Wiley3616d132015-09-01 11:07:48 -0700116 libgmock_host \
117 libgtest_host \
Christopher Wileyf321efd2015-09-01 12:39:25 -0700118
Christopher Wileyc545b7c2015-09-01 18:36:44 -0700119LOCAL_LDLIBS_linux := -lrt
120
Casey Dahlind8cc5092015-08-28 15:46:48 -0700121include $(BUILD_HOST_NATIVE_TEST)
Christopher Wiley856a8692015-08-31 17:36:41 -0700122endif # HOST_OS == linux
Casey Dahlind8cc5092015-08-28 15:46:48 -0700123
Ying Wangc7cf53e2014-03-07 15:55:14 -0800124endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700125
126include $(CLEAR_VARS)
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700127LOCAL_MODULE := aidl_test_service
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700128LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700129 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700130 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700131 tests/aidl_test_service.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700132LOCAL_SHARED_LIBRARIES := \
133 libbinder \
134 liblog \
135 libutils
Christopher Wileyc5a9e282015-10-23 11:45:28 -0700136LOCAL_CFLAGS := $(aidl_cflags) -Wunused-parameter
Casey Dahlin389781f2015-10-22 13:13:21 -0700137LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700138include $(BUILD_EXECUTABLE)
139
140include $(CLEAR_VARS)
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700141LOCAL_MODULE := aidl_test_client
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700142LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700143 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700144 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley33ad81e2015-10-21 14:41:11 -0700145 tests/aidl_test_client.cpp
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700146LOCAL_SHARED_LIBRARIES := \
147 libbinder \
148 liblog \
149 libutils
Christopher Wileyc5a9e282015-10-23 11:45:28 -0700150LOCAL_CFLAGS := $(aidl_cflags) -Wunused-parameter
Casey Dahlin389781f2015-10-22 13:13:21 -0700151LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wileyb5e698c2015-10-17 09:32:22 -0700152include $(BUILD_EXECUTABLE)
Christopher Wiley130e6862015-10-18 17:53:11 -0700153
Christopher Wiley2971cf32015-10-23 11:50:21 -0700154include $(CLEAR_VARS)
155LOCAL_MODULE := aidl_test_sentinel_searcher
156LOCAL_SRC_FILES := tests/aidl_test_sentinel_searcher.cpp
157LOCAL_CFLAGS := $(aidl_cflags) -Wunused-parameter
Casey Dahlin389781f2015-10-22 13:13:21 -0700158LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wiley2971cf32015-10-23 11:50:21 -0700159include $(BUILD_EXECUTABLE)
160
Christopher Wiley130e6862015-10-18 17:53:11 -0700161
162# aidl on its own doesn't need the framework, but testing native/java
163# compatibility introduces java dependencies.
164ifndef BRILLO
165
166include $(CLEAR_VARS)
167LOCAL_PACKAGE_NAME := aidl_test_services
Christopher Wiley34bbc7b2015-11-09 09:24:36 -0800168# Turn off Java optimization tools to speed up our test iterations.
169LOCAL_JACK_ENABLED := disabled
170LOCAL_PROGUARD_ENABLED := disabled
Christopher Wiley130e6862015-10-18 17:53:11 -0700171LOCAL_DEX_PREOPT := false
172LOCAL_CERTIFICATE := platform
173LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
Christopher Wiley130e6862015-10-18 17:53:11 -0700174LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
175LOCAL_SRC_FILES := \
Christopher Wiley521bb612015-10-22 11:40:30 -0700176 tests/android/aidl/tests/ITestService.aidl \
Casey Dahlin389781f2015-10-22 13:13:21 -0700177 tests/android/aidl/tests/INamedCallback.aidl \
Christopher Wiley521bb612015-10-22 11:40:30 -0700178 tests/java_app/src/android/aidl/tests/TestServiceClient.java
Casey Dahlin389781f2015-10-22 13:13:21 -0700179LOCAL_AIDL_INCLUDES := system/tools/aidl/tests/
Christopher Wiley130e6862015-10-18 17:53:11 -0700180include $(BUILD_PACKAGE)
181
182endif # not defined BRILLO