Initial Contribution
diff --git a/pdk/ndk/sample/Makefile b/pdk/ndk/sample/Makefile
new file mode 100644
index 0000000..e5b8151
--- /dev/null
+++ b/pdk/ndk/sample/Makefile
@@ -0,0 +1,21 @@
+
+NDK_BASE := ..
+
+include $(NDK_BASE)/config/config.mk
+
+EXECUTABLE := hello
+SOURCES := hello.c
+OBJECTS := $(SOURCES:.c=.o)
+LIBS := -lc -lm
+
+all: $(EXECUTABLE)
+
+# need $(LINK) before all objects and $(POSTLINK) after all objects for
+# android runtime setup.
+
+hello: $(OBJECTS)
+ $(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) $(POSTLINK)
+
+clean:
+ rm -rf *.o hello
+
diff --git a/pdk/ndk/sample/Makefile.hello_cpp b/pdk/ndk/sample/Makefile.hello_cpp
new file mode 100644
index 0000000..f461bdb
--- /dev/null
+++ b/pdk/ndk/sample/Makefile.hello_cpp
@@ -0,0 +1,21 @@
+
+NDK_BASE := ..
+
+include $(NDK_BASE)/config/config.mk
+
+EXECUTABLE := hello_cpp
+SOURCES := hello_cpp.cpp
+OBJECTS := $(SOURCES:.cpp=.o)
+LIBS := -lc -lm -lstdc++
+
+all: $(EXECUTABLE)
+
+# need $(LINK) before all objects and $(POSTLINK) after all objects for
+# android runtime setup.
+
+hello_cpp: $(OBJECTS)
+ $(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) $(POSTLINK)
+
+clean:
+ rm -rf *.o hello_cpp
+
diff --git a/pdk/ndk/sample/Makefile.lib b/pdk/ndk/sample/Makefile.lib
new file mode 100644
index 0000000..68b61ec
--- /dev/null
+++ b/pdk/ndk/sample/Makefile.lib
@@ -0,0 +1,28 @@
+
+NDK_BASE := ..
+
+include $(NDK_BASE)/config/config.mk
+
+SOURCES := hellolibrary.c
+OBJECTS := $(SOURCES:.c=.o)
+LIBS := -lc -lm
+ALIB := $(NDK_BASE)/toolchain/arm-eabi/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a
+
+all: sharedlib staticlib
+
+# Using shared and static suffixes as these are going in the same directory;
+# typically you would not do this as you would make only one version,
+# but if we don't we'll screw up the linking because of linker defaults.
+
+staticlib: $(OBJECTS)
+ $(AR) -cr libhello-static.a $(OBJECTS)
+
+sharedlib: hellolibrary-shared.o
+ $(CC) -nostdlib -Wl,-soname,libhello-shared.so -Wl,-shared,-Bsymbolic -L$(NDK_BASE)/lib $^ $(LIBS) -o libhello-shared.so -Wl,--no-undefined $(ALIB)
+
+hellolibrary-shared.o: hellolibrary.c
+ $(CC) -c -fpic $(INC) -o $@ $^
+
+clean:
+ rm -rf *.o libhello-static.a libhello-shared.so
+
diff --git a/pdk/ndk/sample/Makefile.uselib b/pdk/ndk/sample/Makefile.uselib
new file mode 100644
index 0000000..b677928
--- /dev/null
+++ b/pdk/ndk/sample/Makefile.uselib
@@ -0,0 +1,22 @@
+NDK_BASE := ..
+
+include $(NDK_BASE)/config/config.mk
+
+SOURCES := use_hellolibrary.c
+OBJECTS := $(SOURCES:.c=.o)
+LIBS := -lc -lm
+
+all: use_hellolibrary-a use_hellolibrary-so
+
+# need $(LINK) before all objects and $(POSTLINK) after all objects for
+# android runtime setup.
+
+use_hellolibrary-a: $(OBJECTS)
+ $(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) -L. -lhello-static $(POSTLINK)
+
+use_hellolibrary-so: $(OBJECTS)
+ $(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) -L. -lhello-shared $(POSTLINK)
+
+clean:
+ rm -rf *.o use_hellolibrary-a use_hellolibrary-so
+
diff --git a/pdk/ndk/sample/hello.c b/pdk/ndk/sample/hello.c
new file mode 100644
index 0000000..b7d750f
--- /dev/null
+++ b/pdk/ndk/sample/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello from the NDK; no user libraries.\n");
+ return 0;
+}
diff --git a/pdk/ndk/sample/hello_cpp.cpp b/pdk/ndk/sample/hello_cpp.cpp
new file mode 100644
index 0000000..c0a157a
--- /dev/null
+++ b/pdk/ndk/sample/hello_cpp.cpp
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include "hello_cpp.h"
+
+Hello::Hello()
+{
+}
+
+Hello::~Hello()
+{
+}
+
+void Hello::printMessage(char* msg)
+{
+ printf("C++ example printing message: %s", msg);
+}
+
+int main(void)
+{
+ Hello hello_obj;
+ hello_obj.printMessage("Hello world!\n");
+ return 0;
+}
diff --git a/pdk/ndk/sample/hello_cpp.h b/pdk/ndk/sample/hello_cpp.h
new file mode 100644
index 0000000..b98ae7f
--- /dev/null
+++ b/pdk/ndk/sample/hello_cpp.h
@@ -0,0 +1,12 @@
+#ifndef HELLO_CPP_H
+#define HELLO_CPP_H
+
+class Hello
+{
+public:
+ Hello();
+ ~Hello();
+ void printMessage(char* msg);
+};
+
+#endif
diff --git a/pdk/ndk/sample/hellolibrary.c b/pdk/ndk/sample/hellolibrary.c
new file mode 100644
index 0000000..90f98fa
--- /dev/null
+++ b/pdk/ndk/sample/hellolibrary.c
@@ -0,0 +1,10 @@
+/* hellolibrary.c - demonstrate library use with the NDK.
+ * This will be the library that gets called as wither a static or shared lib.*/
+
+#include <stdio.h>
+
+int hellolibrary(char *msg)
+{
+ printf("Library printing message: %s", msg);
+ return 0;
+}
diff --git a/pdk/ndk/sample/use_hellolibrary.c b/pdk/ndk/sample/use_hellolibrary.c
new file mode 100644
index 0000000..e32a364
--- /dev/null
+++ b/pdk/ndk/sample/use_hellolibrary.c
@@ -0,0 +1,9 @@
+/* use_hellolibrary.c -- used to show how to link to the hellolibrary */
+
+int hellolibrary(char *msg);
+
+int main()
+{
+ hellolibrary("Hello from the NDK.\n");
+ return 0;
+}