2

In an android makefile I have a following line

$(call import-add-path,/Users/bruno/Dev/cocos2d-x-2.1.5)

Now, I am working with several people and having that line is not very people-friendly. I have tried defining that path in an environment variable but it gets ignored when I add it to the call import-add-path line. I output the variable as a warning and the makefile obviously has the vatiable present:

$(warning $(NMP))    # outputs: jni/Android.mk:29: /Users/bruno/Dev/cocos2d-x-2.1.5
$(call import-add-path,$(NMP))

How can I make this work so that is multiple developers friendly?

Edit: Eclipse on OSX, building a cocos2d-x 2.1.5 TestCpp project, android NDK r10c. The error message I get is actually about the missing ABI and asking me if I have set the NDK_MODULE_PATH variable properly and it happens only on a debug build (perhaps GDB makes a difference?).

Bikush
  • 654
  • 8
  • 22
  • 1
    That should work just fine from a makefile perspective (I don't know anything about the android side of things specifically though). Does it work with a variable defined in the makefile itself? – Etan Reisner Dec 22 '14 at 12:35
  • @EtanReisner No. I did find some comments about Eclipse messing up the environment on debug builds, but since it does not work when variables are defined in the makefile I assumed it is not about Eclipse. – Bikush Dec 22 '14 at 12:49
  • But it does work if you hard-code the value in the call? In the same situation where it didn't work with the above? – Etan Reisner Dec 22 '14 at 13:18
  • @EtanReisner Yes, hardcoded value works just fine (first example). – Bikush Dec 22 '14 at 13:21
  • There's no way, at the make level, for that to be possible. It is possible, I suppose, if whatever is doing the build is scanning the makefile for the value manually *as well* as using make to build it and that scanning cannot handle variables but I find that possibility incredibly unlikely. What is the **exact** error you get and is it at build time or runtime? – Etan Reisner Dec 22 '14 at 16:30

1 Answers1

1

In the end this setup worked for me:

LOCAL_PATH := $(call my-dir)   # ./Project/proj.android/jni/ folder

...

IMPORT_PATH := $(LOCAL_PATH)/../../..    # ./ this gets me to where the modules are located

$(call import-add-path, $(IMPORT_PATH))
$(call import-add-path, $(IMPORT_PATH)/cocos2dx/platform/third_party/android/prebuilt)

$(call import-module,cocos2dx)    # ./cocos2dx
$(call import-module, ... etc.

I could not pass environment variables through Eclipse to the ndk-build, but it worked if I called import-add-path with a value relative to $(call my-dir). This should work with multiple developers as well.

Bikush
  • 654
  • 8
  • 22