From: David 'Digit' Turner Date: Mon, 27 Jul 2009 10:24:58 +0000 (+0200) Subject: Fix LOCAL_CFLAGS/CPPFLAGS handling to match full Android build system. X-Git-Tag: android-x86-1.6~7^2~17^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=747294cc4a69574c6e208aed64216aa4d40243c6;p=android-x86%2Fdevelopment.git Fix LOCAL_CFLAGS/CPPFLAGS handling to match full Android build system. Also improve BUILD_SYSTEM directory detection logic in build/core/main.mk --- diff --git a/ndk/build/core/definitions.mk b/ndk/build/core/definitions.mk index 22725427..fa223b0e 100644 --- a/ndk/build/core/definitions.mk +++ b/ndk/build/core/definitions.mk @@ -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) \ diff --git a/ndk/build/core/main.mk b/ndk/build/core/main.mk index c4ac8fe1..5edd217c 100644 --- a/ndk/build/core/main.mk +++ b/ndk/build/core/main.mk @@ -20,12 +20,13 @@ # # ==================================================================== +# 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 diff --git a/ndk/docs/ANDROID-MK.TXT b/ndk/docs/ANDROID-MK.TXT index 9a77ab19..6dd5e80a 100644 --- a/ndk/docs/ANDROID-MK.TXT +++ b/ndk/docs/ANDROID-MK.TXT @@ -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) diff --git a/ndk/docs/APPLICATION-MK.TXT b/ndk/docs/APPLICATION-MK.TXT index 6f84da9c..7016c4db 100644 --- a/ndk/docs/APPLICATION-MK.TXT +++ b/ndk/docs/APPLICATION-MK.TXT @@ -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: diff --git a/ndk/docs/CHANGES.TXT b/ndk/docs/CHANGES.TXT index 411fe567..2cccadc4 100644 --- a/ndk/docs/CHANGES.TXT +++ b/ndk/docs/CHANGES.TXT @@ -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.