6

We have a setup where our Android game contains a few native libraries that get built using ndk-build.

Our project contains the following structure:

Root
 |
 |-- jni
      |
      |-- Android.mk   // $include ( lib.mk ) and ( photon/photon.mk)
      |-- lib.mk
      |-- photon
            |
            |----- photon.mk
            |----- debug_android_armeabi.mk
            |----- release_android_armeabi.mk

One of the libs that get built (Photon) comes with 2 additional makefiles besides its main one - one for debug and one for release.

My question is - how can i pass this info to ndk-build such that the correct additional mk file will be picked up when building?

lysergic-acid
  • 19,570
  • 21
  • 109
  • 218

1 Answers1

9

Probably, your photon.mk looks like

...
ifdef DEBUG
  include debug_android_armeabi.mk
else
  include release_android_armeabi.mk
endif
...

This way you can simply use

ndk-build DEBUG=1

If you want to lean on the ndk official features for release/debug build, you may prefer

...
ifeq ($(APP_OPTIM),debug)
  include debug_android_armeabi.mk
else
  include release_android_armeabi.mk
endif
...
Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • The photon.mk doesn't include anything, that's the problem. I added the include directive. – lysergic-acid Jan 05 '14 at 10:33
  • You can also lean on the **ndk**, by checking `ifeq ($(APP_OPTIM),debug)`. **APP_OPTIM** is normally set or chosen in **Application.mk**, see http://stackoverflow.com/questions/14564918/android-ndk-release-build. – Alex Cohn Jan 05 '14 at 10:37