module and macro in Android.mk

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

  1. LOCAL_MODULE := libwebcore //webkit  
  2. LOCAL_MODULE:= libskia //skia  
  3. 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

  1. include $(BUILD_SHARED_LIBRARY)  //shared  
  2. include $(BUILD_EXECUTABLE)  // executable  
  3. 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

  1. COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W  
  2.  -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.

  1. <pre name="code" class="plain">#ifdef ANDROID  
  2. #define WTF_OS_ANDROID 1  
  3. #endif  
  1. #if PLATFORM(ANDROID) && !defined WTF_USE_ACCELERATED_COMPOSITING  
  2. #define WTF_USE_ACCELERATED_COMPOSITING 1  
  3. #define ENABLE_3D_RENDERING 1  
  4. #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

posted @ 2012-04-06 22:07  cascais  阅读(471)  评论(0编辑  收藏  举报