OSDN Git Service

Fix LOCAL_CFLAGS/CPPFLAGS handling to match full Android build system.
authorDavid 'Digit' Turner <digit@google.com>
Mon, 27 Jul 2009 10:24:58 +0000 (12:24 +0200)
committerDavid 'Digit' Turner <digit@google.com>
Mon, 27 Jul 2009 10:24:58 +0000 (12:24 +0200)
Also improve BUILD_SYSTEM directory detection logic in build/core/main.mk

ndk/build/core/definitions.mk
ndk/build/core/main.mk
ndk/docs/ANDROID-MK.TXT
ndk/docs/APPLICATION-MK.TXT
ndk/docs/CHANGES.TXT

index 2272542..fa223b0 100644 (file)
@@ -371,9 +371,7 @@ $$(_OBJ): PRIVATE_CFLAGS   := $$($$(my)CFLAGS) \
                               $$($$(my)$(LOCAL_ARM_MODE)_$(LOCAL_BUILD_MODE)_CFLAGS) \
                               $$(LOCAL_C_INCLUDES:%=-I%) \
                               -I$$(LOCAL_PATH) \
-                              $$(LOCAL_CPPFLAGS) \
                               $$(LOCAL_CFLAGS) \
-                              $$(NDK_APP_CPPFLAGS) \
                               $$(NDK_APP_CFLAGS)
 
 $$(_OBJ): $$(_SRC) $$(LOCAL_MAKEFILE) $$(NDK_APP_APPLICATION_MK)
@@ -431,8 +429,10 @@ $$(_OBJ): PRIVATE_CXXFLAGS := $$($$(my)CXXFLAGS) \
                               $$($$(my)$(LOCAL_ARM_MODE)_$(LOCAL_BUILD_MODE)_CFLAGS) \
                               $$(LOCAL_C_INCLUDES:%=-I%) \
                               -I$$(LOCAL_PATH) \
+                              $$(LOCAL_CFLAGS) \
                               $$(LOCAL_CPPFLAGS) \
                               $$(LOCAL_CXXFLAGS) \
+                              $$(NDK_APP_CFLAGS) \
                               $$(NDK_APP_CPPFLAGS) \
                               $$(NDK_APP_CXXFLAGS) \
 
index c4ac8fe..5edd217 100644 (file)
 #
 # ====================================================================
 
+# The location of the build system files
+BUILD_SYSTEM := $(strip $(dir $(lastword $(MAKEFILE_LIST))))
+BUILD_SYSTEM := $(BUILD_SYSTEM:%/=%)
+
 # Include common definitions
 include build/core/definitions.mk
 
-# The location of the build system files
-BUILD_SYSTEM := build/core
-
 # Where all generated files will be stored during a build
 NDK_OUT := out
 
index 9a77ab1..6dd5e80 100644 (file)
@@ -337,11 +337,10 @@ LOCAL_C_INCLUDES
 
 LOCAL_CFLAGS
     An optional set of compiler flags that will be passed when building
-    C source files (*not* C++ sources).
+    C *and* C++ source files.
 
-    This can be useful to specify an additionnal include path
-    (relative to the top of the NDK directory), macro definitions
-    or compile options.
+    This can be useful to specify additionnal macro definitions or
+    compile options.
 
     IMPORTANT: Try not to change the optimization/debugging level in
                your Android.mk, this can be handled automatically for
@@ -349,11 +348,24 @@ LOCAL_CFLAGS
                your Application.mk, and will let the NDK generate
                useful data files used during debugging.
 
+    NOTE: In android-ndk-1.5_r1, the corresponding flags only applied
+          to C source files, not C++ ones. This has been corrected to
+          match the full Android build system behaviour. (You can use
+          LOCAL_CPPFLAGS to specify flags for C++ sources only now).
+
 LOCAL_CXXFLAGS
-    Same as LOCAL_CFLAGS for C++ source files
+    An alias for LOCAL_CPPFLAGS. Note that use of this flag is obsolete
+    as it may disappear in future releases of the NDK.
 
 LOCAL_CPPFLAGS
-    Same as LOCAL_CFLAGS but used for both C and C++ source files
+    An optional set of compiler flags that will be passed when building
+    C++ source files *only*. They will appear after the LOCAL_CFLAGS
+    on the compiler's command-line.
+
+    NOTE: In android-ndk-1.5_r1, the corresponding flags applied to
+          both C and C++ sources. This has been corrected to match the
+          full Android build system. (You can use LOCAL_CFLAGS to specify
+          flags for both C and C++ sources now).
 
 LOCAL_STATIC_LIBRARIES
     The list of static libraries modules (built with BUILD_STATIC_LIBRARY)
index 6f84da9..7016c4d 100644 (file)
@@ -62,7 +62,7 @@ APP_OPTIM
     the code difficult, stack traces may not be reliable, etc...
 
 APP_CFLAGS
-    A set of C compiler flags passed when compiling any C source code
+    A set of C compiler flags passed when compiling any C or C++ source code
     of any of the modules. This can be used to change the build of a given
     module depending on the application that needs it, instead of modifying
     the Android.mk file itself.
@@ -89,11 +89,20 @@ APP_CFLAGS
     +
     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
+    NOTE: In android-ndk-1.5_r1, this only applied to C sources, not C++ ones.
+          This has been corrected to match the full Android build system.
+
 APP_CXXFLAGS
-    Same as APP_CFLAGS for C++ sources.
+    An alias for APP_CPPFLAGS, to be considered obsolete as it may disappear
+    in a future release of the NDK.
 
 APP_CPPFLAGS
-    Same as APP_CFLAGS but will be passed to both C and C++ sources
+    A set of C++ compiler flags passed when building C++ sources *only*.
+
+    NOTE: In android-ndk-1.5_r1, this applied to both C and C++ sources.
+          This has been corrected to match the full Android build system.
+          You can now use APP_CFLAGS for flags that shall apply to C and
+          C++ souces.
 
 A trivial Application.mk file would be:
 
index 411fe56..2cccadc 100644 (file)
@@ -33,11 +33,14 @@ current version
 
 - Fix compilation of assembler files (e.g. foo.S)
 
-- Make LOCAL_CFLAGS / LOCAL_CXXFLAGS / LOCAL_CPPFLAGS work as advertized
-  by the documentation (previously, only LOCAL_CFLAGS did work for both C
-  *and* C++ sources, contrary to what the doc claimed).
+- Fix LOCAL_CFLAGS / LOCAL_CPPFLAGS to work as in the full Android build
+  system. This means that:
 
-  Note that APP_CPPFLAGS / APP_CFLAGS / APP_CXXFLAGS continue to work.
+    - LOCAL_CFLAGS   is used for both C and C++ sources
+    - LOCAL_CPPFLAGS is used for C++ sources only
+    - LOCAL_CXXFLAGS is used like LOCAL_CPPFLAGS but is considered obsolete.
+
+  Also fixed APP_CPPFLAGS / APP_CFLAGS / APP_CXXFLAGS.
 
 -------------------------------------------------------------------------------
 android-ndk-1.5_r1 released.