Hi Claudio,
You are right, android/build/core/build-system.html is very old, but it is
still valid.
Here is a sample to build the "Hello world!" for Android, and it is static
linked executable.
1. create a directory for the new component in $(YOUR_ANDROID)/external
folder: $(YOUR_ANDROID)/external/libhello
2. put the hello.c into the directory: $(YOUR_ANDROID)/external/hello/
3. For the shared library, you need to create Android.mk in
$(YOUR_ANDROID)/external/hello/ directory, the Android.mk likes the
following:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := hello.c
LOCAL_CFLAGS :=
LOCAL_C_INCLUDES :=
LOCAL_SHARED_LIBRARIES := libc <=== may be not required
LOCAL_MODULE := libhello
include $(BUILD_SHARED_LIBRARY)
4.
5. For the executable that needs use this shared library, the Android.mk
needs to be written as :
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := main.c
LOCAL_SHARED_LIBRARIES := libc libhello
LOCAL_MODULE := myprog <=== the name of final executable
include $(BUILD_EXECUTABLE)
6. add the following line into $(YOUR_ANDROID)/build/core/main.mk:
external/libhello
7. launch the build command in $(YOUR_ANDROID): make libhello
You will have the build target libhello in
$(YOUR_ANDROID)/out/target/product/generic/system/bin.
You can use include $(BUILD_SHARED_LIBRARY) to create shared library. Find
more in $(YOUR_ANDROID)/build/core/config.mk.
Thanks,
Shridutt Kothari
Impetus Infotech Limited
[email protected]
--
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
---
You received this message because you are subscribed to the Google Groups
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.