OSDN Git Service

Move samples from apps/<name>/project to samples/<name>
authorDavid 'Digit' Turner <digit@google.com>
Mon, 10 May 2010 22:23:34 +0000 (15:23 -0700)
committerDavid 'Digit' Turner <digit@google.com>
Mon, 10 May 2010 22:23:34 +0000 (15:23 -0700)
Update documentation accordingly

Note: removes obsolete unit tests under apps/unit-tests/
+ fix --verbose option in build/tools/rebuild-all-prebuilt.sh
+ add NX support to x86-4.2.1 toolchain config file
+ update .gitignore

Change-Id: I3c8e6185ad41f103a425387d7618ab3e73182fdc

79 files changed:
.gitignore
apps/hello-gl2/Application.mk [deleted file]
apps/hello-jni/Application.mk [deleted file]
apps/hello-neon/Application.mk [deleted file]
apps/san-angeles/Application.mk [deleted file]
apps/two-libs/Application.mk [deleted file]
apps/unit-tests/Android.mk [deleted file]
apps/unit-tests/Application.mk [deleted file]
apps/unit-tests/test-CLEAR_VARS/Android.mk [deleted file]
apps/unit-tests/test-LOCAL_CFLAGS/Android.mk [deleted file]
apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-1.c [deleted file]
apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-2.cpp [deleted file]
apps/unit-tests/test-LOCAL_CPPFLAGS/Android.mk [deleted file]
apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-1.c [deleted file]
apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-2.cpp [deleted file]
build/toolchains/x86-4.2.1/setup.mk
build/tools/rebuild-all-prebuilt.sh
docs/CHANGES.TXT
docs/HOWTO.TXT
docs/NDK-BUILD.TXT
docs/OVERVIEW.TXT
samples/hello-gl2/Android.mk [moved from apps/hello-gl2/project/Android.mk with 100% similarity]
samples/hello-gl2/AndroidManifest.xml [moved from apps/hello-gl2/project/AndroidManifest.xml with 100% similarity]
samples/hello-gl2/default.properties [moved from apps/hello-gl2/project/default.properties with 100% similarity]
samples/hello-gl2/jni/Android.mk [moved from apps/hello-gl2/project/jni/Android.mk with 100% similarity]
samples/hello-gl2/jni/gl_code.cpp [moved from apps/hello-gl2/project/jni/gl_code.cpp with 100% similarity]
samples/hello-gl2/res/values/strings.xml [moved from apps/hello-gl2/project/res/values/strings.xml with 100% similarity]
samples/hello-gl2/src/com/android/gl2jni/GL2JNIActivity.java [moved from apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIActivity.java with 100% similarity]
samples/hello-gl2/src/com/android/gl2jni/GL2JNILib.java [moved from apps/hello-gl2/project/src/com/android/gl2jni/GL2JNILib.java with 100% similarity]
samples/hello-gl2/src/com/android/gl2jni/GL2JNIView.java [moved from apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIView.java with 100% similarity]
samples/hello-jni/AndroidManifest.xml [moved from apps/hello-jni/project/AndroidManifest.xml with 100% similarity]
samples/hello-jni/default.properties [moved from apps/hello-jni/project/default.properties with 100% similarity]
samples/hello-jni/jni/Android.mk [moved from apps/hello-jni/project/jni/Android.mk with 100% similarity]
samples/hello-jni/jni/hello-jni.c [moved from apps/hello-jni/project/jni/hello-jni.c with 100% similarity]
samples/hello-jni/res/values/strings.xml [moved from apps/hello-jni/project/res/values/strings.xml with 100% similarity]
samples/hello-jni/src/com/example/hellojni/HelloJni.java [moved from apps/hello-jni/project/src/com/example/hellojni/HelloJni.java with 100% similarity]
samples/hello-jni/tests/AndroidManifest.xml [moved from apps/hello-jni/project/tests/AndroidManifest.xml with 100% similarity]
samples/hello-jni/tests/default.properties [moved from apps/hello-jni/project/tests/default.properties with 100% similarity]
samples/hello-jni/tests/src/com/example/HelloJni/HelloJniTest.java [moved from apps/hello-jni/project/tests/src/com/example/HelloJni/HelloJniTest.java with 100% similarity]
samples/hello-neon/AndroidManifest.xml [moved from apps/hello-neon/project/AndroidManifest.xml with 100% similarity]
samples/hello-neon/build.properties [moved from apps/hello-neon/project/build.properties with 100% similarity]
samples/hello-neon/default.properties [moved from apps/hello-neon/project/default.properties with 100% similarity]
samples/hello-neon/jni/Android.mk [moved from apps/hello-neon/project/jni/Android.mk with 100% similarity]
samples/hello-neon/jni/Application.mk [new file with mode: 0644]
samples/hello-neon/jni/helloneon-intrinsics.c [moved from apps/hello-neon/project/jni/helloneon-intrinsics.c with 100% similarity]
samples/hello-neon/jni/helloneon-intrinsics.h [moved from apps/hello-neon/project/jni/helloneon-intrinsics.h with 100% similarity]
samples/hello-neon/jni/helloneon.c [moved from apps/hello-neon/project/jni/helloneon.c with 100% similarity]
samples/hello-neon/res/values/strings.xml [moved from apps/hello-neon/project/res/values/strings.xml with 100% similarity]
samples/hello-neon/src/com/example/neon/HelloNeon.java [moved from apps/hello-neon/project/src/com/example/neon/HelloNeon.java with 100% similarity]
samples/san-angeles/AndroidManifest.xml [moved from apps/san-angeles/project/AndroidManifest.xml with 100% similarity]
samples/san-angeles/default.properties [moved from apps/san-angeles/project/default.properties with 100% similarity]
samples/san-angeles/jni/Android.mk [moved from apps/san-angeles/project/jni/Android.mk with 100% similarity]
samples/san-angeles/jni/README.txt [moved from apps/san-angeles/project/jni/README.txt with 100% similarity]
samples/san-angeles/jni/app-android.c [moved from apps/san-angeles/project/jni/app-android.c with 100% similarity]
samples/san-angeles/jni/app-linux.c [moved from apps/san-angeles/project/jni/app-linux.c with 100% similarity]
samples/san-angeles/jni/app-win32.c [moved from apps/san-angeles/project/jni/app-win32.c with 100% similarity]
samples/san-angeles/jni/app.h [moved from apps/san-angeles/project/jni/app.h with 100% similarity]
samples/san-angeles/jni/cams.h [moved from apps/san-angeles/project/jni/cams.h with 100% similarity]
samples/san-angeles/jni/demo.c [moved from apps/san-angeles/project/jni/demo.c with 100% similarity]
samples/san-angeles/jni/importgl.c [moved from apps/san-angeles/project/jni/importgl.c with 100% similarity]
samples/san-angeles/jni/importgl.h [moved from apps/san-angeles/project/jni/importgl.h with 100% similarity]
samples/san-angeles/jni/license-BSD.txt [moved from apps/san-angeles/project/jni/license-BSD.txt with 100% similarity]
samples/san-angeles/jni/license-LGPL.txt [moved from apps/san-angeles/project/jni/license-LGPL.txt with 100% similarity]
samples/san-angeles/jni/license.txt [moved from apps/san-angeles/project/jni/license.txt with 100% similarity]
samples/san-angeles/jni/shapes.h [moved from apps/san-angeles/project/jni/shapes.h with 100% similarity]
samples/san-angeles/res/layout/main.xml [moved from apps/san-angeles/project/res/layout/main.xml with 100% similarity]
samples/san-angeles/res/values/strings.xml [moved from apps/san-angeles/project/res/values/strings.xml with 100% similarity]
samples/san-angeles/src/com/example/SanAngeles/DemoActivity.java [moved from apps/san-angeles/project/src/com/example/SanAngeles/DemoActivity.java with 100% similarity]
samples/two-libs/AndroidManifest.xml [moved from apps/two-libs/project/AndroidManifest.xml with 100% similarity]
samples/two-libs/default.properties [moved from apps/two-libs/project/default.properties with 100% similarity]
samples/two-libs/jni/Android.mk [moved from apps/two-libs/project/jni/Android.mk with 100% similarity]
samples/two-libs/jni/first.c [moved from apps/two-libs/project/jni/first.c with 100% similarity]
samples/two-libs/jni/first.h [moved from apps/two-libs/project/jni/first.h with 100% similarity]
samples/two-libs/jni/second.c [moved from apps/two-libs/project/jni/second.c with 100% similarity]
samples/two-libs/res/values/strings.xml [moved from apps/two-libs/project/res/values/strings.xml with 100% similarity]
samples/two-libs/src/com/example/twolibs/TwoLibs.java [moved from apps/two-libs/project/src/com/example/twolibs/TwoLibs.java with 100% similarity]
samples/two-libs/tests/AndroidManifest.xml [moved from apps/two-libs/project/tests/AndroidManifest.xml with 100% similarity]
samples/two-libs/tests/default.properties [moved from apps/two-libs/project/tests/default.properties with 100% similarity]
samples/two-libs/tests/src/com/example/TwoLib/TwoLibTest.java [moved from apps/two-libs/project/tests/src/com/example/TwoLib/TwoLibTest.java with 100% similarity]

index 81a46e5..1fde19d 100644 (file)
@@ -4,3 +4,7 @@
 Thumbs.db
 local.properties
 build.xml
+samples/*/libs/
+samples/*/bin/
+samples/*/gen/
+build/prebuilt/
diff --git a/apps/hello-gl2/Application.mk b/apps/hello-gl2/Application.mk
deleted file mode 100644 (file)
index 6f884bf..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_PROJECT_PATH := $(call my-dir)/project
-APP_MODULES      := libgl2jni
-
diff --git a/apps/hello-jni/Application.mk b/apps/hello-jni/Application.mk
deleted file mode 100644 (file)
index f5ac839..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-APP_PROJECT_PATH := $(call my-dir)/project
-APP_MODULES      := hello-jni
diff --git a/apps/hello-neon/Application.mk b/apps/hello-neon/Application.mk
deleted file mode 100644 (file)
index 7325bb9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_PROJECT_PATH := $(call my-dir)/project
-APP_MODULES      := helloneon cpufeatures
-APP_ABI          := armeabi armeabi-v7a
diff --git a/apps/san-angeles/Application.mk b/apps/san-angeles/Application.mk
deleted file mode 100644 (file)
index 3ba4361..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-APP_MODULES      := sanangeles
-APP_PROJECT_PATH := $(call my-dir)/project
diff --git a/apps/two-libs/Application.mk b/apps/two-libs/Application.mk
deleted file mode 100644 (file)
index a2fd402..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-APP_PROJECT_PATH := $(call my-dir)/project
-APP_MODULES      := twolib-first twolib-second
diff --git a/apps/unit-tests/Android.mk b/apps/unit-tests/Android.mk
deleted file mode 100644 (file)
index 5053e7d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/apps/unit-tests/Application.mk b/apps/unit-tests/Application.mk
deleted file mode 100644 (file)
index 8699134..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-APP_MODULES := \
-    test-LOCAL_CFLAGS \
-    test-LOCAL_CPPFLAGS
-
-APP_PROJECT_PATH := /tmp/ndk-unit-tests
-APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
diff --git a/apps/unit-tests/test-CLEAR_VARS/Android.mk b/apps/unit-tests/test-CLEAR_VARS/Android.mk
deleted file mode 100644 (file)
index fde4e7b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# This test is used to check that include $(CLEAR_VARS) does
-# indeed clear all variables we care for.
-
-LOCAL_PATH := $(call my-dir)
-
-# The list of LOCAL_XXX variables documented by docs/ANDROID-MK.TXT
-# Note that LOCAL_PATH is not cleared
-VARS_LOCAL := \
-    MODULE \
-    SRC_FILES \
-    CPP_EXTENSION \
-    C_INCLUDES \
-    CFLAGS \
-    CPPFLAGS \
-    CXXFLAGS \
-    STATIC_LIBRARIES \
-    SHARED_LIBRARIES \
-    LDLIBS \
-    ALLOW_UNDEFINED_SYMBOLS \
-    ARM_MODE \
-
-include $(CLEAR_VARS)
-
-$(for _var,$(VARS_LOCAL),\
-  $(eval LOCAL_$(_var) := 1)\
-)
-
-include $(CLEAR_VARS)
-
-STATUS := ok
-$(foreach _var,$(VARS_LOCAL),\
-    $(if $(LOCAL_$(_var)),\
-      $(info variable LOCAL_$(_var) is not cleared by CLEAR_VARS)\
-      $(eval STATUS := ko)\
-    ,)\
-)
-
-ifeq ($(STATUS),ko)
-  $(error Aborting: CLEAR_VARS does not work !)
-endif
-
-VARS_LOCAL := $(empty)
-STATUS     := $(empty)
diff --git a/apps/unit-tests/test-LOCAL_CFLAGS/Android.mk b/apps/unit-tests/test-LOCAL_CFLAGS/Android.mk
deleted file mode 100644 (file)
index 25348d1..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Test that LOCAL_CFLAGS works for both C and C++ sources
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE    := test-LOCAL_CFLAGS
-LOCAL_SRC_FILES := test-LOCAL_CFLAGS-1.c \
-                   test-LOCAL_CFLAGS-2.cpp \
-
-LOCAL_CFLAGS    := -DBANANA=100
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-1.c b/apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-1.c
deleted file mode 100644 (file)
index c14a62c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#if !defined(BANANA)
-#  error LOCAL_CFLAGS does not work for C source file
-#endif
-#if BANANA != 100
-#  error LOCAL_CFLAGS does not work correctly for C source file
-#endif
-
-void  __banana_foo1(void)
-{
-}
diff --git a/apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-2.cpp b/apps/unit-tests/test-LOCAL_CFLAGS/test-LOCAL_CFLAGS-2.cpp
deleted file mode 100644 (file)
index 4b769c0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#if !defined(BANANA)
-#  error LOCAL_CFLAGS does not work for C++ source file
-#endif
-#if BANANA != 100
-#  error LOCAL_CFLAGS does not work correctly for C++ source file
-#endif
-
-void  __banana_foo2(void)
-{
-}
diff --git a/apps/unit-tests/test-LOCAL_CPPFLAGS/Android.mk b/apps/unit-tests/test-LOCAL_CPPFLAGS/Android.mk
deleted file mode 100644 (file)
index 45c9b6d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Test that LOCAL_CPPFLAGS only works for C++ sources
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE    := test-LOCAL_CPPFLAGS
-LOCAL_SRC_FILES := test-LOCAL_CPPFLAGS-1.c \
-                   test-LOCAL_CPPFLAGS-2.cpp \
-
-LOCAL_CFLAGS   := -DBANANA=200
-
-# Note, the -UBANANA is only there to prevent a warning
-# the test works well without it.
-LOCAL_CPPFLAGS := -UBANANA -DBANANA=300
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-1.c b/apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-1.c
deleted file mode 100644 (file)
index c5f2a6e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#if !defined(BANANA)
-#  error LOCAL_CPPFLAGS does not work for C source file
-#endif
-#if BANANA != 200
-#  error LOCAL_CPPFLAGS does not work correctly for C source file
-#endif
-
-void  __banana_foo1(void)
-{
-}
diff --git a/apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-2.cpp b/apps/unit-tests/test-LOCAL_CPPFLAGS/test-LOCAL_CPPFLAGS-2.cpp
deleted file mode 100644 (file)
index e8853e8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#if !defined(BANANA)
-#  error LOCAL_CPPFLAGS does not work for C++ source file
-#endif
-#if BANANA != 300
-#  error LOCAL_CPPFLAGS does not work correctly for C++ source file
-#endif
-
-void  __banana_foo2(void)
-{
-}
index 2579148..a7e7d1d 100644 (file)
@@ -75,6 +75,13 @@ TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib
 # flags.
 TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
+# These flags are used to enfore the NX (no execute) security feature in the
+# generated machine code. This adds a special section to the generated shared
+# libraries that instruct the Linux kernel to disable code execution from
+# the stack and the heap.
+TARGET_NO_EXECUTE_CFLAGS  := -Wa,--noexecstack
+TARGET_NO_EXECUTE_LDFLAGS := -Wl,-z,noexecstack
+
 # The ABI-specific sub-directory that the SDK tools recognize for
 # this toolchain's generated binaries
 TARGET_ABI_SUBDIR := x86
index e081f9f..22a1334 100755 (executable)
@@ -98,7 +98,7 @@ else
 fi
 
 FLAGS=""
-if [ $VERBOSE2 = yes ] ; then
+if [ $VERBOSE = yes ] ; then
     FLAGS="--verbose"
 fi
 
index d8b8e32..84e1d34 100644 (file)
@@ -24,6 +24,11 @@ IMPORTANT CHANGES:
   NOTE: For compatibility purpose, you can still define projects
         through $NDK_ROOT/apps/<name> though.
 
+        However, not that sample applications have moved from
+        'apps/<name>/project' to 'samples/<name>' and now must
+        be built with 'ndk-build'. The source code of pre-existing
+        samples didn't change though.
+
 - Easy native debugging support when running debuggable applications
   on Android 2.2 or higher, through the new 'ndk-gdb' helper script.
   See docs/NDK-GDB.TXT for details.
index feb8b0b..652daaa 100644 (file)
@@ -14,7 +14,6 @@ as you expect them to, and check for bugs in the NDK build system.
 (The V=1 trick comes from the Linux kernel build system)
 
 
-
 How to force a rebuild of all your sources:
 -------------------------------------------
 
@@ -33,8 +32,18 @@ Alternatively, you can define APP_BUILD_SCRIPT in your Application.mk
 to point to an alternative Android.mk file.
 
 
-How to store your Application.mk in a location other than $NDK/app/<name>:
---------------------------------------------------------------------------
+How to build a project's native files without cd-ing to it:
+-----------------------------------------------------------
+
+Sometimes, you may need to rebuild a project's native file without
+being able to cd to its top-level path from the command-line. This
+is do-able by using the GNU-Make '-C <path>' option, as in:
+
+    ndk-build -C <project-path>
+
+
+How to store your Application.mk in a location other than $PROJECT/jni:
+-----------------------------------------------------------------------
 
 Starting with NDK r4, you can simply place the file under $PROJECT/jni/
 and launch the 'ndk-build' script from your project tree.
index 7d40d91..445d1e6 100644 (file)
@@ -40,6 +40,10 @@ command that runs the NDK build scripts. Notable uses include:
     --> rebuild, using a specific Application.mk pointed to by
         the NDK_APP_APPLICATION_MK command-line variable.
 
+  ndk-build -C <project>     --> build the native code for the project
+                                 path located at <project>. Useful if you
+                                 don't want to 'cd' to it in your terminal.
+
 
 III. Requirements:
 ------------------
index 3f700ec..8ed79b3 100644 (file)
@@ -242,7 +242,7 @@ There are two ways to use an Application.mk:
     "make APP=<name>" from the NDK directory.
 
     This was the way this file was used before Android NDK r4.
-    It is still supported for compatbility reasons, but we strongly
+    It is still supported for compatibility reasons, but we strongly
     encourage you to use the first method instead, since it is much
     simpler and doesn't need modifying / changing directories of the
     NDK installation tree.
@@ -345,9 +345,9 @@ V. Debugging support:
 The NDK provides a helper script, named 'ndk-gdb' to very easily launch
 a native debugging session of your applications.
 
-Native debugging can be performed on production devices running Android 2.2
-or higher, and does not require root or privileged access, as long as your
-application is debuggable.
+Native debugging can *ONLY* be performed on production devices running
+Android 2.2 or higher, and does not require root or privileged access, as
+long as your application is debuggable.
 
 For more information, read docs/NDK-GDB.TXT. In a nutshell, native debugging
 follows this simple scheme:
diff --git a/samples/hello-neon/jni/Application.mk b/samples/hello-neon/jni/Application.mk
new file mode 100644 (file)
index 0000000..db8f866
--- /dev/null
@@ -0,0 +1,2 @@
+# Build both ARMv5TE and ARMv7-A machine code.
+APP_ABI := armeabi armeabi-v7a