title: How to write/debug Android.mk for NDK static library?
body: <p>I'm trying to build a static library using the latest Android NDK (r5) and I'm not having any luck.  I've been able to build and run the samples (for example, HelloJni) without any issues but starting a new project from 'scratch' has been a different story.</p>
  
  <p>For this experiment, I'm trying to build libpng.  My folder structure looks like this:</p>
  
  <pre><code>root
  |
  +--- jni
        |
        +---- Android.mk ( one line: "include $(call all-subdir-makefiles)" )
        |
        +---- png
               |
               +---- Android.mk ( see below )
               |
               +---- { a bunch of .c and .h files )
  </code></pre>
  
  <p>So I have two Android.mks.  One for building all subprojects and one for the libpng subproject.  root/jni/png/Android.mk looks like this:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE := png
  MODULE_PATH := $LOCAL_PATH
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.c)
  LOCAL_C_INCLUDES := $(wildcard $(LOCAL_PATH)/*.h)
  
  LOCAL_INTERMEDIATE_TARGETS += junk
  junk:
      echo $(LOCAL_SRC_FILES)
  
  include $(BUILD_STATIC_LIBRARY)
  </code></pre>
  
  <p>This build setup seems to do nothing (ie running ndk-build from the root folder does nothing, even after an ndk-build clean).  A verbose run (ndk-build V=1) shows some rm -f calls (deleting non-existent folders) but nothing related to the project or subproject.  </p>
  
  <p>I'm pretty interested in why this build script is failing but the process should have been trivial so I'm sure its nothing terribly interesting.  I'm far more interested in how I could start to attack build bugs on my own.  The echo call in the script above is never hit -- I have no idea how to determine what values are or why it skips the subproject.  Has anyone found a way to know what the build system is <em>trying</em> to do?</p>
  
  <p>I'd also be interested in knowing if there are docs for these tools or if its just the handful of text files in the NDK's docs folder?  I've been trying to resolve this by copying pieces of random Android.mk's I've found from googling around but only the few commands used in the simple NDK samples appear to be documented, so the experience has actually just raised new questions.</p>