?? build_system.html
字號:
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Android - Porting Guide</title><script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=internal-codesite" type="text/javascript"></script><script src="http://code.google.com/js/jquery.js" type="text/javascript"></script><script type="text/javascript">var _tocPath_ = 'http://code.google.com/android/_toc.ezt';</script><script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script><script language="JavaScript">function resizeHeight() { if(document.getElementById && !(document.all)) { height= document.getElementById('doxygen').contentDocument.body.scrollHeight + 20; document.getElementById('doxygen').style.height = height; } else if(document.all) { height= document.frames('doxygen').document.body.scrollHeight + 20; document.all.doxygen.style.height = height; }}</script><link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet"></link><!--[if IE]><link rel="stylesheet" type="text/css" href="/css/iehacks.css" /><![endif]--><script src="http://code.google.com/android/assets/search_autocomplete.js"></script><link rel="stylesheet" type="text/css" href="http://code.google.com/css/semantic_headers.css" /><link rel="stylesheet" type="text/css" href="http://code.google.com/android/assets/style.css" /><script> jQuery(document).ready(function() { jQuery("pre").addClass("prettyprint"); }); </script><style type="text/css"><!--h1,h2,h3 { color: #000000;}--></style></head><body class="gc-documentation"><div id="gc-container"><a name="top"></a><div id="skipto"> </div><div id="langpref"> <!--<a class="dropdown" href="/">English</a> <span>|</span> <a href="/more/">Site Directory</a> --></div><div id="gc-header"> <div id="logo"><a href="http://code.google.com/android/index.html"><img src="http://code.google.com/android/images/logo_android.gif" alt="Android"/></a></div> <div id="search" style="inline"> <div id="searchForm" class="searchForm" style="height: 44px;"> <!--previously form was here--> </div> <!-- end searchForm --> <noscript> <style type="text/css"> .searchForm { display : none !important; } .searchForm2 { display : inline !important; } </style> </noscript> <div id="searchForm2" class="searchForm2" style="display:none"> <form id="searchbox_001456098540849067467:6whlsytkdqg" action="http://www.google.com/cse"> <input type="hidden" name="cx" value="001456098540849067467:6whlsytkdqg" /> <input type="hidden" name="cof" value="FORID:0" /> <input type="text" name="q" maxlength="2048" size="41" autocomplete="off" title="Google Code Search"/> <input type="submit" name="sa" value="Search" title="Search"/> <br/> <div class="greytext">e.g. "ajax apis" or "open source"</div> </form> </div> <!-- end searchForm2 --> </div> <!-- end search --></div><!-- end gc-header --><div id="searchControl" class="search-control"></div><!--[if IE]><iframe id="backiFrame" name="backiFrame" src='/dummy.html' style="display:none"></iframe><![endif]--><div id="codesiteContent"><a name="gc-topnav-anchor"></a><div id="gc-topnav"> <h1>Android Platform Development Kit</h1> <ul class="gc-topnav-tabs"> <li id="sdk_link"> <a href="http://code.google.com/android/index.html" title="Android Software Development Kit">SDK</a> </li> <li id="docs_link"> <a href="index.html" title="Official Android documentation">Docs</a> </li> <li id="faq_link"> <a href="http://code.google.com/android/kb/index.html" title="Answers to frequently asked questions about Android">FAQ</a> </li> <li> <a href="http://android-developers.blogspot.com/" title="Official Android blog">Blog</a> </li> <li> <a href="http://code.google.com/android/groups.html" title="Android developer forum">Group</a> </li> <li> <a href="http://code.google.com/android/terms.html" title="Android terms of service">Terms</a> </li> <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20build_system.html%20v0.6%20-%2025%20November%202008)%0D%0A%0D%0ASUMMARY:%0D%0A%0D%0A%0D%0A%0D%0ASTEPS%20TO%20REPRODUCE:%0D%0A%0D%0A%0D%0A%0D%0AADDITIONAL%20NOTES:">Report a Problem</a> </li> </ul></div><!-- end gc-topnav --><div class="g-section g-tpl-180"><a name="gc-toc"></a><div class="g-unit g-first" id="gc-toc"> <ul> <li> <h1><a href="index.html">Documentation</a></h1> <ul> <li> <strong>Introduction</strong> <ul> <li><a href="system_requirements.html">Device Requirements</a></li> </ul> </li> <li> <strong>Dev Environment Setup</strong> <ul> <li><a href="build_system.html">Build System</a></li> </ul> </li> <li> <strong>Basic Bring up</strong> <ul> <li><a href="build_new_device.html">Building New Device</a></li> <li><a href="bring_up.html">Bring up</a></li> <li><a href="keymaps_keyboard_input.html">Keymaps and Keyboard</a></li> <li><a href="display_drivers.html">Display Drivers</a></li> </ul> </li> <li> <strong>Multimedia</strong> <ul> <li><a href="audio_sub_system.html">Audio</a></li> <li><a href="camera.html">Camera</a></li> </ul> </li> <li> <strong>Power Management</strong> <ul> <li><a href="power_management.html">Power Management</a></li> </ul> </li> <li> <strong>Networking</strong> <ul> <li><a href="wifi.html">Wi-Fi</a></li> <li><a href="gps.html">GPS</a></li> <li><a href="bluetooth.html">Bluetooth</a></li> </ul> </li> <li> <strong>Telephony</strong> <ul> <li><a href="telephony.html">Radio Interface Layer</a></li> </ul> </li> <li> <strong>Testing</strong> <ul> <li><a href="instrumentation_testing.html">Instrumentation Testing</a></li> </ul> </li> </ul> </li> </ul></div><a name="gc-pagecontent"></a><div class="g-unit" id="gc-pagecontent"><div id="jd-content"><div class="jd-descr"><a name="androidBuildSystemTitle"></a><h1>Android Build System</h1><a name="toc"/><div style="padding:10px"><a href="#androidBuildSystemIntroduction">Introduction</a><br/><a href="#androidBuildSystemUnderstanding">Understanding Android's Build System</a><br/><div style="padding-left:40px"><a href="#androidBuildSystemOverview">Understanding the makefile</a><br/><a href="#androidBuildSystemLayers">Layers</a><br/><a href="#androidBuildSystemProductDefFiles">Product Definition Files</a><br/></div><a href="#androidSourceSetupBuildingCodeBase">Building the Android Platform</a><br/><div style="padding-left:40px"><a href="#androidSourceSetupBuildingDeviceCodeBase">Device Code</a><br/><a href="#androidBuildingCleaning">Cleaning Up</a><br/><a href="#androidBuildingSpeeding">Speeding Up Rebuilds</a><br/><a href="#androidBuildingTroubleshooting">Troubleshooting</a><br/></div><a href="#androidSourceSetupBuildingKernel">Building the Android Kernel</a><br/><div style="padding-left:40px"><a href="#androidSourceSetupBuildingKernelCheckingBranch">Checking Out a Branch</a><br/><a href="#androidSourceSetupBuildingKernelBranchLocation">Verifying Location</a><br/><a href="#androidSourceSetupBuildingKernelBuild">Building the Kernel</a><br/></div></div></font></div><a name="androidBuildSystemIntroduction"></a><h2>Introduction</h2><p>Android uses a custom build system to generate tools, binaries, and documentation. This document provides an overview of Android's build system and instructions for doing a simple build. </p><p>Android's build system is make based and requires a recent version of GNU Make (note that Android uses advanced features of GNU Make that may not yet appear on the GNU Make web site). Before continuing, check your version of make by running <code>% make -v</code>. If you don't have version 3.80 or greater, you need to <a href="http://www.gnu.org/software/make/">upgrade your version of make</a>. </p><a name="androidBuildSystemUnderstanding"></a><h2>Understanding Android's Build System</h2><a name="androidBuildSystemOverview"></a><h3>Understanding the makefile</h3><p>A makefile defines how to build a particular application. Makefiles typically include all of the following elements:</p><ol> <li>Name: Give your build a name (<code>LOCAL_MODULE := <build_name></code>).</li> <li>Local Variables: Clear local variables with CLEAR_VARS (<code>include $(CLEAR_VARS)</code>).</li> <li>Files: Determine which files your application depends upon (<code>LOCAL_SRC_FILES := main.c</code>).</li> <li>Tags: Define tags, as necessary (<code>LOCAL_MODULE_TAGS := eng development</code>).</li> <li>Libraries: Define whether your application links with other libraries (<code>LOCAL_SHARED_LIBRARIES := cutils</code>).</li> <li>Template file: Include a template file to define underlining make tools for a particular target (<code>include $(BUILD_EXECUTABLE)</code>).</li></ol><p>The following snippet illustrates a typical makefile.</p><pre class="prettyprint">LOCAL_PATH := $(my-dir)include $(CLEAR_VARS)LOCAL_MODULE := <buil_name>LOCAL_SRC_FILES := main.cLOCAL_MODULE_TAGS := eng developmentLOCAL_SHARED_LIBRARIES := cutilsinclude $(BUILD_EXECUTABLE)(HOST_)EXECUTABLE, (HOST_)JAVA_LIBRARY, (HOST_)PREBUILT, (HOST_)SHARED_LIBRARY,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -