Android.mk revision 4a05bef4c06dac05f1c9aa8cfc5b7e7dd6642385
1cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
2cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Copyright (C) 2012 The Android Open Source Project
3cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
4cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Licensed under the Apache License, Version 2.0 (the "License");
5cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# you may not use this file except in compliance with the License.
6cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# You may obtain a copy of the License at
7cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
8cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#      http://www.apache.org/licenses/LICENSE-2.0
9cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
10cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Unless required by applicable law or agreed to in writing, software
11cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# distributed under the License is distributed on an "AS IS" BASIS,
12cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# See the License for the specific language governing permissions and
14cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# limitations under the License.
155ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby#
165ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby
175ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Gobyifneq ($(BUILD_TINY_ANDROID), true)
18cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
19cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott HughesLOCAL_PATH := $(call my-dir)
20cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
217be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
227be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Benchmarks.
237be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
247be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
257be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughesbenchmark_c_flags = \
267be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes    -O2 \
277be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes    -Wall -Wextra \
287be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes    -Werror \
299edb3e004b487e08cbbb54f2af18b15241550513Elliott Hughes    -fno-builtin \
307be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
317be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughesbenchmark_src_files = \
327be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes    benchmark_main.cpp \
339edb3e004b487e08cbbb54f2af18b15241550513Elliott Hughes    math_benchmark.cpp \
347be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes    string_benchmark.cpp \
354a05bef4c06dac05f1c9aa8cfc5b7e7dd6642385Elliott Hughes    time_benchmark.cpp \
367be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
377be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build benchmarks for the device (with bionic's .so). Run with:
387be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes#   adb shell bionic-benchmarks
397be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughesinclude $(CLEAR_VARS)
407be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_MODULE := bionic-benchmarks
417be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
427be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_CFLAGS += $(benchmark_c_flags)
437be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
447be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_SHARED_LIBRARIES += libstlport
457be369d4c60e9df2316fdb6c73181a40020abef2Elliott HughesLOCAL_SRC_FILES := $(benchmark_src_files)
467be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughesinclude $(BUILD_EXECUTABLE)
477be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
487be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
497be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Unit tests.
507be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
517be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
52ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughestest_c_flags = \
53dcab1b2c76a498c56bc00024613386de8b4b2aaeNick Kralevich    -fstack-protector-all \
54ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    -g \
55ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    -Wall -Wextra \
56ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    -Werror \
57a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes    -fno-builtin \
58ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes
59cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughestest_src_files = \
6041b3179c9ef03ebb447cac7f5e8405dce399cb17Elliott Hughes    debug_format_test.cpp \
61063cfb2084ea4b12d3c85b2d2c44e888f0857eb4Elliott Hughes    dirent_test.cpp \
6290e10d41c4271a5d517f60f4ff1d2891b8ccc034Elliott Hughes    fenv_test.cpp \
632c5153b043b44e9935a334ae9b2d5a4bc5258b40Nick Kralevich    getauxval_test.cpp \
6404a83a48ed89f433c78e31106ed50059764797a0Elliott Hughes    getcwd_test.cpp \
6558b575485c446f9d76ee00f67516ed42cf017769Elliott Hughes    libgen_test.cpp \
66a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes    math_test.cpp \
67d3b9d11369ee15dc0ce512014284c3c5432f2813Elliott Hughes    netdb_test.cpp \
68bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes    pthread_test.cpp \
69cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes    regex_test.cpp \
70da73f655fcbac6e1a8bfd35303cef6f41187d12bElliott Hughes    signal_test.cpp \
71ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    stack_protector_test.cpp \
7291875dcd6e17b7f3b251efe9b236b905ef414ddeElliott Hughes    stdio_test.cpp \
73774c7f54ff375d71106283d42779b0cc5f238f87Elliott Hughes    stdlib_test.cpp \
74b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea    string_test.cpp \
7573964c592c8d23901e9479893dfbd3d0f25bab04Elliott Hughes    strings_test.cpp \
762a54e5ecd0a96398e8d7d9b1629ecf8fb1633a2bKenny Root    stubs_test.cpp \
77a55f63083fb16b2595f517a3260083e5f8cddd02Elliott Hughes    unistd_test.cpp \
78cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
79acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaotest_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
80acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaotest_dynamic_src_files = \
81e66190d2a97a713ae4b4786e60ca3d67ab8aa192Elliott Hughes    dlfcn_test.cpp \
82acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhao
837be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the device (with bionic's .so). Run with:
84cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
85cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(CLEAR_VARS)
867b841f3b4ad121dd64f639c1858b42defffd60bdJoe OnoratoLOCAL_MODULE := bionic-unit-tests
872e8f4345dfe16e64d7a3c26f688f17f2b48b2dd1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
88ad88a0863110798cef5169dcf917e18b967a7cf6Elliott HughesLOCAL_CFLAGS += $(test_c_flags)
89acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_LDFLAGS += $(test_dynamic_ldflags)
90acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SHARED_LIBRARIES += libdl
91acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
92cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(BUILD_NATIVE_TEST)
93cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
947be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the device (with bionic's .a). Run with:
95bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes#   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
96bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughesinclude $(CLEAR_VARS)
97bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott HughesLOCAL_MODULE := bionic-unit-tests-static
98bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
99ad88a0863110798cef5169dcf917e18b967a7cf6Elliott HughesLOCAL_CFLAGS += $(test_c_flags)
100acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_FORCE_STATIC_EXECUTABLE := true
101bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott HughesLOCAL_SRC_FILES := $(test_src_files)
102acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
103bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughesinclude $(BUILD_NATIVE_TEST)
104bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes
1057be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
1067be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Test library for the unit tests.
1077be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
108124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
109124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes# Build no-elf-hash-table-library.so to test dlopen(3) on a library that
110a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughes# only has a GNU-style hash table. MIPS doesn't support GNU hash style.
111a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughesifneq ($(TARGET_ARCH),mips)
112124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughesinclude $(CLEAR_VARS)
113124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_MODULE := no-elf-hash-table-library
114124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
115124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_SRC_FILES := empty.cpp
116124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_LDFLAGS := -Wl,--hash-style=gnu
117124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughesinclude $(BUILD_SHARED_LIBRARY)
118a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughesendif
119124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
1207be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
1217be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Unit tests built against glibc.
1227be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
123124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
1247be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the host (with glibc).
125cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Note that this will build against glibc, so it's not useful for testing
126cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# bionic's implementation, but it does let you use glibc as a reference
127cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# implementation for testing the tests themselves.
12838bfa21695b19c21784d2074de30d5d102f08972Elliott Hughesifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
129cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(CLEAR_VARS)
1307b841f3b4ad121dd64f639c1858b42defffd60bdJoe OnoratoLOCAL_MODULE := bionic-unit-tests-glibc
1312e8f4345dfe16e64d7a3c26f688f17f2b48b2dd1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
132ad88a0863110798cef5169dcf917e18b967a7cf6Elliott HughesLOCAL_CFLAGS += $(test_c_flags)
133acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_LDFLAGS += -lpthread -ldl
134acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_LDFLAGS += $(test_dynamic_ldflags)
135acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
136cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(BUILD_HOST_NATIVE_TEST)
13738bfa21695b19c21784d2074de30d5d102f08972Elliott Hughesendif
1385ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby
1395ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Gobyendif # !BUILD_TINY_ANDROID
140