Default NDK-less native apps

Seems to me the Android NDK has been abstracted to the point of obscurity.
I understand the need for a regimented application framework; but talk about over engineering...

> cd $(NDK_HOME)
> build/host-setup.sh
> make app=hello-jni
# ... some magic ...
> cd apps/hello-jni/project
> android.bat update project -p .
> ant debug
# ... more magic ...
> adb install bin/hello-jni-debug.apk

#hey wait wheres my c executable...
> vi apps/hello-jni/project/jni/Android.mk
# change BUILD_SHARED_LIBRARY to BUILD_EXECUTABLE
>make app=hello-jni
# there we go


what a pain, not to mention porting existing posix code with multiple dependencies...


Here is my Makefile developed in cygwin on windows by running:
> make APP=hello-jni V=1
and copying all the pertinent flags into a generic Makefile...

Hope this helps anyone having the same frustrations.

Code:
.KEEP_STATE:


#
# Android NDK tool chain setup
# run cd ~/android/ndk; make APP-xxx -V1 to obtain toolchain values
#

NDK=/home/Administrator/android/ndk
GCC=$(NDK)/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc
AR=$(NDK)/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-ar
STRIP=$(NDK)/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-strip

NDK_INCLUDE=-I$(NDK)/build/platforms/android-3/arch-arm/usr/include

NDK_CFLAGS=\
-march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork \
-ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
-mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
-DANDROID \


#
# THIS WORKS
#

NDK_LDFLAGS=\
-nostdlib -Bdynamic -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc \
$(NDK)/build/platforms/android-3/arch-arm/usr/lib/libc.so \
$(NDK)/build/platforms/android-3/arch-arm/usr/lib/libstdc++.so \
$(NDK)/build/platforms/android-3/arch-arm/usr/lib/libm.so \
$(NDK)/build/platforms/android-3/arch-arm/usr/lib/crtbegin_dynamic.o \
-Wl,--no-undefined -Wl,-rpath-link=$(NDK)/build/platforms/android-3/arch-arm/usr/lib \
$(NDK)/build/prebuilt/windows/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a \
$(NDK)/build/platforms/android-3/arch-arm/usr/lib/crtend_android.o 


#
# Local setup
#


INCLUDE=$(NDK_INCLUDE) -I../sockets -I.
CFLAGS=$(NDK_CFLAGS)

LDFLAGS=$(NDK_LDFLAGS)
LDPATH=$(NDK_LDPATH) -L../sockets -L.
LIBS=$(NDK_LIBS) -ludp -lsockets

OBJS=$(NDK_OBJS) \
udp.o \
readTest.o \
hostnameToIp.o 



# Implicit target definition for generating objects.  (don't touch!)
.c.o:
        $(GCC) $(INCLUDE) $(CFLAGS) -Wall -D__cygwin__ -O2 -DNDEBUG -g -c -MMD -MP -MF $@.d.tmp $< -o $@



# Target section
all: libudp.a readTest writeTest udpRecord multiRead multiWrite
# Dependency section
libudp.a: udp.o hostnameToIp.o multi.o
        $(AR) crs $@ udp.o multi.o hostnameToIp.o
        #ranlib $@

udpRecord: udpRecord.o libudp.a
        $(GCC) udpRecord.o $(LDFLAGS) $(LDPATH) $(LIBS) -o udpRecord
        $(STRIP) --strip-debug $@

readTest: readTest.o libudp.a
        $(GCC) readTest.o $(LDFLAGS) $(LDPATH) $(LIBS) -o readTest
        $(STRIP) --strip-debug $@

writeTest: writeTest.o libudp.a
        $(GCC) writeTest.o $(LDFLAGS) $(LDPATH) $(LIBS) -o writeTest
        $(STRIP) --strip-debug $@

multiRead: multiRead.o libudp.a
        $(GCC) multiRead.o $(LDFLAGS) $(LDPATH) $(LIBS) -o multiRead
        $(STRIP) --strip-debug $@

multiWrite: multiWrite.o libudp.a
        $(GCC) multiWrite.o  $(LDFLAGS) $(LDPATH) $(LIBS) -o multiWrite
        $(STRIP) --strip-debug $@


clean:
        -rm *.o *.a *.o.d.tmp

now its a simple
> make
> adb push program /data
> adb shell chmod 777 /data/program
> adb shell /data/program


this should be useful for command line tools and inittab daemons