title: Android NDK: How to get compiler architecture in Android.mk dynamically
body: <p>I'm trying to configure Android.mk to cross compile native code to support different chipset namely armeabi, mips, and x86. I know I can configure Application.mk in the following way to compile the source code for different chip set:</p>
  
  <pre><code>APP_ABI := all
  </code></pre>
  
  <p>This will trigger Android-NDK's build script to compile the source code for all the chipsets. However, I want to dynamically tell Android.mk to look for different static library dependencies compiled with different chip set.</p>
  
  <pre><code># Get the architecture info
  ARCH := ????
  
  include $(CLEAR_VARS)
  LOCAL_MODULE:= mylib
  LOCAL_SRC_FILES:= build/lib/libxxx_$(ARCH).a
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
  include $(PREBUILT_STATIC_LIBRARY)
  </code></pre>
  
  <p>Is this possible to do? If so, can anyone advice how to do so?</p>
  
  <blockquote>
    <p><strong>Update</strong>: I tried something like this in Application.mk:</p>
  
  <pre><code> APP_ABI := armeabi armeabi-v7a mips x64
  </code></pre>
    
    <p>with Android.mk:</p>
  
  <pre><code># Get the architecture info
  ARCH := $(APP_ABI)
  
  include $(CLEAR_VARS)
  LOCAL_MODULE:= mylib
  LOCAL_SRC_FILES:= build/lib/libxxx_$(ARCH).a
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
  include $(PREBUILT_STATIC_LIBRARY)
  </code></pre>
    
    <p>but it errors with the following:</p>
  
  <pre><code> The LOCAL_SRC_FILES for a prebuilt static library should only contain one item
  </code></pre>
    
    <p>which makes sense. I want to pass APP_ABI := all in Application.mk and be able to
    dynamically reference it. Any ideas?</p>
  </blockquote>