我有一个为 x86、armeabi 和 armeabi-v7a 平台构建的 Android 本机应用程序。现在取决于平台是 x86 还是 arm,我需要使用相应的参数相应地运行脚本,以便设置适当的第三方工具环境变量。我试着在下面做:
.o.cpp:
ifeq ($(TARGET_ARCH),x86)
$(info $(shell ($(CACHE_LOCAL_PATH_MAIN)/setup_tool.sh x86)))
else
$(info $(shell ($(CACHE_LOCAL_PATH_MAIN)/setup_tool.sh arm)))
endif
但问题是,当解析生成文件时,这些脚本会在初始阶段本身运行 3 次,而不是在每个平台开始编译之前。有没有办法解决这个问题,以便在每个平台的编译开始之前运行脚本?谢谢。
使用 Android.mk 文件更新:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \ <path_to_include_files>
LOCAL_CFLAGS := <cflags included here>
LOCAL_LDLIBS := <ld libs included here>
LOCAL_SRC_FILES := <src files to be compiled>
LOCAL_MODULE := <module_name>
LOCAL_SHARED_LIBRARIES := <shared libs on which we are dependent>
LOCAL_WHOLE_STATIC_LIBRARIES := <static libs>
include $(BUILD_SHARED_LIBRARY)