Search code examples
candroid-ndkportinginclude-pathandroid.mk

How to include parent directory include path in Android.mk?


I'm building using the NDK and am having trouble getting the parent directory in the include path. I tried this:

LOCAL_C_INCLUDES += $(LOCAL_PATH)/..

But that does not work, apparently the .. is not processed as I would expect. I ran make -n to see the generated command which includes what I want:

-I/Users/me/android/workspace/jni/module/popt/..

But it fails, although if I manually edit it to instead be:

-I/Users/me/android/workspace/jni/module

It works fine. What should I put in the Android.mk file to include the parent directory in the search path without using ..?

The issue is that popt is a symbolic link, so parent directory .. is not module.


Solution

  • Nothing will be expanding the .. and actually modifying the earlier parts of the path - this is pretty much the same in any build system if you specify a relative path with ...

    Why doesn't -I/Users/me/android/workspace/jni/module/popt/.. give the same result as -I/Users/me/android/workspace/jni/module? Is popt a symlink to a different place? In that case, I think a solution would be to define a separate variable in jni/module/Android.mk like MODULE_PATH := $(LOCAL_PATH) and use $(MODULE_PATH) instead of $(LOCAL_PATH)/.. in the other Android.mk file.