title: Get architecture type (ABI) to C preprocessor for Android NDK
body: <p>I'm trying to control my C code in an Android NDK project depending on the selected ABI library.</p>
  
  <p>As a start, I want the NDK library method to answer, with a string, what ABI that is used. I did a few tries but all fails to deliver the result.</p>
  
  <p>In Application.mk I define<br>
      APP_ABI := all</p>
  
  <p>Android.mk looks like this:  </p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)  
  include $(CLEAR_VARS)  
  LOCAL_CFLAGS    += -D$(TARGET_ARCH)  
  LOCAL_MODULE    := get_current_abi  
  LOCAL_SRC_FILES := get_current_abi.c  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>And finally my C-file looks like this:
      #include <br>
      #include   </p>
  
  <pre><code>jstring  
  Java_com_example_abifinderlib_AbiFinder_getCurrentAbi(JNIEnv* env, jobject thiz)  
  {  
  #if defined armeabi  
      return (*env)-&gt;NewStringUTF(env, "armeabi");  
  #elif defined armeabi-v7a  
      return (*env)-&gt;NewStringUTF(env, "armeabi-v7a");  
  #elif defined mips  
      return (*env)-&gt;NewStringUTF(env, "mips");  
  #elif defined x86  
      return (*env)-&gt;NewStringUTF(env, "x86");  
  #else  
      return (*env)-&gt;NewStringUTF(env, "unknown");  
  #endif  
  }
  </code></pre>
  
  <p>Result string is always "unknown" for all architectures. (Tested arm v6 and arm v7 on HW and others on emulator)</p>
  
  <p>Can I see the actual content of the $(TARGET_ARCH) in the make file? Can I run only the preprocessor on my c-file and see the preprocessed result?</p>
  
  <p>Or am I straight of and need a totally different approach?</p>