[Android] Fix missing clang deps from libcommon
libcommon requires libblocksruntime when compiled with clang. A common static
libs flag has been created to automatically include dep for all three targets when
compiling with clang. '-fblocks' flag is already propagated from
'COMMON_CFLAGS'.
@@ -137,11 +137,17 @@ COMMON_CFLAGS := -std=c11 -I. \
-Wno-unknown-warning-option -Werror -funroll-loops -O2 \
-Wframe-larger-than=51200
+ifneq (,$(findstring clang,$(NDK_TOOLCHAIN)))
+ COMMON_CFLAGS += -fblocks
+ COMMON_STATIC_LIBS += libblocksruntime
+endif
+
# libcommon module
include $(CLEAR_VARS)
LOCAL_MODULE := common
LOCAL_SRC_FILES := $(wildcard libcommon/*.c)
LOCAL_CFLAGS := -D_HF_ARCH_${ARCH} $(COMMON_CFLAGS)
+LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBS)
include $(BUILD_STATIC_LIBRARY)
# libhfuzz module
@@ -150,10 +156,7 @@ LOCAL_MODULE := hfuzz
LOCAL_SRC_FILES := $(wildcard libhfuzz/*.c)
LOCAL_CFLAGS := -D_HF_ARCH_${ARCH} $(COMMON_CFLAGS) \
-fPIC -fno-builtin -fno-stack-protector
-ifneq (,$(findstring clang,$(NDK_TOOLCHAIN)))
- LOCAL_CFLAGS += -fblocks
- LOCAL_STATIC_LIBRARIES += libblocksruntime
-endif
+LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBS)
include $(BUILD_STATIC_LIBRARY)
# Main honggfuzz module
@@ -162,7 +165,7 @@ LOCAL_MODULE := honggfuzz
LOCAL_SRC_FILES := $(wildcard *.c)
LOCAL_CFLAGS := $(COMMON_CFLAGS)
LOCAL_LDFLAGS := -lm -latomic
-LOCAL_STATIC_LIBRARIES += common
+LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBS) common
ifeq ($(ANDROID_WITH_PTRACE),true)
LOCAL_STATIC_LIBRARIES += libunwind-arch \
@@ -179,11 +182,6 @@ endif
LOCAL_SRC_FILES += $(ARCH_SRCS)
LOCAL_CFLAGS += -D_HF_ARCH_${ARCH}
-ifneq (,$(findstring clang,$(NDK_TOOLCHAIN)))
- LOCAL_CFLAGS += -fblocks
- LOCAL_STATIC_LIBRARIES += libblocksruntime
-endif
-
include $(BUILD_EXECUTABLE)
# The NDK build system does not copy static libraries into project/packages
