Add NDEBUG build
Change-Id: I81032fb43d6b4919bd264a644062dc31ae564427
diff --git a/build/Android.aexec.host.mk b/build/Android.aexec.host.mk
deleted file mode 100644
index 25a66a8..0000000
--- a/build/Android.aexec.host.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := aexec
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(AEXEC_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_SHARED_LIBRARIES := libart
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/build/Android.aexec.mk b/build/Android.aexec.mk
index 216cc2c..a7e39b6 100644
--- a/build/Android.aexec.mk
+++ b/build/Android.aexec.mk
@@ -14,12 +14,40 @@
# limitations under the License.
#
-include $(CLEAR_VARS)
-include external/stlport/libstlport.mk
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := aexec
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(AEXEC_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_SHARED_LIBRARIES := libart libstlport
-include $(BUILD_EXECUTABLE)
+# $(1): target or host
+# $(2): ndebug or debug
+define build-aexec
+ include $(CLEAR_VARS)
+ ifeq ($(1),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ ifeq ($(2),ndebug)
+ LOCAL_MODULE := aexec
+ else
+ LOCAL_MODULE := aexecd
+ endif
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_SRC_FILES := $(AEXEC_SRC_FILES)
+ LOCAL_CFLAGS := $(ART_CFLAGS)
+ ifeq ($(2),debug)
+ LOCAL_CFLAGS += -UNDEBUG
+ endif
+ LOCAL_SHARED_LIBRARIES := libart
+ ifeq ($(1),target)
+ LOCAL_SHARED_LIBRARIES += libstlport
+ endif
+ ifeq ($(1),target)
+ include $(BUILD_EXECUTABLE)
+ else
+ include $(BUILD_HOST_EXECUTABLE)
+ endif
+endef
+
+$(eval $(call build-aexec,target,ndebug))
+$(eval $(call build-aexec,target,debug))
+ifeq ($(WITH_HOST_DALVIK),true)
+ $(eval $(call build-aexec,host,ndebug))
+ $(eval $(call build-aexec,host,debug))
+endif
+
diff --git a/build/Android.libart.host.mk b/build/Android.libart.host.mk
deleted file mode 100644
index 9772d63..0000000
--- a/build/Android.libart.host.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := libart
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_C_INCLUDES += src external/gtest/include
-LOCAL_SHARED_LIBRARIES := liblog libz-host
-LOCAL_LDLIBS := -ldl -lpthread -lrt
-include $(BUILD_HOST_SHARED_LIBRARY)
diff --git a/build/Android.libart.mk b/build/Android.libart.mk
index fae5c7e..de07b8c 100644
--- a/build/Android.libart.mk
+++ b/build/Android.libart.mk
@@ -14,13 +14,47 @@
# limitations under the License.
#
-include $(CLEAR_VARS)
-include external/stlport/libstlport.mk
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := libart
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_C_INCLUDES += src external/gtest/include
-LOCAL_SHARED_LIBRARIES := libcutils liblog libstlport libz
-include $(BUILD_SHARED_LIBRARY)
+# $(1): target or host
+# $(2): ndebug or debug
+define build-libart
+ include $(CLEAR_VARS)
+ ifeq ($(1),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ ifeq ($(2),ndebug)
+ LOCAL_MODULE := libart
+ else
+ LOCAL_MODULE := libartd
+ endif
+ LOCAL_MODULE_TAGS := optional
+ ifeq ($(1),target)
+ LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
+ else
+ LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
+ endif
+ LOCAL_CFLAGS := $(ART_CFLAGS)
+ ifeq ($(2),debug)
+ LOCAL_CFLAGS += -UNDEBUG
+ endif
+ LOCAL_C_INCLUDES += src external/gtest/include
+ LOCAL_SHARED_LIBRARIES := liblog
+ ifeq ($(1),target)
+ LOCAL_SHARED_LIBRARIES += libcutils libstlport libz
+ else
+ LOCAL_SHARED_LIBRARIES += libz-host
+ LOCAL_LDLIBS := -ldl -lpthread -lrt
+ endif
+ ifeq ($(1),target)
+ include $(BUILD_SHARED_LIBRARY)
+ else
+ include $(BUILD_HOST_SHARED_LIBRARY)
+ endif
+endef
+
+$(eval $(call build-libart,target,ndebug))
+$(eval $(call build-libart,target,debug))
+ifeq ($(WITH_HOST_DALVIK),true)
+ $(eval $(call build-libart,host,ndebug))
+ $(eval $(call build-libart,host,debug))
+endif
diff --git a/build/Android.libarttest.mk b/build/Android.libarttest.mk
new file mode 100644
index 0000000..37e45a1
--- /dev/null
+++ b/build/Android.libarttest.mk
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# $(1): target or host
+define build-libarttest
+ include $(CLEAR_VARS)
+ ifeq ($(1),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ LOCAL_MODULE := libarttest
+ LOCAL_MODULE_TAGS := tests
+ LOCAL_SRC_FILES := $(LIBARTTEST_COMMON_SRC_FILES)
+ LOCAL_CFLAGS := $(ART_CFLAGS) -UNDEBUG
+ ifeq ($(1),target)
+ LOCAL_SHARED_LIBRARIES := libstlport
+ else
+ LOCAL_LDLIBS := -lrt
+ endif
+ ifeq ($(1),target)
+ include $(BUILD_SHARED_LIBRARY)
+ else
+ include $(BUILD_HOST_SHARED_LIBRARY)
+ endif
+endef
+
+$(eval $(call build-libarttest,target))
+ifeq ($(WITH_HOST_DALVIK),true)
+ $(eval $(call build-libarttest,host))
+endif
diff --git a/build/Android.test.host.mk b/build/Android.test.host.mk
deleted file mode 100644
index d440cd1..0000000
--- a/build/Android.test.host.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := libarttest
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(LIBARTTEST_COMMON_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_LDLIBS := -lrt
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-$(foreach file,$(TEST_HOST_SRC_FILES), \
- $(eval include $(CLEAR_VARS)) \
- $(eval LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)) \
- $(eval LOCAL_MODULE := $(notdir $(basename $(file:%.arm=%)))) \
- $(eval LOCAL_MODULE_TAGS := tests) \
- $(eval LOCAL_SRC_FILES := $(file)) \
- $(eval LOCAL_CFLAGS := $(ART_CFLAGS)) \
- $(eval LOCAL_C_INCLUDES += external/gtest/include) \
- $(eval LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host libgtest_main_host) \
- $(eval LOCAL_SHARED_LIBRARIES := libarttest libart) \
- $(eval include $(BUILD_HOST_EXECUTABLE)) \
-)
diff --git a/build/Android.test.mk b/build/Android.test.mk
index 908ef20..ba314bd 100644
--- a/build/Android.test.mk
+++ b/build/Android.test.mk
@@ -14,26 +14,34 @@
# limitations under the License.
#
-include $(CLEAR_VARS)
-include external/stlport/libstlport.mk
-LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
-LOCAL_MODULE := libarttest
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(LIBARTTEST_COMMON_SRC_FILES)
-LOCAL_CFLAGS := $(ART_CFLAGS)
-LOCAL_SHARED_LIBRARIES := libstlport
-include $(BUILD_SHARED_LIBRARY)
+# $(1): target or host
+# $(2): file name with .cc or .cc.arm extension
+define build-art-test
+ include $(CLEAR_VARS)
+ ifeq ($(1),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ LOCAL_MODULE := $(notdir $(basename $(2:%.arm=%)))
+ LOCAL_MODULE_TAGS := tests
+ LOCAL_SRC_FILES := $(2)
+ LOCAL_CFLAGS := $(ART_CFLAGS)
+ LOCAL_C_INCLUDES += external/gtest/include
+ LOCAL_SHARED_LIBRARIES := libarttest libart
+ ifeq ($(1),target)
+ LOCAL_SHARED_LIBRARIES += libstlport
+ LOCAL_STATIC_LIBRARIES := libgtest libgtest_main
+ else
+ LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host libgtest_main_host
+ endif
+ ifeq ($(1),target)
+ include $(BUILD_EXECUTABLE)
+ else
+ include $(BUILD_HOST_EXECUTABLE)
+ endif
+endef
-$(foreach file,$(TEST_TARGET_SRC_FILES), \
- $(eval include $(CLEAR_VARS)) \
- $(eval include external/stlport/libstlport.mk) \
- $(eval LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)) \
- $(eval LOCAL_MODULE := $(notdir $(basename $(file:%.arm=%)))) \
- $(eval LOCAL_MODULE_TAGS := tests) \
- $(eval LOCAL_SRC_FILES := $(file)) \
- $(eval LOCAL_CFLAGS := $(ART_CFLAGS)) \
- $(eval LOCAL_C_INCLUDES += external/gtest/include) \
- $(eval LOCAL_STATIC_LIBRARIES := libgtest libgtest_main) \
- $(eval LOCAL_SHARED_LIBRARIES := libarttest libart libstlport) \
- $(eval include $(BUILD_EXECUTABLE)) \
-)
+$(foreach file,$(TEST_TARGET_SRC_FILES), $(eval $(call build-art-test,target,$(file))))
+ifeq ($(WITH_HOST_DALVIK),true)
+ $(foreach file,$(TEST_HOST_SRC_FILES), $(eval $(call build-art-test,host,$(file))))
+endif