Difference between revisions of "Android Build System"

From eLinux.org
Jump to: navigation, search
(revert pdk link, it's just a dup of the source.android site.)
(add some notes about builder helper functions)
Line 1: Line 1:
 
  
 
Basics of the Android Build system are described at:
 
Basics of the Android Build system are described at:
Line 20: Line 19:
 
for interacting with the source.
 
for interacting with the source.
  
   
+
 
 +
== Build tricks ==
 +
=== build helper functions ===
 +
A whole bunch of build helper functions are defined in the file build/core/definitions.mk
 +
 
 +
Try grep define build/core/definitions.mk for an exhaustive list.
 +
 
 +
Here are some possibly interesting functions:
 +
* print-vars - shall all Makefile variables, for debugging
 +
* emit-line - output a line during building, to a file
 +
* dump-words-to-file - output a list of words to a file
 +
* copy-one-file - copy a file from one place to another (dest on target?)
 +
 
 +
 
 +
=== Add a file directly to the output area ===
 +
You can copy a file directly to the output area, without building anything,
 +
using the add-prebuilt-files function.
 +
 
 +
The following line, extracted from prebuilt/android-arm/gdbserver/Android.mk
 +
copies a list of files to the EXECUTABLES directory in the output area:
 +
 
 +
  $(call add-prebuilt-files, EXECUTABLES, $(prebuilt_files))
 +
 
 +
 
  
 
[[Category:Android]]
 
[[Category:Android]]

Revision as of 12:04, 15 July 2010

Basics of the Android Build system are described at: http://source.android.com/porting/build_system.html

Note that "partner-setup" should be replaced with "choosecombo" or even "lunch" in that description.

(This information seems to be duplicated at: http://pdk.android.com/online-pdk/guide/build_system.html I'm going to assume that the source.android site is the most up-to-date, but I haven't checked.)


More information about the Android build system, and some of the rationale for it, are described at: http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html

You use build/envsetup.sh to set up a "convenience environment" for working on the Android source code. This file should be source'ed into your current shell environment. After doing so you can type 'help' for a list of defined functions which are helpful for interacting with the source.


Build tricks

build helper functions

A whole bunch of build helper functions are defined in the file build/core/definitions.mk

Try grep define build/core/definitions.mk for an exhaustive list.

Here are some possibly interesting functions:

  • print-vars - shall all Makefile variables, for debugging
  • emit-line - output a line during building, to a file
  • dump-words-to-file - output a list of words to a file
  • copy-one-file - copy a file from one place to another (dest on target?)


Add a file directly to the output area

You can copy a file directly to the output area, without building anything, using the add-prebuilt-files function.

The following line, extracted from prebuilt/android-arm/gdbserver/Android.mk copies a list of files to the EXECUTABLES directory in the output area:

$(call add-prebuilt-files, EXECUTABLES, $(prebuilt_files))