Android.mk revision d32ab53cd8a82a152ec0b3a5f33f9922928beb21
1# Copyright (C) 2009 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15#
16
17# Gtest builds 2 libraries: libgtest and libgtest_main. libgtest
18# contains most of the code (assertions...) and libgtest_main just
19# provide a common main to run the test (ie if you link against
20# libgtest_main you won't/should not provide a main() entry point.
21#
22# We build these 2 libraries for the target device and for the host if
23# it is running linux and using ASTL.
24#
25
26# TODO: The targets below have some redundancy. Check if we cannot
27# condense them using function(s) for the common code.
28
29LOCAL_PATH := $(call my-dir)
30
31libgtest_target_includes := \
32    bionic/libstdc++/include \
33    external/stlport/stlport \
34    $(LOCAL_PATH)/.. \
35    $(LOCAL_PATH)/../include
36
37libgtest_host_includes := \
38  $(LOCAL_PATH)/.. \
39  $(LOCAL_PATH)/../include
40
41#######################################################################
42# gtest lib host
43
44include $(CLEAR_VARS)
45
46LOCAL_CPP_EXTENSION := .cc
47
48LOCAL_SRC_FILES := gtest-all.cc
49
50LOCAL_C_INCLUDES := $(libgtest_host_includes)
51
52LOCAL_CFLAGS += -O0
53
54LOCAL_MODULE := libgtest_host
55LOCAL_MODULE_TAGS := eng
56
57include $(BUILD_HOST_STATIC_LIBRARY)
58
59#######################################################################
60# gtest_main lib host
61
62include $(CLEAR_VARS)
63
64LOCAL_CPP_EXTENSION := .cc
65
66LOCAL_SRC_FILES := gtest_main.cc
67
68LOCAL_C_INCLUDES := $(libgtest_host_includes)
69
70LOCAL_CFLAGS += -O0
71
72LOCAL_MODULE := libgtest_main_host
73LOCAL_MODULE_TAGS := eng
74
75include $(BUILD_HOST_STATIC_LIBRARY)
76
77#######################################################################
78# gtest lib target
79
80include $(CLEAR_VARS)
81
82LOCAL_CPP_EXTENSION := .cc
83
84LOCAL_SRC_FILES := gtest-all.cc
85
86LOCAL_C_INCLUDES := $(libgtest_target_includes)
87
88ifneq ($(BUILD_WITH_ASTL),true)
89include external/stlport/libstlport.mk
90endif
91
92LOCAL_MODULE := libgtest
93LOCAL_MODULE_TAGS := eng
94
95include $(BUILD_STATIC_LIBRARY)
96
97#######################################################################
98# gtest_main lib target
99
100include $(CLEAR_VARS)
101
102LOCAL_CPP_EXTENSION := .cc
103
104LOCAL_SRC_FILES := gtest_main.cc
105
106LOCAL_C_INCLUDES := $(libgtest_target_includes)
107
108ifneq ($(BUILD_WITH_ASTL),true)
109include external/stlport/libstlport.mk
110endif
111
112LOCAL_MODULE := libgtest_main
113LOCAL_MODULE_TAGS := eng
114
115include $(BUILD_STATIC_LIBRARY)
116