bionic benchmarks: export benchmark library
Export libbenchmark for external projects to write benchmarks against.
Change-Id: I3b04a56a62ce517afc0d5e06dc8d28879ada3d30
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk
index 5ce8542..8f5fd41 100644
--- a/benchmarks/Android.mk
+++ b/benchmarks/Android.mk
@@ -19,6 +19,27 @@
LOCAL_PATH := $(call my-dir)
# -----------------------------------------------------------------------------
+# Benchmarks library, usable by projects outside this directory.
+# -----------------------------------------------------------------------------
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libbenchmark
+LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror
+LOCAL_SRC_FILES := benchmark_main.cpp
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libbenchmark
+LOCAL_CFLAGS += -O2 -Wall -Wextra -Werror
+LOCAL_SRC_FILES := benchmark_main.cpp
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_MULTILIB := both
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# -----------------------------------------------------------------------------
# Benchmarks.
# -----------------------------------------------------------------------------
@@ -30,7 +51,6 @@
-std=gnu++11 \
benchmark_src_files = \
- benchmark_main.cpp \
math_benchmark.cpp \
pthread_benchmark.cpp \
semaphore_benchmark.cpp \
@@ -47,10 +67,9 @@
LOCAL_MODULE_STEM_32 := bionic-benchmarks32
LOCAL_MODULE_STEM_64 := bionic-benchmarks64
LOCAL_MULTILIB := both
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CFLAGS += $(benchmark_c_flags)
LOCAL_SRC_FILES := $(benchmark_src_files) property_benchmark.cpp
-LOCAL_CXX_STL := libc++
+LOCAL_STATIC_LIBRARIES += libbenchmark
include $(BUILD_EXECUTABLE)
# We don't build a static benchmark executable because it's not usually
@@ -65,11 +84,10 @@
LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
LOCAL_MULTILIB := both
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CFLAGS += $(benchmark_c_flags)
LOCAL_LDFLAGS += -lrt
LOCAL_SRC_FILES := $(benchmark_src_files)
-LOCAL_CXX_STL := libc++
+LOCAL_STATIC_LIBRARIES += libbenchmark
include $(BUILD_HOST_EXECUTABLE)
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))