blob: 2e5e0973020d269a05ae0db5ba1989989fafe48c [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
Joe Onorato54fba422010-06-10 18:34:55 -070019# This tool is prebuilt if we're doing an app-only build.
Ying Wangc7cf53e2014-03-07 15:55:14 -080020ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
Joe Onorato54fba422010-06-10 18:34:55 -070021
Christopher Wileyb8b59f62015-09-15 12:19:53 -070022aidl_static_libraries := libbase libcutils
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070023
Christopher Wiley3616d132015-09-01 11:07:48 -070024# Logic shared between aidl and its unittests
The Android Open Source Project46c012c2008-10-21 07:00:00 -070025include $(CLEAR_VARS)
Christopher Wiley3616d132015-09-01 11:07:48 -070026LOCAL_MODULE := libaidl-common
Dan Willemseneada0252015-09-04 14:21:26 -070027LOCAL_MODULE_HOST_OS := darwin linux windows
The Android Open Source Project46c012c2008-10-21 07:00:00 -070028
Christopher Wiley4427d862015-09-14 11:07:39 -070029LOCAL_C_INCLUDES := external/gtest/include
Christopher Wileye0146cf2015-08-24 15:06:58 -070030LOCAL_CLANG_CFLAGS := -Wall -Werror
31# Tragically, the code is riddled with unused parameters.
32LOCAL_CLANG_CFLAGS += -Wno-unused-parameter
33# yacc dumps a lot of code *just in case*.
34LOCAL_CLANG_CFLAGS += -Wno-unused-function
35LOCAL_CLANG_CFLAGS += -Wno-unneeded-internal-declaration
36# yacc is a tool from a more civilized age.
37LOCAL_CLANG_CFLAGS += -Wno-deprecated-register
38# yacc also has a habit of using char* over const char*.
39LOCAL_CLANG_CFLAGS += -Wno-writable-strings
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070040LOCAL_STATIC_LIBRARIES := $(aidl_static_libraries)
Christopher Wileye0146cf2015-08-24 15:06:58 -070041
The Android Open Source Project46c012c2008-10-21 07:00:00 -070042LOCAL_SRC_FILES := \
Christopher Wiley89e35862015-08-30 10:57:07 -070043 aidl.cpp \
44 aidl_language.cpp \
45 aidl_language_l.l \
46 aidl_language_y.y \
Christopher Wileyf600a552015-09-12 14:07:44 -070047 ast_cpp.cpp \
Christopher Wiley038485e2015-09-12 11:14:14 -070048 ast_java.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070049 code_writer.cpp \
Christopher Wileyeb1acc12015-09-16 11:25:13 -070050 generate_cpp.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070051 generate_java.cpp \
52 generate_java_binder.cpp \
Christopher Wiley72877ac2015-10-06 14:41:42 -070053 import_resolver.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -070054 io_delegate.cpp \
Christopher Wiley89e35862015-08-30 10:57:07 -070055 options.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -070056 type_cpp.cpp \
Christopher Wiley775fa1f2015-09-22 15:00:12 -070057 type_java.cpp \
Christopher Wileyfb4b22d2015-09-25 15:16:13 -070058 type_namespace.cpp \
The Android Open Source Project46c012c2008-10-21 07:00:00 -070059
Christopher Wiley3616d132015-09-01 11:07:48 -070060include $(BUILD_HOST_STATIC_LIBRARY)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070061
Christopher Wiley3616d132015-09-01 11:07:48 -070062
63# aidl executable
64include $(CLEAR_VARS)
65LOCAL_MODULE := aidl
66
67LOCAL_MODULE_HOST_OS := darwin linux windows
68LOCAL_CFLAGS := -Wall -Werror
Christopher Wiley4427d862015-09-14 11:07:39 -070069LOCAL_C_INCLUDES := external/gtest/include
Christopher Wiley89eaab52015-09-15 14:46:46 -070070LOCAL_SRC_FILES := main_java.cpp
Christopher Wiley7c3a1eb2015-09-12 10:19:52 -070071LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
The Android Open Source Project46c012c2008-10-21 07:00:00 -070072include $(BUILD_HOST_EXECUTABLE)
73
Christopher Wileya590de82015-09-15 15:46:28 -070074# aidl-cpp executable
75include $(CLEAR_VARS)
76LOCAL_MODULE := aidl-cpp
77
78LOCAL_MODULE_HOST_OS := darwin linux windows
79LOCAL_CFLAGS := -Wall -Werror
80LOCAL_C_INCLUDES := external/gtest/include
81LOCAL_SRC_FILES := main_cpp.cpp
82LOCAL_STATIC_LIBRARIES := libaidl-common $(aidl_static_libraries)
83include $(BUILD_HOST_EXECUTABLE)
84
Christopher Wiley3616d132015-09-01 11:07:48 -070085
Christopher Wiley856a8692015-08-31 17:36:41 -070086# TODO(wiley) Compile these for mac as well after b/22771504
87ifeq ($(HOST_OS),linux)
Casey Dahlind8cc5092015-08-28 15:46:48 -070088# Unit tests
89include $(CLEAR_VARS)
90LOCAL_MODULE := aidl_unittests
Christopher Wiley3616d132015-09-01 11:07:48 -070091
92LOCAL_CFLAGS := -g -DUNIT_TEST -Wall -Werror
Christopher Wiley856a8692015-08-31 17:36:41 -070093# Tragically, the code is riddled with unused parameters.
94LOCAL_CLANG_CFLAGS := -Wno-unused-parameter
Christopher Wiley3616d132015-09-01 11:07:48 -070095LOCAL_SRC_FILES := \
Christopher Wiley90be4e32015-10-20 14:55:25 -070096 aidl_unittest.cpp \
Christopher Wileyf600a552015-09-12 14:07:44 -070097 ast_cpp_unittest.cpp \
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070098 ast_java_unittest.cpp \
Casey Dahlina834dd42015-09-23 11:52:15 -070099 generate_cpp_unittest.cpp \
Christopher Wiley3616d132015-09-01 11:07:48 -0700100 options_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700101 tests/end_to_end_tests.cpp \
Christopher Wiley4a2884b2015-10-07 11:27:45 -0700102 tests/fake_io_delegate.cpp \
Christopher Wileydb6c7112015-10-18 12:10:12 -0700103 tests/main.cpp \
Christopher Wileyaf2d5102015-10-18 11:36:23 -0700104 tests/test_data_example_interface.cpp \
105 tests/test_data_ping_responder.cpp \
Christopher Wileyea6e3822015-10-07 13:16:34 -0700106 tests/test_util.cpp \
Christopher Wileya8a2dc02015-09-28 16:35:31 -0700107 type_cpp_unittest.cpp \
Christopher Wiley4582ecb2015-09-25 13:27:45 -0700108 type_java_unittest.cpp \
Christopher Wiley856a8692015-08-31 17:36:41 -0700109
110LOCAL_SHARED_LIBRARIES := \
111 libchrome-host \
Christopher Wiley3616d132015-09-01 11:07:48 -0700112
113LOCAL_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)
127LOCAL_MODULE := hellod
128LOCAL_C_INCLUDES := tests/ping_responder
129LOCAL_SRC_FILES := \
130 tests/ping_responder/aidl/android/os/IPingResponder.aidl \
131 tests/ping_responder/hellod.cpp
132LOCAL_SHARED_LIBRARIES := \
133 libbinder \
134 liblog \
135 libutils
136LOCAL_CFLAGS := -Wall -Wextra -Werror
137include $(BUILD_EXECUTABLE)
138
139include $(CLEAR_VARS)
140LOCAL_MODULE := helloc
141LOCAL_C_INCLUDES := tests/ping_responder
142LOCAL_SRC_FILES := \
143 tests/ping_responder/aidl/android/os/IPingResponder.aidl \
144 tests/ping_responder/helloc.cpp
145LOCAL_SHARED_LIBRARIES := \
146 libbinder \
147 liblog \
148 libutils
149LOCAL_CFLAGS := -Wall -Wextra -Werror
150include $(BUILD_EXECUTABLE)
Christopher Wiley130e6862015-10-18 17:53:11 -0700151
152
153# aidl on its own doesn't need the framework, but testing native/java
154# compatibility introduces java dependencies.
155ifndef BRILLO
156
157include $(CLEAR_VARS)
158LOCAL_PACKAGE_NAME := aidl_test_services
159LOCAL_MODULE_OWNER := google
160LOCAL_DEX_PREOPT := false
161LOCAL_CERTIFICATE := platform
162LOCAL_MANIFEST_FILE := tests/java_app/AndroidManifest.xml
163LOCAL_PRIVILEGED_MODULE := true
164LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/tests/java_app/resources
165LOCAL_SRC_FILES := \
166 tests/ping_responder/aidl/android/os/IPingResponder.aidl \
167 tests/java_app/src/android/aidl/tests/PingResponderClient.java
168include $(BUILD_PACKAGE)
169
170endif # not defined BRILLO