2013年12月9日 星期一

[Android]android.mk

裡面都是用MACRO來命名
開頭一定要寫這兩行
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) 把之前的設定給erase掉


E:\packages\apps\Bluetooth\Android.mk裡面
LOCAL_PACKAGE_NAME := Bluetooth
include $(BUILD_PACKAGE)
所以build出來會放在/out/target/product/xxx/system/app
叫做Bluetooth.apk

E:\frameworks\opt\emoji\Android.mk裡面
LOCAL_MODULE := libemoji
include $(BUILD_SHARED_LIBRARY)
所以build出來會放在/out/target/product/xxx/system/lib
叫做libemoji.so

E:\frameworks\base\cmds\surfaceflinger\Android.mk裡面
LOCAL_MODULE:= surfaceflinger
include $(BUILD_EXECUTABLE)
所以build出來會放在/out/target/product/xxx/system/bin
叫做surfaceflinger(這是個可執行檔)

E:\frameworks\base\services\audioflinger\Android.mk裡面
LOCAL_MODULE:= libaudiointerface
include $(BUILD_SHARED_LIBRARY)
所以build出來會放在/out/target/product/xxx/system/
叫做libaudiointerface

E:\frameworks\base\libs\usb\Android.mk
LOCAL_MODULE:= com.android.future.usb.accessory
include $(BUILD_JAVA_LIBRARY)
所以build出來會放在/out/target/product/xxx/system/framework
叫做com.android.future.usb.accessory.jar


Q: Given to build a shared library named libaudio, it will static link with
a library named libutil. And it has some src files, they individually are
libaudio1.c and libaudio2.c, please write a Android.mk to implement it.
A:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= libaudio
LOCAL_STATIC_LIBRARIES += libutil
LOCAL_SRC_FILES:= libaudio1.c libaudio2.c
include $(BUILD_SHARED_LIBRARY)

沒有留言:

張貼留言