blob: 4f0efe3090fe37c1c7c0f19db1431081b4a1e08e [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -07001#
2# Copyright (C) 2011 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
Brian Carlstrom07d579f2011-07-27 13:31:51 -070017# $(1): target or host
18# $(2): ndebug or debug
19define build-libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070020 ifneq ($(1),target)
21 ifneq ($(1),host)
22 $$(error expected target or host for argument 1, received $(1))
23 endif
24 endif
25 ifneq ($(2),ndebug)
26 ifneq ($(2),debug)
27 $$(error expected ndebug or debug for argument 2, received $(2))
28 endif
29 endif
30
31 art_target_or_host := $(1)
32 art_ndebug_or_debug := $(2)
33
Brian Carlstrom07d579f2011-07-27 13:31:51 -070034 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070035 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070036 include external/stlport/libstlport.mk
37 endif
38 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom0796af02011-10-12 14:31:45 -070039 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070040 LOCAL_MODULE := libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070041 else # debug
Brian Carlstrom07d579f2011-07-27 13:31:51 -070042 LOCAL_MODULE := libartd
43 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070044
Brian Carlstrom07d579f2011-07-27 13:31:51 -070045 LOCAL_MODULE_TAGS := optional
Brian Carlstrom0796af02011-10-12 14:31:45 -070046 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070047 LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
Brian Carlstrom0796af02011-10-12 14:31:45 -070048 else # host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070049 LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
50 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070051 ifeq ($$(art_target_or_host),target)
Elliott Hughes1d3f1142011-09-13 12:00:00 -070052 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070053 else # host
Elliott Hughes1d3f1142011-09-13 12:00:00 -070054 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
55 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070056 ifeq ($$(art_ndebug_or_debug),debug)
57 ifeq ($$(art_target_or_host),target)
Brian Carlstrom86927212011-09-15 11:31:11 -070058 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070059 else # host
Brian Carlstrom86927212011-09-15 11:31:11 -070060 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Brian Carlstrom08125a02011-09-16 14:55:51 -070061 LOCAL_STATIC_LIBRARIES := libgtest_host
Brian Carlstrom86927212011-09-15 11:31:11 -070062 endif
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070063 else
64 ifeq ($$(art_target_or_host),target)
65 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
66 else # host
67 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
68 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -070069 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070070 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Elliott Hughes18c07532011-08-18 15:50:51 -070071 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Brian Carlstrom0796af02011-10-12 14:31:45 -070072 ifeq ($$(art_target_or_host),target)
Elliott Hughes0af55432011-08-17 18:37:28 -070073 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
Brian Carlstrom0796af02011-10-12 14:31:45 -070074 else # host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070075 LOCAL_SHARED_LIBRARIES += libz-host
76 LOCAL_LDLIBS := -ldl -lpthread -lrt
77 endif
buzbeec143c552011-08-20 17:38:58 -070078 LOCAL_STATIC_LIBRARIES += libdex
Brian Carlstrom0796af02011-10-12 14:31:45 -070079 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070080 include $(BUILD_SHARED_LIBRARY)
Brian Carlstrom0796af02011-10-12 14:31:45 -070081 else # host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070082 include $(BUILD_HOST_SHARED_LIBRARY)
83 endif
84endef
85
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070086ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
87 $(eval $(call build-libart,target,ndebug))
88endif
89ifeq ($(ART_BUILD_TARGET_DEBUG),true)
90 $(eval $(call build-libart,target,debug))
91endif
92ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070093 $(eval $(call build-libart,host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070094endif
95ifeq ($(ART_BUILD_HOST_DEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070096 $(eval $(call build-libart,host,debug))
97endif