Merge change 5636 into donut

* changes:
  Add support for LOCAL_ARM_MODE and .arm source file name suffix. Also update docs/INSTALL.TXT to explain that MSys is not supported under Windows.
This commit is contained in:
Android (Google) Code Review
2009-06-29 08:23:39 -07:00
5 changed files with 53 additions and 18 deletions

View File

@@ -109,29 +109,37 @@ LOCAL_ARM_TEXT := $(LOCAL_ARM_TEXT_$(LOCAL_ARM_MODE))
# Build C source files into .o
#
# XXX: TODO: support LOCAL_ARM_MODE
ifeq ($(LOCAL_ARM_MODE),arm)
arm_sources := $(LOCAL_SRC_FILES)
else
arm_sources := $(filter %.arm,$(LOCAL_SRC_FILES))
thumb_sources := $(filter-out %.arm,$(LOCAL_SRC_FILES))
endif
arm_sources := $(LOCAL_SRC_FILES:%.arm)
# First, build the 'thumb' sources
#
LOCAL_ARM_MODE := thumb
c_sources := $(filter %.c, \
$(LOCAL_SRC_FILES) \
$(arm_sources:%.arm=%))
$(foreach src,$(filter %.c,$(thumb_sources)), $(call compile-c-source,$(src)))
$(foreach src,$(filter %.S,$(thumb_sources)), $(call compile-s-source,$(src)))
s_sources := $(filter %.S, \
$(LOCAL_SRC_FILES) \
$(arm_sources:%.arm=%))
$(foreach src,$(filter %$(LOCAL_CPP_EXTENSION),$(thumb_sources)),\
$(call compile-cpp-source,$(src)))
cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION), \
$(LOCAL_SRC_FILES) \
$(arm_sources:%.arm=%))
# Then, the 'ARM' ones
#
LOCAL_ARM_MODE := arm
arm_sources := $(arm_sources:%.arm=%)
$(foreach src,$(filter %.c,$(arm_sources)), $(call compile-c-source,$(src)))
$(foreach src,$(filter %.S,$(arm_sources)), $(call compile-s-source,$(src)))
$(foreach src,$(filter %$(LOCAL_CPP_EXTENSION),$(arm_sources)),\
$(call compile-cpp-source,$(src)))
#
# The following will update LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS
# The compile-xxx-source calls updated LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS
#
$(foreach src,$(c_sources), $(call compile-c-source,$(src)))
$(foreach src,$(s_sources), $(call compile-s-source,$(src)))
$(foreach src,$(cpp_sources), $(call compile-cpp-source,$(src)))
ALL_DEPENDENCY_DIRS += $(sort $(LOCAL_DEPENDENCY_DIRS))
CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)

View File

@@ -30,6 +30,7 @@ NDK_LOCAL_VARS := \
LOCAL_SHARED_LIBRARIES \
LOCAL_MAKEFILE \
LOCAL_NO_UNDEFINED_SYMBOLS \
LOCAL_ARM_MODE \
$(call clear-vars, $(NDK_LOCAL_VARS))

View File

@@ -372,3 +372,24 @@ LOCAL_ALLOW_UNDEFINED_SYMBOLS
However, if for some reason you need to disable this check, set this
variable to 'true'. Note that the corresponding shared library may fail
to load at runtime.
LOCAL_ARM_MODE
By default, ARM target binaries will be generated in 'thumb' mode, where
each instruction are 16-bit wide. You can define this variable to 'arm'
if you want to force the generation of the module's object files in
'arm' (32-bit instructions) mode. E.g.:
LOCAL_ARM_MODE := arm
Note that you can also instruct the build system to only build specific
sources in arm mode by appending an '.arm' suffix to its source file
name. For example, with:
LOCAL_SRC_FILES := foo.c bar.c.arm
Tells the build system to always compile 'bar.c' in arm mode, and to
build foo.c according to the value of LOCAL_ARM_MODE.
NOTE: Setting APP_OPTIM to 'debug' in your Application.mk will also force
the generation of ARM binaries as well. This is due to bugs in the
toolchain debugger that don't deal too well with thumb code.

View File

@@ -21,6 +21,11 @@ current version
- Generate thumb binaries by default.
- Add support for LOCAL_ARM_MODE in Android.mk.
- Add support for the '.arm' suffix in source file names to force the
compilation of a single source in arm (32-bit) mode.
- Generate proper unoptimized versions of binaries when APP_OPTIM := debug

View File

@@ -12,7 +12,7 @@ I. Requirements:
The Android NDK currently requires a Linux, OS X or Windows host operating system.
Windows users will need to install Cygwin (http://www.cygwin.com) to use it. Note
that running the NDK under MSys has not been tested.
that running the NDK under MSys is not supported.
You will need to have the Android SDK and its dependencies installed. The NDK
cannot generate final application packages (.apk files), only the shared library
@@ -45,7 +45,7 @@ See http://www.cygwin.com for instructions.
II. Preparing your installation prebuilt cross-toolchain binaries:
-----------------------------------------------
------------------------------------------------------------------
After installing and unarchiving the NDK, you will need to run the following
command from the root folder: