module and macro in Android.mk

本文详细解读了Android.mk文件中的目标名称、目标类型、Android定义位置等关键信息,帮助开发者更好地理解并利用Android.mk文件进行模块构建。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

There are many things in Android.mk especially  jni's makefile.

here are some key information in the make file.

a.  target name

what's the code's target name is defined in "LOCAL_MODULE"

for example

LOCAL_MODULE := libwebcore //webkit
LOCAL_MODULE:= libskia //skia
LOCAL_MODULE := ping//ping


b.  what kind of will the target be?

there will be three results for c code, static library, share library and executable, how can we tell from the make file?

find "include" key words

include $(BUILD_SHARED_LIBRARY)  //shared
include $(BUILD_EXECUTABLE)  // executable
include $(BUILD_STATIC_LIBRARY) //static 

c. where is ANDROID defined 

for some multi-platform module, the platform macro is used. like "#ifdef ANDROID "

where is ANDROID definded?

build/config.mk

COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W
 -Wall -Wno-unused -Winit-self -Wpointer-arith
d. other global macro definition

other XX.mk in build directory

for example the "shared_library.mk" and "static_library.mk" we talked above

we just need to define the macro and include the XXX.mk.

e. webkit's platform related macro

external/webkit/JavaScriptCore/wtf/Platform.h

for example.

#ifdef ANDROID
#define WTF_OS_ANDROID 1
#endif

#if PLATFORM(ANDROID) && !defined WTF_USE_ACCELERATED_COMPOSITING
#define WTF_USE_ACCELERATED_COMPOSITING 1
#define ENABLE_3D_RENDERING 1
#endif




others

libmodle's address, sometimes error below will occur, as we are compiling a lib module.

" library 'lib*.so' not in prelink map"

solution:

1.build/core/prelink-linux-arm.map

add

lib*.so           0x9C300000

2.add LOCAL_PRELINK_MODULE := false

in Android.mk

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值