aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/core/build-local.mk6
-rw-r--r--docs/CHANGES.html11
-rw-r--r--docs/OVERVIEW.html34
-rwxr-xr-xndk-gdb20
-rwxr-xr-xtests/build/ndk-out/build.sh15
-rw-r--r--tests/build/ndk-out/jni/Android.mk6
-rw-r--r--tests/build/ndk-out/jni/main.c5
7 files changed, 62 insertions, 35 deletions
diff --git a/build/core/build-local.mk b/build/core/build-local.mk
index d192e0396..af13592e9 100644
--- a/build/core/build-local.mk
+++ b/build/core/build-local.mk
@@ -145,7 +145,11 @@ endif
$(call ndk_log,Found project path: $(NDK_PROJECT_PATH))
# Place all generated files here
-NDK_APP_OUT := $(NDK_PROJECT_PATH)/obj
+NDK_APP_OUT := $(strip $(NDK_OUT))
+ifndef NDK_APP_OUT
+ NDK_APP_OUT := $(NDK_PROJECT_PATH)/obj
+endif
+$(call ndk_log,Ouput path: $(NDK_APP_OUT))
# Fake an application named 'local'
_app := local
diff --git a/docs/CHANGES.html b/docs/CHANGES.html
index 7ce0a9674..50d584cb7 100644
--- a/docs/CHANGES.html
+++ b/docs/CHANGES.html
@@ -1,6 +1,17 @@
<html><body><pre>Android NDK ChangeLog:
-------------------------------------------------------------------------------
+android-ndk-r??
+
+IMPORTANT CHANGES:
+
+- Added support for custom output directories through the NDK_OUT
+ environment variable. When defined, it will be used to store all
+ intermediate generated files, instead of $PROJECT_PATH/obj.
+
+ The variable is recognized by ndk-gdb as well.
+
+-------------------------------------------------------------------------------
android-ndk-r7b
IMPORTANT BUG FIXES:
diff --git a/docs/OVERVIEW.html b/docs/OVERVIEW.html
index e915227e2..797751a5f 100644
--- a/docs/OVERVIEW.html
+++ b/docs/OVERVIEW.html
@@ -296,34 +296,20 @@ purposes, there is no need to copy unstripped binaries to a device).
does and which options it can take.
- 2: Using the $NDK/apps/&lt;name&gt;/Application.mk:
- ---------------------------------------------
+III.6/ Specifying custom output directories:
+- - - - - - - - - - - - - - - - - - - - - - -
- This build method was the only one before Android NDK r4 and is only
- supported for compatibility reason. We strongly recommend you to migrate
- to using the 'ndk-build' command as soon as possible, since we may remove
- legacy support in a later NDK release.
+By default, ndk-build places all intermediate generated files under
+$PROJECT/obj. You can however select a different location by defining
+the NDK_OUT environment variable to point to a different directory.
- It requires the following:
+When defined, this variable has two effects:
- 1. Creating a sub-directory named $NDK/apps/&lt;name&gt;/ under
- your NDK installation directory (not your project path).
+ 1/ It ensures that all files that normally go under $PROJECT/obj are
+ stored in $NDK_OUT instead
- Where &lt;name&gt; is an arbitrary name to describe your application
- to the NDK build system (no spaces allowed).
-
- 2. Write $NDK/apps/&lt;name&gt;/Application.mk, which then requires
- a definition for APP_PROJECT_PATH that points to your
- application project directory.
-
- 3. Go to the NDK installation path on the command line then
- invoke the top-level GNUMakefile, as in:
-
- cd $NDK
- make APP=&lt;name&gt;
-
- The result will be equivalent to the first method, except for the fact
- that intermediate generated files will be placed under $NDK/out/apps/&lt;name&gt;/
+ 2/ It tells ndk-gdb to look into $NDK_OUT, instead of $PROJECT/obj for
+ any symbolized (i.e. unstripped) versions of the generated binaries.
IV. Rebuild your application package:
diff --git a/ndk-gdb b/ndk-gdb
index d812a9359..2322a592b 100755
--- a/ndk-gdb
+++ b/ndk-gdb
@@ -509,6 +509,16 @@ if [ "$COMPAT_ABI" = none ] ; then
fi
log "Compatible device ABI: $COMPAT_ABI"
+# Get information from the build system
+GDBSETUP_INIT=`get_build_var_for_abi NDK_APP_GDBSETUP $COMPAT_ABI`
+log "Using gdb setup init: $GDBSETUP_INIT"
+
+TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $COMPAT_ABI`
+log "Using toolchain prefix: $TOOLCHAIN_PREFIX"
+
+APP_OUT=`get_build_var_for_abi TARGET_OUT $COMPAT_ABI`
+log "Using app out directory: $APP_OUT"
+
# Check that the application is debuggable, or nothing will work
DEBUGGABLE=`run_awk_manifest_script extract-debuggable.awk`
log "Found debuggable flag: $DEBUGGABLE"
@@ -553,16 +563,6 @@ if [ $? != 0 ]; then
fi
log "Found device gdbserver: $DEVICE_GDBSERVER"
-# Get information from the build system
-GDBSETUP_INIT=`get_build_var_for_abi NDK_APP_GDBSETUP $COMPAT_ABI`
-log "Using gdb setup init: $GDBSETUP_INIT"
-
-TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $COMPAT_ABI`
-log "Using toolchain prefix: $TOOLCHAIN_PREFIX"
-
-APP_OUT=`get_build_var_for_abi TARGET_OUT $COMPAT_ABI`
-log "Using app out directory: $APP_OUT"
-
# Find the <dataDir> of the package on the device
adb_var_shell2 DATA_DIR run-as $PACKAGE_NAME /system/bin/sh -c pwd
if [ $? != 0 -o -z "$DATA_DIR" ] ; then
diff --git a/tests/build/ndk-out/build.sh b/tests/build/ndk-out/build.sh
new file mode 100755
index 000000000..3bf7169be
--- /dev/null
+++ b/tests/build/ndk-out/build.sh
@@ -0,0 +1,15 @@
+cd $(dirname "$0")
+rm -rf obj output-dir
+export NDK_OUT=output-dir
+$NDK/ndk-build
+if [ -d obj ] ; then
+ echo "FAILURE: 'obj' directory should not be created by ndk-build!"
+ exit 1
+fi
+if [ ! -d output-dir ]; then
+ echo "FAILURE: 'output-dir' should have been created by ndk-build!"
+ exit 1
+fi
+rm -rf output-dir
+
+
diff --git a/tests/build/ndk-out/jni/Android.mk b/tests/build/ndk-out/jni/Android.mk
new file mode 100644
index 000000000..0b9473f4a
--- /dev/null
+++ b/tests/build/ndk-out/jni/Android.mk
@@ -0,0 +1,6 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ndk_out_hello
+LOCAL_SRC_FILES := main.c
+include $(BUILD_EXECUTABLE)
diff --git a/tests/build/ndk-out/jni/main.c b/tests/build/ndk-out/jni/main.c
new file mode 100644
index 000000000..f0ad5f04e
--- /dev/null
+++ b/tests/build/ndk-out/jni/main.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+int main(void) {
+ printf("Hello NDK_OUT!\n");
+ return 0;
+} \ No newline at end of file