Android 编译环境
2010-03-16 04:21:00 来源:WEB开发网4. 回到Android源代码顶层目录进行编译:
# cd $(YOUR_ANDROID) && make helloworld
注意make helloworld中的目标名helloworld就是上面Android.mk文件中由LOCAL_MODULE指定的模块名。编译结果如下:
target thumb C: helloworld <= development/hello/hello.c
target Executable: helloworld (out/target/product/generic/obj/EXECUTABLES/helloworld_intermediates/LINKED/helloworld)
target Non-prelinked: helloworld (out/target/product/generic/symbols/system/bin/helloworld)
target Strip: helloworld (out/target/product/generic/obj/EXECUTABLES/helloworld_intermediates/helloworld)
Install: out/target/product/generic/system/bin/helloworld
5.如上面的编译结果所示,编译后的可执行文件存放在out/target/product/generic/system/bin/helloworld,通过”adb push”将它传送到模拟器上,再通过”adb shell”登录到模拟器终端,就可以执行了
手工编译C模块
我们来试试如何直接运用gcc命令行来编译,从而了解Android编译环境的细节。
Android编译环境提供了”showcommands”选项来显示编译命令行,我们可以通过打开这个选项来查看一些编译时的细节。当然,在这之前要把上一篇中的helloworld模块clean:
# make clean-helloworld
上面的“make clean-$(LOCAL_MODULE)”是Android编译环境提供的make clean的方式。
接下来使用showcommands选项重新编译helloworld:
# make helloworld showcommands
build/core/product_config.mk:229: WARNING: adding test OTA key
target thumb C: helloworld <= development/hello/hello.c
prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc -I system/core/include -I hardware/libhardware/include -I hardware/ril/include -I dalvik/libnativehelper/include -I frameworks/base/include -I external/skia/include -I out/target/product/generic/obj/include -I bionic/libc/arch-arm/include -I bionic/libc/include -I bionic/libstdc++/include -I bionic/libc/kernel/common -I bionic/libc/kernel/arch-arm -I
更多精彩
赞助商链接