OSDN Git Service

Add support for LOCAL_ARM_MODE and .arm source file name suffix.
authorDavid 'Digit' Turner <digit@google.com>
Mon, 29 Jun 2009 14:44:31 +0000 (16:44 +0200)
committerDavid 'Digit' Turner <digit@google.com>
Mon, 29 Jun 2009 14:44:31 +0000 (16:44 +0200)
Also update docs/INSTALL.TXT to explain that MSys is not supported under Windows.

ndk/build/core/build-binary.mk
ndk/build/core/clear-vars.mk
ndk/docs/ANDROID-MK.TXT
ndk/docs/CHANGES.TXT
ndk/docs/INSTALL.TXT

index f7e6982..d4425ec 100644 (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)
 
index 30e19c3..05566a6 100644 (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))
 
index 9ba5388..ccdf96e 100644 (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.
index adea2f5..510a167 100644 (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
 
 
index f7f474e..7d80cd5 100644 (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: