Merge change 5637 into donut
* changes: Add support for LOCAL_C_INCLUDES in Android.mk, to better match the Android build system.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
NDK_LOCAL_VARS := \
|
||||
LOCAL_MODULE \
|
||||
LOCAL_SRC_FILES \
|
||||
LOCAL_C_INCLUDES \
|
||||
LOCAL_CFLAGS \
|
||||
LOCAL_CXXFLAGS \
|
||||
LOCAL_CPPFLAGS \
|
||||
|
||||
@@ -369,6 +369,7 @@ $$(_OBJ): PRIVATE_ARM_TEXT := $$(LOCAL_ARM_TEXT)
|
||||
$$(_OBJ): PRIVATE_CC := $$($$(my)CC)
|
||||
$$(_OBJ): PRIVATE_CFLAGS := $$($$(my)CFLAGS) \
|
||||
$$($$(my)$(LOCAL_ARM_MODE)_$(LOCAL_BUILD_MODE)_CFLAGS) \
|
||||
$$(LOCAL_C_INCLUDES:%=-I%) \
|
||||
-I$$(LOCAL_PATH) \
|
||||
$$(LOCAL_CFLAGS) \
|
||||
$$(NDK_APP_CPPFLAGS) \
|
||||
@@ -427,6 +428,7 @@ $$(_OBJ): PRIVATE_ARM_TEXT := $$(LOCAL_ARM_TEXT)
|
||||
$$(_OBJ): PRIVATE_CXX := $$($$(my)CXX)
|
||||
$$(_OBJ): PRIVATE_CXXFLAGS := $$($$(my)CXXFLAGS) \
|
||||
$$($$(my)$(LOCAL_ARM_MODE)_$(LOCAL_BUILD_MODE)_CFLAGS) \
|
||||
$$(LOCAL_C_INCLUDES:%=-I%) \
|
||||
-I$$(LOCAL_PATH) \
|
||||
$$(LOCAL_CFLAGS) \
|
||||
$$(NDK_APP_CPPFLAGS) \
|
||||
|
||||
@@ -319,6 +319,21 @@ LOCAL_CPP_EXTENSION
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cxx
|
||||
|
||||
LOCAL_C_INCLUDES
|
||||
An optional list of paths, relative to the NDK *root* directory,
|
||||
which will be appended to the include search path when compiling
|
||||
all sources (C, C++ and Assembly). For example:
|
||||
|
||||
LOCAL_C_INCLUDES := sources/foo
|
||||
|
||||
Or even:
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../foo
|
||||
|
||||
These are placed before any corresponding inclusion flag in
|
||||
LOCAL_CFLAGS / LOCAL_CXXFLAGS / LOCAL_CPPFLAGS
|
||||
|
||||
|
||||
LOCAL_CFLAGS
|
||||
An optional set of compiler flags that will be passed when building
|
||||
C source files (*not* C++ sources).
|
||||
|
||||
@@ -28,6 +28,7 @@ current version
|
||||
|
||||
- Generate proper unoptimized versions of binaries when APP_OPTIM := debug
|
||||
|
||||
- Add support for LOCAL_C_INCLUDES in Android.mk
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
android-1.5_r1 released.
|
||||
|
||||
@@ -73,22 +73,22 @@ path to the 'foo' module in bar/Android.mk to build it properly.
|
||||
|
||||
One is tempted to use the following:
|
||||
|
||||
LOCAL_CPPFLAGS := -I../foo
|
||||
LOCAL_C_INCLUDES := ../foo
|
||||
|
||||
However this will not work because all compilation happens from the
|
||||
root NDK directory (i.e. $NDK_ROOT), and include files must be relative
|
||||
to it. The above line really translates to:
|
||||
|
||||
LOCAL_CPPFLAGS := -I$(NDK_ROOT)/../foo
|
||||
LOCAL_C_INCLUDES := $(NDK_ROOT)/../foo
|
||||
|
||||
Which adds a non-existing directory to the C include path. The correct
|
||||
line is instead:
|
||||
|
||||
LOCAL_CPPFLAGS := -Isources/foo
|
||||
LOCAL_C_INCLUDES := sources/foo
|
||||
|
||||
Or even better:
|
||||
|
||||
LOCAL_CPPFLAGS := $(LOCAL_PATH)/../foo
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../foo
|
||||
|
||||
Which uses a path relative to $(LOCAL_PATH), in the case where you would
|
||||
need to move 'foo' and 'bar' to a deeper level in the 'sources' hierarchy.
|
||||
|
||||
Reference in New Issue
Block a user