Initial Contribution

This commit is contained in:
The Android Open Source Project 2008-10-21 07:00:00 -07:00
commit b6c1cf6de7
384 changed files with 648683 additions and 0 deletions

81
buildspec.mk.default Normal file
View File

@ -0,0 +1,81 @@
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
######################################################################
# This is a do-nothing template file. To use it, copy it to a file
# named "buildspec.mk" in the same directory, and uncomment or change
# the variables necessary for your desired configuration. The file
# "buildspec.mk" should never be checked in to source control.
######################################################################
# Uncomment this if you want the simulator, otherwise, build for arm
ifndef TARGET_SIMULATOR
#TARGET_SIMULATOR:=true
endif
# Set this to debug or release if you care. Otherwise, it defaults to
# release for arm and debug for the simulator.
ifndef TARGET_BUILD_TYPE
#TARGET_BUILD_TYPE:=release
#TARGET_BUILD_TYPE:=debug
endif
# Uncomment this if you want the host tools built in debug mode. Otherwise
# it defaults to release.
ifndef HOST_BUILD_TYPE
#HOST_BUILD_TYPE:=debug
endif
# Turn on debugging for selected modules. If DEBUG_MODULE_<module-name> is set
# to a non-empty value, the appropriate HOST_/TARGET_CUSTOM_DEBUG_CFLAGS
# will be added to LOCAL_CFLAGS when building the module.
#DEBUG_MODULE_ModuleName:=true
# Specify the extra CFLAGS to use when building a module whose
# DEBUG_MODULE_ variable is set. Host and device flags are handled
# separately.
#HOST_CUSTOM_DEBUG_CFLAGS:=
#TARGET_CUSTOM_DEBUG_CFLAGS:=
# Choose a product to build for. Look in the products directory for ones
# that work.
ifndef TARGET_PRODUCT
#TARGET_PRODUCT:=sooner
endif
# Choose additional targets to always install, even when building
# minimal targets like "make droid". This takes simple target names
# like "Browser" or "MyApp", the names used by LOCAL_MODULE or
# LOCAL_PACKAGE_NAME. Modules listed here will always be installed in
# /system, even if they'd usually go in /data.
ifndef CUSTOM_MODULES
#CUSTOM_MODULES:=
endif
# If you have a special place to put your ouput files, set this, otherwise
# it goes to <build-root>/out
#OUT_DIR:=/tmp/stuff
# If you want to always set certain system properties, add them to this list.
# E.g., "ADDITIONAL_BUILD_PROPERTIES += ro.prop1=5 prop2=value"
# This mechanism does not currently support values containing spaces.
#ADDITIONAL_BUILD_PROPERTIES +=
# when the build system changes such that this file must be updated, this
# variable will be changed. After you have modified this file with the new
# changes (see buildspec.mk.default), update this to the new value from
# buildspec.mk.default.
BUILD_ENV_SEQUENCE_NUMBER := 8

60
cleanspec.mk Normal file
View File

@ -0,0 +1,60 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Just bump this if you want to force a clean build.
# **********************************************************************
# WHEN DOING SO, DELETE ANY "add-clean-step" ENTRIES THAT HAVE PILED UP.
# **********************************************************************
#
INTERNAL_CLEAN_BUILD_VERSION := 1
#
# ***********************************************************************
# Do not touch INTERNAL_CLEAN_BUILD_VERSION if you've added a clean step!
# ***********************************************************************
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/external/zlib/)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

1045
core/Makefile Normal file

File diff suppressed because it is too large Load Diff

304635
core/api/1.xml Normal file

File diff suppressed because it is too large Load Diff

304635
core/api/current.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.xml by executing the following commands:
p4 edit config/api/current.xml
make update-api
To check in the revised current.xml, you will need OWNERS approval.
******************************

View File

@ -0,0 +1,7 @@
******************************
You have tried to change the API from what has been previously released in
an SDK. Please fix the errors listed above.
******************************

198
core/armelf.x Normal file
View File

@ -0,0 +1,198 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
"elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SEARCH_DIR("/usr/local/armdev/arm-elf/lib");
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
/* PROVIDE (__executable_start = 0x8000); . = 0x8000; */
. = 0x8000 + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
.rel.data.rel.ro : { *(.rel.data.rel.ro*) }
.rela.data.rel.ro : { *(.rel.data.rel.ro*) }
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init :
{
KEEP (*(.init))
} =0
.plt : { *(.plt) }
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
KEEP (*(.text.*personality*))
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.glue_7t) *(.glue_7)
} =0
.fini :
{
KEEP (*(.fini))
} =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
/* We have to wrap extab and exidx sections with KEEP because we use
--gc-sections. */
.ARM.extab : { KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*)) }
__exidx_start = .;
.ARM.exidx : { KEEP (*(.ARM.exidx* .gnu.linkonce.armexidx.*)) }
__exidx_end = .;
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
/* Adjust the address for the data segment. We want to align at exactly
a page boundary to make life easier for apriori. */
. = ALIGN(4096);
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(32 / 8);
PROVIDE (__preinit_array_start = .);
.preinit_array : { KEEP (*(.preinit_array)) }
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
.init_array : { KEEP (*(.init_array)) }
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
.fini_array : { KEEP (*(.fini_array)) }
PROVIDE (__fini_array_end = .);
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
.dynamic : { *(.dynamic) }
.got : { *(.got.plt) *(.got) }
.data :
{
__data_start = . ;
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
__bss_start__ = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
_end = .;
_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 :
{
_stack = .;
*(.stack)
}
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
/DISCARD/ : { *(.note.GNU-stack) }
}

201
core/armelf.xsc Normal file
View File

@ -0,0 +1,201 @@
/* Script for --shared -z combreloc: shared library, combine & sort relocs */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
"elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0 + SIZEOF_HEADERS;
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.dyn :
{
*(.rel.init)
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
*(.rel.fini)
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
*(.rel.ctors)
*(.rel.dtors)
*(.rel.got)
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
}
.rela.dyn :
{
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
}
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init :
{
KEEP (*(.init))
} =0
.plt : { *(.plt) }
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
KEEP (*(.text.*personality*))
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.glue_7t) *(.glue_7)
} =0
.fini :
{
KEEP (*(.fini))
} =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
/* We have to wrap extab and exidx sections with KEEP because we use
--gc-sections. */
.ARM.extab : { KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*)) }
__exidx_start = .;
.ARM.exidx : { KEEP (*(.ARM.exidx* .gnu.linkonce.armexidx.*)) }
__exidx_end = .;
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
/* Adjust the address for the data segment. We want to align at exactly
a page boundary to make life easier for apriori. */
. = ALIGN(4096);
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.preinit_array :
{
KEEP (*(.preinit_array))
}
.init_array :
{
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
}
.fini_array :
{
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
.dynamic : { *(.dynamic) }
.got : { *(.got.plt) *(.got) }
.data :
{
__data_start = . ;
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
__bss_start = .;
__bss_start__ = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
}
_bss_end__ = . ; __bss_end__ = . ;
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
__end__ = . ;
_end = .; PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.stack 0x80000 :
{
_stack = .;
*(.stack)
}
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) }
}

164
core/armelflib.x Normal file
View File

@ -0,0 +1,164 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
"elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SEARCH_DIR("/usr/local/armdev/arm-elf/lib");
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
/* PROVIDE (__executable_start = 0x8000); . = 0x8000; */
. = 0 + SIZEOF_HEADERS;
.interp : { *(.interp) }
.init :
{
KEEP (*(.init))
} =0
.plt : { *(.plt) }
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
KEEP (*(.text.*personality*))
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.glue_7t) *(.glue_7)
} =0
.fini :
{
KEEP (*(.fini))
} =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
__exidx_start = .;
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN(256) + (. & (256 - 1));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(32 / 8);
PROVIDE (__preinit_array_start = .);
.preinit_array : { KEEP (*(.preinit_array)) }
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
.init_array : { KEEP (*(.init_array)) }
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
.fini_array : { KEEP (*(.fini_array)) }
PROVIDE (__fini_array_end = .);
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
.got : { *(.got.plt) *(.got) }
.data :
{
__data_start = . ;
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .;
PROVIDE (edata = .);
.dynamic : { *(.dynamic) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
/* .shstrtab : { *(.shstrtab) } */
.rel.plt : { *(.rel.plt) }
.rel.dyn : { *(.rel.*) }
__bss_start = .;
__bss_start__ = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
_end = .;
_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
/DISCARD/ : { *(.note.GNU-stack) *(.comment*) *(.stack*) *(.shstrtab) }
}

436
core/base_rules.mk Normal file
View File

@ -0,0 +1,436 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Users can define base-rules-hook in their buildspec.mk to perform
# arbitrary operations as each module is included.
ifdef base-rules-hook
$(if $(base-rules-hook),)
endif
###########################################################
## Common instructions for a generic module.
###########################################################
LOCAL_MODULE := $(strip $(LOCAL_MODULE))
ifeq ($(LOCAL_MODULE),)
$(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
endif
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
endif
my_prefix:=HOST_
my_host:=host-
else
my_prefix:=TARGET_
my_host:=
endif
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################
## Dump a .csv file of all modules and their tags
#ifneq ($(tag-list-first-time),false)
#$(shell rm -f tag-list.csv)
#tag-list-first-time := false
#endif
#comma := ,
#empty :=
#space := $(empty) $(empty)
#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(LOCAL_MODULE_TAGS))) >> tag-list.csv)
LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS))
ifeq (,$(LOCAL_MODULE_TAGS))
# Modules without tags fall back to the default set
LOCAL_MODULE_TAGS := eng user development
#$(warning default tags: $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))))
endif
# Add implicit tags.
#
# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
# file, tag the module as "gnu". Search for "*_GNU*" so that we can also
# find files like MODULE_LICENSE_GPL_AND_AFL but exclude files like
# MODULE_LICENSE_LGPL.
#
ifneq ($(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL*),)
LOCAL_MODULE_TAGS += gnu
endif
#
# If this module is listed on CUSTOM_MODULES, promote it to "user"
# so that it will be installed in $(TARGET_OUT).
#
ifneq (,$(filter $(LOCAL_MODULE),$(CUSTOM_MODULES)))
LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS) user)
endif
# The definition of should-install-to-system will be different depending
# on which goal (e.g., user/eng/sdk) is being built.
ifdef LOCAL_IS_HOST_MODULE
use_data :=
else
use_data := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA)
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
endif
# Add a tag like "_class@APPS" to this module so that we can filter
# based on the class.
LOCAL_MODULE_TAGS += _class@$(LOCAL_MODULE_CLASS)
LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
ifeq ($(LOCAL_MODULE_PATH),)
LOCAL_MODULE_PATH := $($(my_prefix)OUT$(use_data)_$(LOCAL_MODULE_CLASS))
ifeq ($(strip $(LOCAL_MODULE_PATH)),)
$(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
endif
endif
ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
$(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
endif
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
###########################################################
# Pick a name for the intermediate and final targets
###########################################################
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)
LOCAL_BUILT_MODULE_STEM:= $(strip $(LOCAL_BUILT_MODULE_STEM))
ifeq ($(LOCAL_BUILT_MODULE_STEM),)
LOCAL_BUILT_MODULE_STEM:= $(LOCAL_INSTALLED_MODULE_STEM)
endif
# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
# internal SHARED_LIBRARIES build files.
OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
ifdef OVERRIDE_BUILT_MODULE_PATH
ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
else
built_module_path := $(intermediates)
endif
LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
built_module_path :=
# LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the
# internal STATIC_LIBRARIES build files.
LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
ifdef LOCAL_UNINSTALLABLE_MODULE
ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES))
$(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE)
endif
else
LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_INSTALLED_MODULE_STEM)
endif
# Assemble the list of targets to create PRIVATE_ variables for.
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
###########################################################
## AIDL: Compile .aidl files to .java
###########################################################
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
ifneq ($(strip $(aidl_sources)),)
aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(PRIVATE_ADDITIONAL_DEPENDENCIES) $(AIDL)
$(transform-aidl-to-java)
-include $(aidl_java_sources:%.java=%.P)
else
aidl_java_sources :=
endif
###########################################################
## Java: Compile .java files to .class
###########################################################
#TODO: pull this into java.make once host and target are combined
java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources)
all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
## Java resources #########################################
# Look for resource files in any specified directories.
# Non-java and non-doc files will be picked up as resources
# and included in the output jar file.
java_resource_file_groups :=
LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
# This makes a list of words like
# <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
# where each of the files is relative to the directory it's grouped with.
# Directories that don't contain any resource files will result in groups
# that end with a colon, and they are stripped out in the next step.
java_resource_file_groups += \
$(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
$(subst $(space),:,$(strip \
$(TOP_DIR)$(LOCAL_PATH)/$(dir): \
$(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
find . \
-type d -a -name ".svn" -prune -o \
-type f \
-a \! -name "*.java" \
-a \! -name "package.html" \
-a \! -name "overview.html" \
-a \! -name ".*.swp" \
-a \! -name ".DS_Store" \
-a \! -name "*~" \
-print \
)) \
)) \
)
java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
endif # LOCAL_JAVA_RESOURCE_DIRS
LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
java_resource_file_groups += \
$(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
$(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
)
endif # LOCAL_JAVA_RESOURCE_FILES
ifdef java_resource_file_groups
# The full paths to all resources, used for dependencies.
java_resource_sources := \
$(foreach group,$(java_resource_file_groups), \
$(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
$(wordlist 2,9999,$(subst :,$(space),$(group))) \
) \
)
# The arguments to jar that will include these files in a jar file.
extra_jar_args := \
$(foreach group,$(java_resource_file_groups), \
$(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \
$(wordlist 2,9999,$(subst :,$(space),$(group))) \
) \
)
java_resource_file_groups :=
else
java_resource_sources :=
extra_jar_args :=
endif # java_resource_file_groups
## PRIVATE java vars ######################################
ifneq ($(strip $(all_java_sources)$(all_res_assets)),)
full_static_java_libs := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
$(call intermediates-dir-for, \
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/javalib.jar)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
ifeq ($(my_prefix),TARGET_)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
# full_java_libs: The list of files that should be used as the classpath.
# Using this list as a dependency list WILL NOT WORK.
# full_java_lib_deps: Should be specified as a prerequisite of this module
# to guarantee that the files in full_java_libs will
# be up-to-date.
ifdef LOCAL_IS_HOST_MODULE
# TODO: make prebuilt java libraries use the same
# intermediates path pattern as target java libraries.
full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
full_java_lib_deps := $(full_java_libs)
else
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
endif
full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
# This is set by packages that contain instrumentation, allowing them to
# link against the package they are instrumenting. Currently only one such
# package is allowed.
LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
ifdef LOCAL_INSTRUMENTATION_FOR
ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
$(error \
$(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
endif
link_instr_intermediates_dir := $(call intermediates-dir-for, \
APPS,$(LOCAL_INSTRUMENTATION_FOR))
link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes.jar
# We can't depend on the .jar file, so we depend on something that
# depends on the jar file; the final built package file.
full_java_lib_deps += $(link_instr_intermediates_dir)/package.apk
endif
ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
endif
endif
###########################################################
## make clean- targets
###########################################################
cleantarget := clean-$(LOCAL_MODULE)
$(cleantarget) : PRIVATE_MODULE := $(LOCAL_MODULE)
$(cleantarget) : PRIVATE_CLEAN_FILES := \
$(PRIVATE_CLEAN_FILES) \
$(LOCAL_BUILT_MODULE) \
$(LOCAL_INSTALLED_MODULE) \
$(intermediates)
$(cleantarget)::
@echo "Clean: $(PRIVATE_MODULE)"
$(hide) rm -rf $(PRIVATE_CLEAN_FILES)
###########################################################
## Common definitions for module.
###########################################################
# Propagate local configuration options to this target.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_POST_PROCESS_COMMAND:= $(LOCAL_POST_PROCESS_COMMAND)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
#TODO: add this: $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ADDITIONAL_DEPENDENCIES:= $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
# Tell the module and all of its sub-modules who it is.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE)
# Provide a short-hand for building this module.
# We name both BUILT and INSTALLED in case
# LOCAL_UNINSTALLABLE_MODULE is set.
.PHONY: $(LOCAL_MODULE)
$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
###########################################################
## Module installation rule
###########################################################
# Some hosts do not have ACP; override the LOCAL version if that's the case.
ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
endif
ifndef LOCAL_UNINSTALLABLE_MODULE
# Define a copy rule to install the module.
# acp and libraries that it uses can't use acp for
# installation; hence, LOCAL_ACP_UNAVAILABLE.
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
@echo "Install: $@"
$(copy-file-to-target)
else
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
@echo "Install: $@"
$(copy-file-to-target-with-cp)
endif
endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
## Register with ALL_MODULES
###########################################################
ALL_MODULES += $(LOCAL_MODULE)
# Don't use += on subvars, or else they'll end up being
# recursively expanded.
ALL_MODULES.$(LOCAL_MODULE).PATH := \
$(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
ALL_MODULES.$(LOCAL_MODULE).TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
$(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
###########################################################
## Take care of LOCAL_MODULE_TAGS
###########################################################
# Keep track of all the tags we've seen.
ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
# Add this module to the tag list of each specified tag.
# Don't use "+=". If the variable hasn't been set with ":=",
# it will default to recursive expansion.
$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_TAGS.$(tag) := \
$(ALL_MODULE_TAGS.$(tag)) \
$(LOCAL_INSTALLED_MODULE)))
# Add this module name to the tag list of each specified tag.
$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
# Always build everything, but only install a subset.
ALL_BUILT_MODULES += $(LOCAL_BUILT_MODULE)
###########################################################
## NOTICE files
###########################################################
include $(BUILD_SYSTEM)/notice_files.mk
#:vi noexpandtab

397
core/binary.mk Normal file
View File

@ -0,0 +1,397 @@
###########################################################
## Standard rules for building binary object files from
## asm/c/cpp/yacc/lex source files.
##
## The list of object files is exported in $(all_objects).
###########################################################
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
###########################################################
## Define PRIVATE_ variables used by multiple module types
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
ifeq ($(strip $(LOCAL_CC)),)
LOCAL_CC := $($(my_prefix)CC)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
ifeq ($(strip $(LOCAL_CXX)),)
LOCAL_CXX := $($(my_prefix)CXX)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
# TODO: support a mix of standard extensions so that this isn't necessary
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
ifeq ($(LOCAL_CPP_EXTENSION),)
LOCAL_CPP_EXTENSION := .cpp
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
# Certain modules like libdl have to have symbols resolved at runtime and blow
# up if --no-undefined is passed to the linker.
ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
endif
###########################################################
## Define arm-vs-thumb-mode flags.
###########################################################
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
# Read the values from something like TARGET_arm_release_CFLAGS or
# TARGET_thumb_debug_CFLAGS. HOST_(arm|thumb)_(release|debug)_CFLAGS
# values aren't actually used (although they are usually empty).
arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_$($(my_prefix)BUILD_TYPE)_CFLAGS)
normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_$($(my_prefix)BUILD_TYPE)_CFLAGS)
###########################################################
## Define per-module debugging flags. Users can turn on
## debugging for a particular module by setting DEBUG_MODULE_ModuleName
## to a non-empty value in their environment or buildspec.mk,
## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
## debug flags that they want to use.
###########################################################
ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
else
debug_cflags :=
endif
###########################################################
## Stuff source generated from one-off tools
###########################################################
$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
###########################################################
## YACC: Compile .y files to .cpp and the to .o.
###########################################################
yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
yacc_cpps := $(addprefix \
$(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
ifneq ($(strip $(yacc_cpps)),)
$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.y \
$(lex_cpps) $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
$(transform-$(PRIVATE_HOST)cpp-to-o)
endif
###########################################################
## LEX: Compile .l files to .cpp and then to .o.
###########################################################
lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
lex_cpps := $(addprefix \
$(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
ifneq ($(strip $(lex_cpps)),)
$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-cpp)
$(lex_objects): $(intermediates)/%.o: \
$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
$(PRIVATE_ADDITIONAL_DEPENDENCIES) \
$(yacc_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
endif
###########################################################
## C++: Compile .cpp files to .o.
###########################################################
# we also do this on host modules and sim builds, even though
# it's not really arm, because there are files that are shared.
cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
ifneq ($(strip $(cpp_objects)),)
$(cpp_objects): $(intermediates)/%.o: \
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
$(yacc_cpps) $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(cpp_objects:%.o=%.P)
endif
###########################################################
## C++: Compile generated .cpp files to .o.
###########################################################
gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
ifneq ($(strip $(gen_cpp_objects)),)
# Compile all generated files as thumb.
# TODO: support compiling certain generated files as arm.
$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_cpp_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(gen_cpp_objects:%.o=%.P)
endif
###########################################################
## S: Compile generated .S and .s files to .o.
###########################################################
gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
gen_S_objects := $(gen_S_sources:%.S=%.o)
ifneq ($(strip $(gen_S_sources)),)
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(gen_S_objects:%.o=%.P)
endif
gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
gen_s_objects := $(gen_s_sources:%.s=%.o)
ifneq ($(strip $(gen_s_objects)),)
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(gen_s_objects:%.o=%.P)
endif
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
###########################################################
## C: Compile .c files to .o.
###########################################################
c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
c_objects := $(c_arm_objects) $(c_normal_objects)
ifneq ($(strip $(c_objects)),)
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)c-to-o)
-include $(c_objects:%.o=%.P)
endif
###########################################################
## AS: Compile .S files to .o.
###########################################################
asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
ifneq ($(strip $(asm_objects_S)),)
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(asm_objects_S:%.o=%.P)
endif
asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
ifneq ($(strip $(asm_objects_s)),)
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s $(PRIVATE_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(asm_objects_s:%.o=%.P)
endif
asm_objects := $(asm_objects_S) $(asm_objects_s)
###########################################################
## Common object handling.
###########################################################
# some rules depend on asm_objects being first. If your code depends on
# being first, it's reasonable to require it to be assembly
all_objects := \
$(asm_objects) \
$(cpp_objects) \
$(gen_cpp_objects) \
$(gen_asm_objects) \
$(c_objects) \
$(yacc_objects) \
$(lex_objects) \
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(base_intermediates)
$(all_objects) : | $(LOCAL_GENERATED_SOURCES)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
###########################################################
## Copy headers to the install tree
###########################################################
include $(BUILD_COPY_HEADERS)
###########################################################
# Standard library handling.
#
# On the target, we compile with -nostdlib, so we must add in the
# default system shared libraries, unless they have requested not
# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
# supply that, for example, when building libc itself.
###########################################################
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
LOCAL_SHARED_LIBRARIES += $($(my_prefix)DEFAULT_SYSTEM_SHARED_LIBRARIES)
else
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
endif
# Logging used to be part of libcutils (target) and libutils (sim);
# hack modules that use those other libs to also include liblog.
# All of this complexity is to make sure that liblog only appears
# once, and appears just before libcutils or libutils on the link
# line.
# TODO: remove this hack and change all modules to use liblog
# when necessary.
define insert-liblog
$(if $(filter liblog,$(1)),$(1), \
$(if $(filter libcutils,$(1)), \
$(patsubst libcutils,liblog libcutils,$(1)) \
, \
$(patsubst libutils,liblog libutils,$(1)) \
) \
)
endef
ifneq (,$(filter libcutils libutils,$(LOCAL_SHARED_LIBRARIES)))
LOCAL_SHARED_LIBRARIES := $(call insert-liblog,$(LOCAL_SHARED_LIBRARIES))
endif
ifneq (,$(filter libcutils libutils,$(LOCAL_STATIC_LIBRARIES)))
LOCAL_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_STATIC_LIBRARIES))
endif
ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES)))
LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES))
endif
###########################################################
# The list of libraries that this module will link against are in
# these variables. Each is a list of bare module names like "libc libm".
#
# LOCAL_SHARED_LIBRARIES
# LOCAL_STATIC_LIBRARIES
# LOCAL_WHOLE_STATIC_LIBRARIES
#
# We need to convert the bare names into the dependencies that
# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
# libraries, so that simply building this module doesn't force
# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
# should depend on the INSTALLED versions of the libraries so
# that they get installed when this module does.
###########################################################
# NOTE:
# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
# module without leaving anything out, which is useful for turning
# a collection of .a files into a .so file. Linking against a
# normal STATIC_LIBRARY will only pull in code/symbols that are
# referenced by the module. (see gcc/ld's --whole-archive option)
###########################################################
# Get the list of BUILT libraries, which are under
# various intermediates directories.
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
built_shared_libraries := \
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(LOCAL_SHARED_LIBRARIES)))
built_static_libraries := \
$(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
built_whole_libraries := \
$(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
# Get the list of INSTALLED libraries. Strip off the various
# intermediates directories and point to the common lib dirs.
installed_shared_libraries := \
$(addprefix $($(my_prefix)OUT_SHARED_LIBRARIES)/, \
$(notdir $(built_shared_libraries)))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static
# libraries that we use. (see notice_files.make)
installed_static_library_notice_file_targets := \
$(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
###########################################################
# Rule-specific variable definitions
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
###########################################################
# Define library dependencies.
###########################################################
# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
all_libraries := \
$(built_shared_libraries) \
$(built_static_libraries) \
$(built_whole_libraries)
# Make LOCAL_INSTALLED_MODULE depend on the installed versions of the
# libraries so they get installed along with it. We don't need to
# rebuild it when installing it, though, so this can be an order-only
# dependency.
$(LOCAL_INSTALLED_MODULE): | $(installed_shared_libraries)
# Also depend on the notice files for any static libraries that
# are linked into this module. This will force them to be installed
# when this module is.
$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)

26
core/build_id.mk Normal file
View File

@ -0,0 +1,26 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Defines branch-specific values.
#
# BUILD_ID is usually used to specify the branch name
# (like "MAIN") or a branch name and a release candidate
# (like "TC1-RC5"). It must be a single word, and is
# capitalized by convention.
#
BUILD_ID := TC3

113
core/checktree Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/python -E
import sys, os, re
excludes = [r'.*?/\.obj.*?',
r'.*?~',
r'.*?\/.DS_Store',
r'.*?\/.gdb_history',
r'.*?\/buildspec.mk',
r'.*?/\..*?\.swp',
r'.*?/out/.*?',
r'.*?/install/.*?']
excludes_compiled = map(re.compile, excludes)
def filter_excludes(str):
for e in excludes_compiled:
if e.match(str):
return False
return True
def split_perforce_parts(s):
spaces = ((s.count(" ") + 1) / 3) * 2
pos = 0
while spaces > 0:
pos = s.find(" ", pos) + 1
spaces = spaces - 1
return s[pos:]
def quotate(s):
return '"' + s + '"'
class PerforceError(Exception):
def __init__(self,value):
self.value = value
def __str__(self):
return repr(self.value)
def run(command, regex, filt):
def matchit(s):
m = regex_compiled.match(s)
if m:
return m.group(1)
else:
return ""
def filterit(s):
if filt_compiled.match(s):
return True
else:
return False
fd = os.popen(command);
lines = fd.readlines()
status = fd.close()
if status:
raise PerforceError("error calling " + command)
regex_compiled = re.compile(regex)
filt_compiled = re.compile(filt)
if len(lines) >= 1:
lines = filter(filterit, lines)
if len(lines) >= 1:
return map(matchit, lines)
return None
try:
if len(sys.argv) == 1:
do_exclude = True
elif len(sys.argv) == 2 and sys.argv[1] == "-a":
do_exclude = False
else:
print "usage: checktree [-a]"
print " -a don't filter common crud in the tree"
sys.exit(1)
have = run("p4 have ...", r'[^#]+#[0-9]+ - (.*)', r'.*')
cwd = os.getcwd()
files = run("find . -not -type d", r'.(.*)', r'.*')
files = map(lambda s: cwd+s, files)
added_depot_path = run("p4 opened ...", r'([^#]+)#.*', r'.*?#[0-9]+ - add .*');
added = []
if added_depot_path:
added_depot_path = map(quotate, added_depot_path)
where = "p4 where " + " ".join(added_depot_path)
added = run(where, r'(.*)', r'.*')
added = map(split_perforce_parts, added)
extras = []
# Python 2.3 -- still default on Mac OS X -- does not have set()
# Make dict's here to support the "in" operations below
have = dict().fromkeys(have, 1)
added = dict().fromkeys(added, 1)
for file in files:
if not file in have:
if not file in added:
extras.append(file)
if do_exclude:
extras = filter(filter_excludes, extras)
for s in extras:
print s.replace(" ", "\\ ")
except PerforceError, e:
sys.exit(2)

86
core/cleanbuild.mk Normal file
View File

@ -0,0 +1,86 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
INTERNAL_CLEAN_STEPS :=
# Builds up a list of clean steps. Creates a unique
# id for each step by taking INTERNAL_CLEAN_BUILD_VERSION
# and appending an increasing number of '@' characters.
#
# $(1): shell command to run
define _add-clean-step
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
$(eval _acs_id := $(strip $(lastword $(INTERNAL_CLEAN_STEPS))))
$(if $(_acs_id),,$(eval _acs_id := $(INTERNAL_CLEAN_BUILD_VERSION)))
$(eval _acs_id := $(_acs_id)@)
$(eval INTERNAL_CLEAN_STEPS += $(_acs_id))
$(eval INTERNAL_CLEAN_STEP.$(_acs_id) := $(1))
$(eval _acs_id :=)
endef
define add-clean-step
$(if $(call _add-clean-step,$(1)),)
endef
# Defines INTERNAL_CLEAN_BUILD_VERSION and the individual clean steps.
# cleanspec.mk is outside of the core directory so that more people
# can have permission to touch it.
include build/cleanspec.mk
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
# If the clean_steps.mk file is missing (usually after a clean build)
# then we won't do anything.
CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)
CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)
# Read the current state from the file, if present.
# Will set CURRENT_CLEAN_BUILD_VERSION and CURRENT_CLEAN_STEPS.
#
clean_steps_file := $(PRODUCT_OUT)/clean_steps.mk
-include $(clean_steps_file)
ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
# The major clean version is out-of-date. Do a full clean, and
# don't even bother with the clean steps.
$(info *** A clean build is required because of a recent change.)
$(shell rm -rf $(OUT_DIR))
$(info *** Done with the cleaning, now starting the real build.)
else
# The major clean version is correct. Find the list of clean steps
# that we need to execute to get up-to-date.
steps := \
$(filter-out $(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_STEPS))
$(foreach step,$(steps), \
$(info Clean step: $(INTERNAL_CLEAN_STEP.$(step))) \
$(shell $(INTERNAL_CLEAN_STEP.$(step))) \
)
steps :=
endif
CURRENT_CLEAN_BUILD_VERSION :=
CURRENT_CLEAN_STEPS :=
# Write the new state to the file.
#
$(shell \
mkdir -p $(dir $(clean_steps_file)) && \
echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
$(clean_steps_file) ;\
echo "CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)" >> \
$(clean_steps_file) \
)
clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=

87
core/clear_vars.mk Normal file
View File

@ -0,0 +1,87 @@
###########################################################
## Clear out values of all variables used by rule templates.
###########################################################
LOCAL_MODULE:=
LOCAL_MODULE_PATH:=
LOCAL_BUILT_MODULE:=
LOCAL_BUILT_MODULE_STEM:=
OVERRIDE_BUILT_MODULE_PATH:=
LOCAL_INSTALLED_MODULE:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_INTERMEDIATE_TARGETS:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_MODULE_CLASS:=
LOCAL_MODULE_SUFFIX:=
LOCAL_PACKAGE_NAME:=
LOCAL_OVERRIDES_PACKAGES:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
LOCAL_REQUIRED_MODULES:=
LOCAL_ACP_UNAVAILABLE:=
LOCAL_MODULE_TAGS:=
LOCAL_SRC_FILES:=
LOCAL_PREBUILT_OBJ_FILES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_LIBRARIES:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
LOCAL_SHARED_LIBRARIES:=
LOCAL_IS_HOST_MODULE:=
LOCAL_CC:=
LOCAL_CXX:=
LOCAL_CPP_EXTENSION:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
LOCAL_ARM_MODE:=
LOCAL_YACCFLAGS:=
LOCAL_ASFLAGS:=
LOCAL_CFLAGS:=
LOCAL_CPPFLAGS:=
LOCAL_C_INCLUDES:=
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
LOCAL_AAPT_FLAGS:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_PREBUILT_LIBS:=
LOCAL_PREBUILT_EXECUTABLES:=
LOCAL_PREBUILT_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
LOCAL_INTERMEDIATE_SOURCES:=
LOCAL_JAVA_LIBRARIES:=
LOCAL_NO_STANDARD_LIBRARIES:=
LOCAL_CLASSPATH:=
LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_TEMPLATE_DIR:=
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=
LOCAL_DROIDDOC_ASSET_DIR:=
LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=
LOCAL_DROIDDOC_OPTIONS:=
LOCAL_DROIDDOC_HTML_DIR:=
LOCAL_ASSET_FILES:=
LOCAL_ASSET_DIR:=
LOCAL_RESOURCE_DIR:=
LOCAL_JAVA_RESOURCE_DIRS:=
LOCAL_JAVA_RESOURCE_FILES:=
LOCAL_GENERATED_SOURCES:=
LOCAL_COPY_HEADERS_TO:=
LOCAL_COPY_HEADERS:=
LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
LOCAL_PRELINK_MODULE:=
LOCAL_COMPRESS_MODULE_SYMBOLS:=
LOCAL_STRIP_MODULE:=
LOCAL_POST_PROCESS_COMMAND:=true
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JAR_MANIFEST:=
LOCAL_INSTRUMENTATION_FOR:=
LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME:=
LOCAL_AIDL_INCLUDES:=
LOCAL_ADDITIONAL_JAVA_DIR:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
LOCAL_DX_FLAGS:=
LOCAL_CERTIFICATE:=
LOCAL_SDK_VERSION:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
# Leave the current makefile to make sure we don't break anything
# that expects to be able to find the name of the current makefile.
MAKEFILE_LIST := $(lastword $(MAKEFILE_LIST))

101
core/combo/darwin-x86.mk Normal file
View File

@ -0,0 +1,101 @@
# Configuration for Darwin (Mac OS X) on PPC.
# Included by combo/select.make
$(combo_target)GLOBAL_CFLAGS += -fPIC
$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
$(combo_target)CC := $(CC)
$(combo_target)CXX := $(CXX)
$(combo_target)AR := $(AR)
$(combo_target)SHLIB_SUFFIX := .dylib
$(combo_target)JNILIB_SUFFIX := .jnilib
$(combo_target)GLOBAL_CFLAGS += \
-include $(call select-android-config-h,darwin-x86)
$(combo_target)RUN_RANLIB_AFTER_COPYING := true
ifeq ($(combo_target),TARGET_)
$(combo_target)CUSTOM_LD_COMMAND := true
define transform-o-to-shared-lib-inner
$(TARGET_CXX) \
-dynamiclib -single_module -read_only_relocs suppress \
$(TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_ALL_OBJECTS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_LDLIBS) \
-o $@ \
$(PRIVATE_LDFLAGS) \
$(if $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES),-all_load) \
$(TARGET_LIBGCC)
endef
define transform-o-to-executable-inner
$(TARGET_CXX) \
-o $@ \
-Wl,-dynamic -headerpad_max_install_names \
$(TARGET_GLOBAL_LD_DIRS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(PRIVATE_ALL_OBJECTS) \
$(PRIVATE_LDLIBS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(TARGET_LIBGCC)
endef
define transform-o-to-static-executable-inner
$(TARGET_CXX) \
-static \
-o $@ \
$(TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
$(PRIVATE_LDLIBS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(TARGET_LIBGCC)
endef
else
$(combo_target)CUSTOM_LD_COMMAND := true
define transform-host-o-to-shared-lib-inner
$(HOST_CXX) \
-dynamiclib -single_module -read_only_relocs suppress \
$(HOST_GLOBAL_LD_DIRS) \
$(PRIVATE_ALL_OBJECTS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_LDLIBS) \
-o $@ \
$(PRIVATE_LDFLAGS) \
$(HOST_LIBGCC)
endef
define transform-host-o-to-executable-inner
$(HOST_CXX) \
-o $@ \
-Wl,-dynamic -headerpad_max_install_names \
$(HOST_GLOBAL_LD_DIRS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(PRIVATE_ALL_OBJECTS) \
$(PRIVATE_LDLIBS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(HOST_LIBGCC)
endef
# $(1): The file to check
define get-file-size
stat -f "%z" $(1)
endef
# Which gcc to use to build qemu, which doesn't work right when
# built with 4.2.1 or later.
GCCQEMU := prebuilt/darwin-x86/toolchain/i686-apple-darwin8-4.0.1/bin/gcc
endif

37
core/combo/javac.mk Normal file
View File

@ -0,0 +1,37 @@
# Selects a Java compiler.
#
# Inputs:
# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
# default
#
# Outputs:
# COMMON_JAVAC -- Java compiler command with common arguments
# Whatever compiler is on this system.
ifeq ($(HOST_OS), windows)
COMMON_JAVAC := prebuilt/windows/host/bin/javawrap.exe -J-Xmx256m \
-target 1.5 -Xmaxerrs 9999999
else
COMMON_JAVAC := javac -J-Xmx256m -target 1.5 -Xmaxerrs 9999999
endif
# Eclipse.
ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
-maxProblems 9999999 -nowarn
$(info CUSTOM_JAVA_COMPILER=eclipse)
endif
# OpenJDK.
ifeq ($(CUSTOM_JAVA_COMPILER), openjdk)
# We set the VM options (like -Xmx) in the javac script.
COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \
-Xmaxerrs 9999999
$(info CUSTOM_JAVA_COMPILER=openjdk)
endif
HOST_JAVAC ?= $(COMMON_JAVAC)
TARGET_JAVAC ?= $(COMMON_JAVAC)
#$(info HOST_JAVAC=$(HOST_JAVAC))
#$(info TARGET_JAVAC=$(TARGET_JAVAC))

153
core/combo/linux-arm.mk Normal file
View File

@ -0,0 +1,153 @@
# Configuration for Linux on ARM.
# Included by combo/select.make
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
$(combo_target)TOOLS_PREFIX := \
prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
endif
$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
$(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
$(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
$(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
TARGET_arm_release_CFLAGS := -fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops \
-finline-limit=300
TARGET_thumb_release_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing \
-finline-limit=64
# When building for debug, compile everything as arm.
TARGET_arm_debug_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer -fno-strict-aliasing
TARGET_thumb_debug_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
# NOTE: if you try to build a debug build with thumb, several
# of the libraries (libpv, libwebcore, libkjs) need to be built
# with -mlong-calls. When built at -O0, those libraries are
# too big for a thumb "BL <label>" to go from one end to the other.
## As hopefully a temporary hack,
## use this to force a full ARM build (for easier debugging in gdb)
## (don't forget to do a clean build)
##TARGET_arm_release_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer
##TARGET_thumb_release_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
## on some hosts, the target cross-compiler is not available so do not run this command
ifneq ($(wildcard $($(combo_target)CC)),)
$(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name)
endif
$(combo_target)GLOBAL_CFLAGS += \
-march=armv5te -mtune=xscale \
-msoft-float -fpic \
-mthumb-interwork \
-ffunction-sections \
-funwind-tables \
-fstack-protector \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
-include $(call select-android-config-h,linux-arm)
$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
$(combo_target)RELEASE_CFLAGS := \
-DSK_RELEASE -DNDEBUG \
-O2 -g \
-Wstrict-aliasing=2 \
-finline-functions \
-fno-inline-functions-called-once \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers
libc_root := bionic/libc
libm_root := bionic/libm
libstdc++_root := bionic/libstdc++
libthread_db_root := bionic/libthread_db
# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
# symlinks located in out/ to point to the appropriate kernel
# headers. see 'config/kernel_headers.make' for more details
#
ifneq ($(CUSTOM_KERNEL_HEADERS),)
KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
else
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
endif
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
$(combo_target)C_INCLUDES := \
$(libc_root)/arch-arm/include \
$(libc_root)/include \
$(libstdc++_root)/include \
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/arch/arm \
$(libthread_db_root)/include
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
TARGET_STRIP_MODULE:=true
$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
$(combo_target)CUSTOM_LD_COMMAND := true
define transform-o-to-shared-lib-inner
$(TARGET_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
-Wl,--gc-sections \
-Wl,-shared,-Bsymbolic \
$(TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
-Wl,--no-whole-archive \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
$(TARGET_LIBGCC)
endef
define transform-o-to-executable-inner
$(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
-o $@ \
$(TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(TARGET_CRTBEGIN_DYNAMIC_O) \
$(PRIVATE_ALL_OBJECTS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_LDFLAGS) \
$(TARGET_LIBGCC) \
$(TARGET_CRTEND_O)
endef
define transform-o-to-static-executable-inner
$(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
-Wl,--gc-sections \
-o $@ \
$(TARGET_GLOBAL_LD_DIRS) \
$(TARGET_CRTBEGIN_STATIC_O) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(TARGET_LIBGCC) \
$(TARGET_CRTEND_O)
endef

27
core/combo/linux-x86.mk Normal file
View File

@ -0,0 +1,27 @@
# Configuration for Linux on x86.
# Included by combo/select.make
# right now we get these from the environment, but we should
# pick them from the tree somewhere
$(combo_target)CC := $(CC)
$(combo_target)CXX := $(CXX)
$(combo_target)AR := $(AR)
$(combo_target)GLOBAL_CFLAGS += -fPIC -m32
$(combo_target)GLOBAL_CFLAGS += \
-include $(call select-android-config-h,linux-x86)
$(combo_target)GLOBAL_LDFLAGS += -m32
$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
ifeq ($(combo_target),HOST_)
# $(1): The file to check
define get-file-size
stat --format "%s" "$(1)"
endef
# Which gcc to use to build qemu, which doesn't work right when
# built with 4.2.1 or later.
GCCQEMU := prebuilt/linux-x86/toolchain/i686-linux-gnu-3.4.6/bin/gcc
endif # HOST

61
core/combo/select.mk Normal file
View File

@ -0,0 +1,61 @@
# Select a combo based on the compiler being used.
#
# Inputs:
# combo_target -- prefix for final variables (HOST_ or TARGET_)
#
# Outputs:
# $(combo_target)OS -- standard name for this host (LINUX, DARWIN, etc.)
# $(combo_target)ARCH -- standard name for process architecture (powerpc, x86, etc.)
# $(combo_target)GLOBAL_CFLAGS -- C compiler flags to use for everything
# $(combo_target)DEBUG_CFLAGS -- additional C compiler flags for debug builds
# $(combo_target)RELEASE_CFLAGS -- additional C compiler flags for release builds
# $(combo_target)GLOBAL_ARFLAGS -- flags to use for static linking everything
# $(combo_target)SHLIB_SUFFIX -- suffix of shared libraries
# Build a target string like "linux-arm" or "darwin-x86".
combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
# Set the defaults.
HOST_CC ?= $(CC)
HOST_CXX ?= $(CXX)
HOST_AR ?= $(AR)
$(combo_target)BINDER_MINI := 0
$(combo_target)HAVE_EXCEPTIONS := 0
$(combo_target)HAVE_UNIX_FILE_PATH := 1
$(combo_target)HAVE_WINDOWS_FILE_PATH := 0
$(combo_target)HAVE_RTTI := 1
$(combo_target)HAVE_CALL_STACKS := 1
$(combo_target)HAVE_64BIT_IO := 1
$(combo_target)HAVE_CLOCK_TIMERS := 1
$(combo_target)HAVE_PTHREAD_RWLOCK := 1
$(combo_target)HAVE_STRNLEN := 1
$(combo_target)HAVE_STRERROR_R_STRRET := 1
$(combo_target)HAVE_STRLCPY := 0
$(combo_target)HAVE_STRLCAT := 0
$(combo_target)HAVE_KERNEL_MODULES := 0
# These flags might (will) be overridden by the target makefiles
$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
$(combo_target)DEBUG_CFLAGS := -O0 -g
$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
$(combo_target)GLOBAL_ARFLAGS := crs
$(combo_target)EXECUTABLE_SUFFIX :=
$(combo_target)SHLIB_SUFFIX := .so
$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
$(combo_target)STATIC_LIB_SUFFIX := .a
$(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map
# Now include the combo for this specific target.
include $(BUILD_COMBOS)/$(combo_os_arch).mk
ifneq ($(USE_CCACHE),)
ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
$(combo_target)CC := $(ccache) $($(combo_target)CC)
$(combo_target)CXX := $(ccache) $($(combo_target)CXX)
ccache =
endif

53
core/combo/windows-x86.mk Normal file
View File

@ -0,0 +1,53 @@
# Configuration for Linux on x86.
# Included by combo/select.make
# right now we get these from the environment, but we should
# pick them from the tree somewhere
TOOLS_PREFIX := #prebuilt/windows/host/bin/
TOOLS_EXE_SUFFIX := .exe
# Settings to use MinGW has a cross-compiler under Linux
ifneq ($(findstring Linux,$(UNAME)),)
ifneq ($(strip $(USE_MINGW)),)
HOST_ACP_UNAVAILABLE := true
TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-
TOOLS_EXE_SUFFIX :=
$(combo_target)GLOBAL_CFLAGS += -DUSE_MINGW
$(combo_target)C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
$(combo_target)GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
endif
endif
$(combo_target)CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
$(combo_target)CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
$(combo_target)AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
$(combo_target)GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
$(combo_target)GLOBAL_LDFLAGS += --enable-stdcall-fixup
# when building under Cygwin, ensure that we use Mingw compilation by default.
# you can disable this (i.e. to generate Cygwin executables) by defining the
# USE_CYGWIN variable in your environment, e.g.:
#
# export USE_CYGWIN=1
#
# note that the -mno-cygwin flags are not needed when cross-compiling the
# Windows host tools on Linux
#
ifneq ($(findstring CYGWIN,$(UNAME)),)
ifeq ($(strip $(USE_CYGWIN)),)
$(combo_target)GLOBAL_CFLAGS += -mno-cygwin
$(combo_target)GLOBAL_LDFLAGS += -mno-cygwin -mconsole
endif
endif
$(combo_target)SHLIB_SUFFIX := .dll
$(combo_target)EXECUTABLE_SUFFIX := .exe
ifeq ($(combo_target),HOST_)
# $(1): The file to check
# TODO: find out what format cygwin's stat(1) uses
define get-file-size
999999999
endef
endif

281
core/config.mk Normal file
View File

@ -0,0 +1,281 @@
# This is included by the top-level Makefile.
# It sets up standard variables based on the
# current configuration and platform, which
# are not specific to what is being built.
# Standard source directories.
SRC_DOCS:= $(TOPDIR)docs
# TODO: Enforce some kind of layering; only add include paths
# when a module links against a particular library.
# TODO: See if we can remove most of these from the global list.
SRC_HEADERS := \
$(TOPDIR)system/core/include \
$(TOPDIR)hardware/libhardware/include \
$(TOPDIR)hardware/ril/include \
$(TOPDIR)dalvik/libnativehelper/include \
$(TOPDIR)frameworks/base/include \
$(TOPDIR)external/skia/include
SRC_HOST_HEADERS:=$(TOPDIR)tools/include
SRC_LIBRARIES:= $(TOPDIR)libs
SRC_SERVERS:= $(TOPDIR)servers
SRC_TOOLS:= $(TOPDIR)tools
SRC_TARGET_DIR := $(TOPDIR)build/target
# Some specific paths to tools
SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
# Various mappings to avoid hard-coding paths all over the place
include $(BUILD_SYSTEM)/pathmap.mk
# ###############################################################
# Build system internal files
# ###############################################################
BUILD_COMBOS:= $(BUILD_SYSTEM)/combo
CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk
BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
BUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mk
BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk
BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
BUILD_KEY_CHAR_MAP := $(BUILD_SYSTEM)/key_char_map.mk
# ###############################################################
# Parse out any modifier targets.
# ###############################################################
# The 'showcommands' goal says to show the full command
# lines being executed, instead of a short message about
# the kind of operation being done.
SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
# ###############################################################
# Set common values
# ###############################################################
# These can be changed to modify both host and device modules.
COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused
COMMON_DEBUG_CFLAGS:=
COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
COMMON_GLOBAL_CPPFLAGS:=
COMMON_DEBUG_CPPFLAGS:=
COMMON_RELEASE_CPPFLAGS:=
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
COMMON_ANDROID_PACKAGE_SUFFIX := .apk
# ###############################################################
# Include sub-configuration files
# ###############################################################
# ---------------------------------------------------------------
# Try to include buildspec.mk, which will try to set stuff up.
# If this file doesn't exist, the environemnt variables will
# be used, and if that doesn't work, then the default is an
# arm build
-include $(TOPDIR)buildspec.mk
# ---------------------------------------------------------------
# Handle the setup of TARGET_PRODUCT and related variables.
include $(BUILD_SYSTEM)/product_config.mk
# ---------------------------------------------------------------
# Define most of the global variables.
include $(BUILD_SYSTEM)/envsetup.mk
# $(1): os/arch
define select-android-config-h
system/core/include/arch/$(1)/AndroidConfig.h
endef
combo_target := HOST_
include $(BUILD_SYSTEM)/combo/select.mk
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
combo_target := TARGET_
include $(BUILD_SYSTEM)/combo/select.mk
# Pick a Java compiler.
include $(BUILD_SYSTEM)/combo/javac.mk
# ---------------------------------------------------------------
# Check that the configuration is current. We check that
# BUILD_ENV_SEQUENCE_NUMBER is current against this value.
ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER)))
ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER))
$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.)
$(info *** If you use envsetup/lunch/choosecombo:)
$(info *** - Re-execute envsetup (". envsetup.sh"))
$(info *** - Re-run lunch or choosecombo)
$(info *** If you use buildspec.mk:)
$(info *** - Look at buildspec.mk.default to see what has changed)
$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)")
$(error bailing..)
endif
endif
# ---------------------------------------------------------------
# Generic tools.
LEX:= flex
YACC:= bison -d
DOXYGEN:= doxygen
AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
ACP := $(HOST_OUT_EXECUTABLES)/acp$(HOST_EXECUTABLE_SUFFIX)
AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX)
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
# dx is java behind a shell script; no .exe necessary.
DX := $(HOST_OUT_EXECUTABLES)/dx
KCM := $(HOST_OUT_EXECUTABLES)/kcm$(HOST_EXECUTABLE_SUFFIX)
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
FINDBUGS := prebuilt/common/findbugs/bin/findbugs
LOCALIZE := $(HOST_OUT_EXECUTABLES)/localize$(HOST_EXECUTABLE_SUFFIX)
# Binary prelinker/compressor tools
APRIORI := $(HOST_OUT_EXECUTABLES)/apriori$(HOST_EXECUTABLE_SUFFIX)
LSD := $(HOST_OUT_EXECUTABLES)/lsd$(HOST_EXECUTABLE_SUFFIX)
SOSLIM := $(HOST_OUT_EXECUTABLES)/soslim$(HOST_EXECUTABLE_SUFFIX)
# Deal with archaic version of bison on Mac OS X.
ifeq ($(filter 1.28,$(shell $(YACC) -V)),)
YACC_HEADER_SUFFIX:= .hpp
else
YACC_HEADER_SUFFIX:= .cpp.h
endif
# Don't use column under Windows, cygwin or not
ifeq ($(HOST_OS),windows)
COLUMN:= cat
else
COLUMN:= column
endif
dir := $(shell uname)
ifeq ($(HOST_OS),windows)
dir := $(HOST_OS)
endif
ifeq ($(HOST_OS),darwin)
dir := $(HOST_OS)-$(HOST_ARCH)
endif
OLD_FLEX := prebuilt/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(HOST_OS),darwin)
# Mac OS' screwy version of java uses a non-standard directory layout
# and doesn't even seem to have tools.jar. On the other hand, javac seems
# to be able to magically find the classes in there, wherever they are, so
# leave this blank
HOST_JDK_TOOLS_JAR :=
else
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
endif
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
MD5SUM:=md5 -q
else
MD5SUM:=md5sum
endif
# ###############################################################
# Set up final options.
# ###############################################################
HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
HOST_DEBUG_CFLAGS += $(COMMON_DEBUG_CFLAGS)
HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
HOST_DEBUG_CPPFLAGS += $(COMMON_DEBUG_CPPFLAGS)
HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
TARGET_DEBUG_CFLAGS += $(COMMON_DEBUG_CFLAGS)
TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
TARGET_DEBUG_CPPFLAGS += $(COMMON_DEBUG_CPPFLAGS)
TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS)
ifeq ($(HOST_BUILD_TYPE),release)
HOST_GLOBAL_CFLAGS+= $(HOST_RELEASE_CFLAGS)
HOST_GLOBAL_CPPFLAGS+= $(HOST_RELEASE_CPPFLAGS)
else
HOST_GLOBAL_CFLAGS+= $(HOST_DEBUG_CFLAGS)
HOST_GLOBAL_CPPFLAGS+= $(HOST_DEBUG_CPPFLAGS)
endif
ifeq ($(TARGET_BUILD_TYPE),release)
TARGET_GLOBAL_CFLAGS+= $(TARGET_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS+= $(TARGET_RELEASE_CPPFLAGS)
else
TARGET_GLOBAL_CFLAGS+= $(TARGET_DEBUG_CFLAGS)
TARGET_GLOBAL_CPPFLAGS+= $(TARGET_DEBUG_CPPFLAGS)
endif
# TODO: do symbol compression
TARGET_COMPRESS_MODULE_SYMBOLS := false
TARGET_PRELINK_MODULE := true
PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)
# ###############################################################
# Collect a list of the SDK versions that we could compile against
# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
# ###############################################################
# The files that we can convert into android.jars are are in config/api/*.xml
# The 'current' version is whatever this source tree is. Once the apicheck
# tool can generate the stubs from the xml files, we'll use that to be
# able to build back-versions. In the meantime, 'current' is the only
# one supported.
#
# sgrax is the opposite of xargs. It takes the list of args and puts them
# on each line for sort to process.
# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3.
TARGET_AVAILABLE_SDK_VERSIONS := current \
$(shell function sgrax() { \
while [ -n "$$1" ] ; do echo $$1 ; shift ; done \
} ; \
( sgrax $(patsubst $(BUILD_SYSTEM)/api/%.xml,%, \
$(filter-out $(BUILD_SYSTEM)/api/current.xml, \
$(shell find $(BUILD_SYSTEM)/api -name "*.xml"))) | sort -g ) )
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml

23
core/copy_headers.mk Normal file
View File

@ -0,0 +1,23 @@
###########################################################
## Copy headers to the install tree
###########################################################
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_prefix := HOST_
else
my_prefix := TARGET_
endif
# Create a rule to copy each header, and make the
# all_copied_headers phony target depend on each
# destination header. copy-one-header defines the
# actual rule.
#
$(foreach header,$(LOCAL_COPY_HEADERS), \
$(eval _chFrom := $(LOCAL_PATH)/$(header)) \
$(eval _chTo := \
$($(my_prefix)OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header))) \
$(eval $(call copy-one-header,$(_chFrom),$(_chTo))) \
$(eval all_copied_headers: $(_chTo)) \
)
_chFrom :=
_chTo :=

1466
core/definitions.mk Normal file

File diff suppressed because it is too large Load Diff

76
core/device.mk Normal file
View File

@ -0,0 +1,76 @@
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
_device_var_list := \
DEVICE_NAME \
DEVICE_BOARD \
DEVICE_REGION
define dump-device
$(info ==== $(1) ====)\
$(foreach v,$(_device_var_list),\
$(info DEVICES.$(1).$(v) := $(DEVICES.$(1).$(v))))\
$(info --------)
endef
define dump-devices
$(foreach p,$(DEVICES),$(call dump-device,$(p)))
endef
#
# $(1): device to inherit
#
define inherit-device
$(foreach v,$(_device_var_list), \
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1))))
endef
#
# $(1): device makefile list
#
#TODO: check to make sure that devices have all the necessary vars defined
define import-devices
$(call import-nodes,DEVICES,$(1),$(_device_var_list))
endef
#
# $(1): short device name like "sooner"
#
define _resolve-short-device-name
$(eval dn := $(strip $(1)))
$(eval d := \
$(foreach d,$(DEVICES), \
$(if $(filter $(dn),$(DEVICES.$(d).DEVICE_NAME)), \
$(d) \
)) \
)
$(eval d := $(sort $(d)))
$(if $(filter 1,$(words $(d))), \
$(d), \
$(if $(filter 0,$(words $(d))), \
$(error No matches for device "$(dn)"), \
$(error Device "$(dn)" ambiguous: matches $(d)) \
) \
)
endef
#
# $(1): short device name like "sooner"
#
define resolve-short-device-name
$(strip $(call _resolve-short-device-name,$(1)))
endef

77
core/distdir.mk Normal file
View File

@ -0,0 +1,77 @@
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# HACK HACK HACK
# *** Do not use any of the following as an example for anything else ***
# TODO: remove this hack once the build machine no longer needs "user-dist"
user-dist: user
ifneq (,$(filter user-dist,$(MAKECMDGOALS)))
MAKECMDGOALS := $(patsubst user-dist,user dist,$(MAKECMDGOALS))
endif
# When specifying "dist", the user has asked that we copy the important
# files from this build into DIST_DIR.
.PHONY: dist
dist: ;
dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
ifeq (,$(strip $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))))
# The commandline was something like "make dist" or "make dist showcommands".
# Add a dependency on a real target.
dist: $(DEFAULT_TARGET)
endif
ifdef dist_goal
# $(1): source file
# $(2): destination file
# $(3): goals that should copy the file
#
define copy-one-dist-file
$(3): $(2)
$(2): $(1)
@echo "Dist: $$@"
$$(copy-file-to-new-target-with-cp)
endef
# Other parts of the system should use this function to associate
# certain files with certain goals. When those goals are built
# and "dist" is specified, the marked files will be copied to DIST_DIR.
#
# $(1): a list of goals (e.g., "user all")
# $(2): the dist files to add to those goals
define dist-for-goals
$(foreach file,$(2), \
$(eval \
$(call copy-one-dist-file, \
$(file), \
$(DIST_DIR)/$(notdir $(file)), \
$(1) \
) \
) \
)
endef
else # !dist_goal
# empty definition when not building dist
define dist-for-goals
endef
endif # !dist_goal

158
core/droiddoc.mk Normal file
View File

@ -0,0 +1,158 @@
###########################################################
## Standard rules for building documentation
###########################################################
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
ifdef LOCAL_IS_HOST_MODULE
my_prefix:=HOST_
else
my_prefix:=TARGET_
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
ifndef LOCAL_MODULE_CLASS
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined)
endif
full_src_files := $(patsubst %,$(LOCAL_PATH)/%,$(LOCAL_SRC_FILES))
out_dir := $(OUT_DOCS)/$(LOCAL_MODULE)
full_target := $(OUT_DOCS)/$(LOCAL_MODULE)-timestamp
ifeq ($(LOCAL_DROIDDOC_SOURCE_PATH),)
LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)
endif
ifeq ($(LOCAL_DROIDDOC_TEMPLATE_DIR),)
LOCAL_DROIDDOC_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/templates
endif
ifeq ($(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR),)
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/templates
endif
ifeq ($(LOCAL_DROIDDOC_ASSET_DIR),)
LOCAL_DROIDDOC_ASSET_DIR := assets
endif
ifeq ($(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR),)
LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
endif
droiddoc_templates := \
$(shell find $(LOCAL_DROIDDOC_TEMPLATE_DIR) -type f) \
$(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f)
droiddoc := \
$(HOST_JDK_TOOLS_JAR) \
$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX) \
$(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
$(HOST_OUT_SHARED_LIBRARIES)/libclearsilver-jni$(HOST_JNILIB_SUFFIX)
intermediates := $(call local-intermediates-dir)
$(full_target): PRIVATE_CLASSPATH:=$(LOCAL_CLASSPATH)
full_java_lib_deps :=
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_JAVA_LIBRARIES),)
LOCAL_JAVA_LIBRARIES := core ext framework
endif
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
# we're not going to generate docs from any of these classes, but we need them
# to build properly.
ifneq ($(strip $(LOCAL_STATIC_JAVA_LIBRARIES)),)
full_java_libs += $(addprefix $(LOCAL_PATH)/,$(LOCAL_STATIC_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
full_java_lib_deps += $(addprefix $(LOCAL_PATH)/,$(LOCAL_STATIC_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
endif
empty :=
space := $(empty) $(empty)
$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
endif # !LOCAL_IS_HOST_MODULE
$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files))
$(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER)
$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
$(full_target): PRIVATE_OUT_DIR := $(out_dir)
$(full_target): PRIVATE_DROIDDOC_OPTIONS := $(LOCAL_DROIDDOC_OPTIONS)
$(full_target): PRIVATE_TEMPLATE_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)
$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
$(full_target): PRIVATE_IN_ASSET_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
endif
$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH))
$(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
$(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates)/droiddoc-src-list
ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),)
$(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR)
endif
html_dir_files := $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f)
ifeq (a,b)
$(full_target): PRIVATE_PROFILING_OPTIONS := \
-J-agentlib:jprofilerti=port=8849 -J-Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar
endif
$(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_files) $(full_java_lib_deps)
@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
@mkdir -p $(dir $(full_target))
@mkdir -p $(dir $(PRIVATE_SRC_LIST_FILE))
$(call dump-words-to-file, $(PRIVATE_JAVA_FILES), $(PRIVATE_SRC_LIST_FILE))
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_SRC_LIST_FILE) 2> /dev/null || true
$(hide) if [ "$(PRIVATE_ADDITIONAL_JAVA_DIR)" != "" ] ; then ( find $(PRIVATE_ADDITIONAL_JAVA_DIR) -name '*.java' >> $(PRIVATE_SRC_LIST_FILE) 2> /dev/null || true ) fi
$(hide) ( \
\
LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \
javadoc \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx768m \
-J-Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) \
$(PRIVATE_PROFILING_OPTIONS) \
-quiet \
-doclet DroidDoc \
-docletpath $(PRIVATE_DOCLETPATH) \
-templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
-templatedir $(PRIVATE_TEMPLATE_DIR) \
$(PRIVATE_DROIDDOC_HTML_DIR) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
$(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
$(PRIVATE_DROIDDOC_OPTIONS) \
&& rm -rf $(PRIVATE_OUT_ASSET_DIR) \
&& rm -rf $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
&& mkdir -p $(PRIVATE_OUT_ASSET_DIR) \
&& mkdir -p $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
&& cp -fr $(PRIVATE_IN_ASSET_DIR)/* $(PRIVATE_OUT_ASSET_DIR)/ \
&& cp -fr $(PRIVATE_IN_CUSTOM_ASSET_DIR)/* $(PRIVATE_OUT_CUSTOM_ASSET_DIR)/ \
&& touch -f $@ \
) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
ALL_DOCS += $(full_target)
.PHONY: $(LOCAL_MODULE)-docs
$(LOCAL_MODULE)-docs : $(full_target)
# Define a rule to create a zip of these docs.
out_zip := $(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip
$(out_zip): PRIVATE_DOCS_DIR := $(out_dir)
$(out_zip): $(full_target)
@echo Package docs: $@
@rm -f $@
@mkdir -p $(dir $@)
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
$(call dist-for-goals,docs,$(out_zip))

144
core/dynamic_binary.mk Normal file
View File

@ -0,0 +1,144 @@
###########################################################
## Standard rules for building any target-side binaries
## with dynamic linkage (dynamic libraries or executables
## that link with dynamic libraries)
##
## Files including this file must define a rule to build
## the target $(linked_module).
###########################################################
# This constraint means that we can hard-code any $(TARGET_*) variables.
ifdef LOCAL_IS_HOST_MODULE
$(error This file should not be used to build host binaries. Included by (or near) $(lastword $(filter-out config/%,$(MAKEFILE_LIST))))
endif
LOCAL_UNSTRIPPED_PATH := $(strip $(LOCAL_UNSTRIPPED_PATH))
ifeq ($(LOCAL_UNSTRIPPED_PATH),)
LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_$(LOCAL_MODULE_CLASS)_UNSTRIPPED)
endif
# The name of the target file, without any path prepended.
LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)
# base_rules.make defines $(intermediates), but we need its value
# before we include base_rules. Make a guess, and verify that
# it's correct once the real value is defined.
guessed_intermediates := $(call local-intermediates-dir)
# Define the target that is the unmodified output of the linker.
# The basename of this target must be the same as the final output
# binary name, because it's used to set the "soname" in the binary.
# The includer of this file will define a rule to build this target.
linked_module := $(guessed_intermediates)/LINKED/$(LOCAL_BUILT_MODULE_STEM)
ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
# Because TARGET_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
# the linked_module rules won't necessarily inherit the PRIVATE_
# variables from LOCAL_BUILT_MODULE. This tells binary.make to explicitly
# define the PRIVATE_ variables for linked_module as well as for
# LOCAL_BUILT_MODULE.
LOCAL_INTERMEDIATE_TARGETS := $(linked_module)
###################################
include $(BUILD_SYSTEM)/binary.mk
###################################
# Make sure that our guess at the value of intermediates was correct.
ifneq ($(intermediates),$(guessed_intermediates))
$(error Internal error: guessed path '$(guessed_intermediates)' doesn't match '$(intermediates))
endif
###########################################################
## Compress
###########################################################
compress_input := $(linked_module)
ifeq ($(strip $(LOCAL_COMPRESS_MODULE_SYMBOLS)),)
LOCAL_COMPRESS_MODULE_SYMBOLS := $(strip $(TARGET_COMPRESS_MODULE_SYMBOLS))
endif
ifeq ($(LOCAL_COMPRESS_MODULE_SYMBOLS),true)
$(error Symbol compression not yet supported.)
compress_output := $(intermediates)/COMPRESSED-$(LOCAL_BUILT_MODULE_STEM)
#TODO: write the real $(SOSLIM) rule.
#TODO: define a rule to build TARGET_SYMBOL_FILTER_FILE, and
# make it depend on ALL_ORIGINAL_DYNAMIC_BINARIES.
$(compress_output): $(compress_input) $(TARGET_SYMBOL_FILTER_FILE) | $(ACP)
@echo "target Compress Symbols: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else
# Skip this step.
compress_output := $(compress_input)
endif
###########################################################
## Pre-link
###########################################################
prelink_input := $(compress_output)
# The output of the prelink step is the binary we want to use
# for symbolic debugging; the prelink step may move sections
# around, so we have to use this version.
prelink_output := $(LOCAL_UNSTRIPPED_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_BUILT_MODULE_STEM)
ifeq ($(LOCAL_PRELINK_MODULE),true)
$(prelink_output): $(prelink_input) $(TARGET_PRELINKER_MAP) $(APRIORI)
$(transform-to-prelinked)
else
# Don't prelink the binary, just copy it. We can't skip this step
# because people always expect a copy of the binary to appear
# in the UNSTRIPPED directory.
#
# If the binary we're copying is acp or a prerequisite,
# use cp(1) instead.
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(prelink_output): $(prelink_input) | $(ACP)
@echo "target Non-prelinked: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else
$(prelink_output): $(prelink_input)
@echo "target Non-prelinked: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-cp)
endif
endif
###########################################################
## Strip
###########################################################
strip_input := $(prelink_output)
strip_output := $(LOCAL_BUILT_MODULE)
ifeq ($(strip $(LOCAL_STRIP_MODULE)),)
LOCAL_STRIP_MODULE := $(strip $(TARGET_STRIP_MODULE))
endif
ifeq ($(LOCAL_STRIP_MODULE),true)
# Strip the binary
$(strip_output): $(strip_input) | $(SOSLIM)
$(transform-to-stripped)
else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.
#
# If the binary we're copying is acp or a prerequisite,
# use cp(1) instead.
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(strip_output): $(strip_input) | $(ACP)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else
$(strip_output): $(strip_input)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-cp)
endif
endif # LOCAL_STRIP_MODULE
$(cleantarget): PRIVATE_CLEAN_FILES := \
$(PRIVATE_CLEAN_FILES) \
$(linked_module) \
$(compress_output) \
$(prelink_output)

278
core/envsetup.mk Normal file
View File

@ -0,0 +1,278 @@
# Variables we check:
# HOST_BUILD_TYPE = { release debug }
# TARGET_SIMULATOR = { true <null> }
# TARGET_BUILD_TYPE = { release debug }
# and we output a bunch of variables, see the case statement at
# the bottom for the full list
# OUT_DIR is also set to "out" if it's not already set.
# this allows you to set it to somewhere else if you like
# ---------------------------------------------------------------
# If you update the build system such that the environment setup
# or buildspec.mk need to be updated, increment this number, and
# people who haven't re-run those will have to do so before they
# can build. Make sure to also update the corresponding value in
# buildspec.mk.default and envsetup.sh.
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 8
# ---------------------------------------------------------------
# Set up configuration for host machine. We don't do cross-
# compiles except for arm, so the HOST is whatever we are
# running on
UNAME := $(shell uname -sm)
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
endif
ifneq (,$(findstring Darwin,$(UNAME)))
HOST_OS := darwin
endif
ifneq (,$(findstring Macintosh,$(UNAME)))
HOST_OS := darwin
endif
ifneq (,$(findstring CYGWIN,$(UNAME)))
HOST_OS := windows
endif
ifneq ($(USE_MINGW),)
HOST_OS := windows
endif
ifeq ($(HOST_OS),)
$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
endif
# HOST_ARCH
ifneq (,$(findstring 86,$(UNAME)))
HOST_ARCH := x86
endif
ifneq (,$(findstring Power,$(UNAME)))
HOST_ARCH := ppc
endif
ifeq ($(HOST_ARCH),)
$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!)
endif
# the host build defaults to release, and it must be release or debug
ifeq ($(HOST_BUILD_TYPE),)
HOST_BUILD_TYPE := release
endif
ifneq ($(HOST_BUILD_TYPE),release)
ifneq ($(HOST_BUILD_TYPE),debug)
$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)')
endif
endif
# This is the standard way to name a directory containing prebuilt host
# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
ifeq ($(HOST_OS),windows)
HOST_PREBUILT_TAG := windows
else
HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_ARCH)
endif
# ---------------------------------------------------------------
# Set up configuration for target machine.
# The following must be set:
# TARGET_OS = { linux }
# TARGET_ARCH = { arm | x86 }
# TARGET_ARCH==arm means that it's not the simulator, and the others
# mean it is the simulator.
# if we're build the simulator, HOST_* is TARGET_* (except for BUILD_TYPE)
# otherwise it's arm-linux
ifeq ($(TARGET_SIMULATOR),true)
ifneq ($(HOST_OS),linux)
$(error TARGET_SIMULATOR=true is only supported under Linux)
endif
TARGET_ARCH := $(HOST_ARCH)
TARGET_OS := $(HOST_OS)
else
TARGET_ARCH := arm
TARGET_OS := linux
endif
# the target build type defaults to release
ifneq ($(TARGET_BUILD_TYPE),debug)
TARGET_BUILD_TYPE := release
endif
# This is the standard way to name a directory containing prebuilt target
# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
ifeq ($(TARGET_SIMULATOR),true)
TARGET_PREBUILT_TAG := $(TARGET_OS)-$(TARGET_ARCH)
else
TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
endif
# the product defaults to sooner on ARM and nothing on sim
ifeq ($(TARGET_PRODUCT),)
ifeq ($(TARGET_SIMULATOR),true)
TARGET_PRODUCT := sim
else
TARGET_PRODUCT := sooner
endif
endif
# ---------------------------------------------------------------
# figure out the output directories
ifeq (,$(strip $(OUT_DIR)))
OUT_DIR := $(TOPDIR)out
endif
DEBUG_OUT_DIR := $(OUT_DIR)/debug
# Move the host or target under the debug/ directory
# if necessary.
TARGET_OUT_ROOT_release := $(OUT_DIR)/target
TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target
TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE))
HOST_OUT_ROOT_release := $(OUT_DIR)/host
HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_ARCH)
HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_ARCH)
HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
ifeq ($(TARGET_SIMULATOR),true)
# Any arch- or os-specific parts of the simulator (everything
# under product/) are actually host-dependent.
# But, the debug type is controlled by TARGET_BUILD_TYPE and not
# HOST_BUILD_TYPE.
TARGET_PRODUCT_OUT_ROOT := $(HOST_OUT_$(TARGET_BUILD_TYPE))/product
else
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
endif
TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_PRODUCT)
OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
HOST_OUT_EXECUTABLES:= $(HOST_OUT)/bin
HOST_OUT_SHARED_LIBRARIES:= $(HOST_OUT)/lib
HOST_OUT_JAVA_LIBRARIES:= $(HOST_OUT)/framework
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
HOST_OUT_HEADERS:= $(HOST_OUT_INTERMEDIATES)/include
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
HOST_OUT_STATIC_LIBRARIES := $(HOST_OUT_INTERMEDIATE_LIBRARIES)
HOST_OUT_NOTICE_FILES:=$(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include
TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
TARGET_OUT := $(PRODUCT_OUT)/system
TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin
TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin
TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib
TARGET_OUT_JAVA_LIBRARIES:= $(TARGET_OUT)/framework
TARGET_OUT_APPS:= $(TARGET_OUT)/app
TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
TARGET_OUT_ETC := $(TARGET_OUT)/etc
TARGET_OUT_STATIC_LIBRARIES:= $(TARGET_OUT_INTERMEDIATES)/lib
TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_DATA := $(PRODUCT_OUT)/data
TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)
TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES)
TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_JAVA_LIBRARIES)
TARGET_OUT_DATA_APPS:= $(TARGET_OUT_DATA)/app
TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
TARGET_OUT_DATA_STATIC_LIBRARIES:= $(TARGET_OUT_STATIC_LIBRARIES)
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin
TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
TARGET_ROOT_OUT := $(PRODUCT_OUT)/root
TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin
TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/recovery
TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
COMMON_MODULE_CLASSES := JAVA_LIBRARIES NOTICE_FILES
ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist
endif
# ---------------------------------------------------------------
# the setpath shell function in envsetup.sh uses this to figure out
# what to add to the path given the config we have chosen.
ifeq ($(CALLED_FROM_SETUP),true)
ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES)
ifeq ($(TARGET_SIMULATOR),true)
ABP:=$(ABP):$(TARGET_OUT_EXECUTABLES)
else
# this should be copied to HOST_OUT_EXECUTABLES instead
ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin
endif
ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
# The "dumpvar" stuff lets you say something like
#
# CALLED_FROM_SETUP=true \
# make -f config/envsetup.make dumpvar-TARGET_OUT
# or
# CALLED_FROM_SETUP=true \
# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
#
# The plain (non-abs) version just dumps the value of the named variable.
# The "abs" version will treat the variable as a path, and dumps an
# absolute path to it.
#
dumpvar_goals := \
$(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
ifdef dumpvar_goals
ifneq ($(words $(dumpvar_goals)),1)
$(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
endif
# If the goal is of the form "dumpvar-abs-VARNAME", then
# treat VARNAME as a path and return the absolute path to it.
absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
ifdef absolute_dumpvar
dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
DUMPVAR_VALUE := $(PWD)/$($(dumpvar_goals))
dumpvar_target := dumpvar-abs-$(dumpvar_goals)
else
DUMPVAR_VALUE := $($(dumpvar_goals))
dumpvar_target := dumpvar-$(dumpvar_goals)
endif
.PHONY: $(dumpvar_target)
$(dumpvar_target):
@echo $(DUMPVAR_VALUE)
endif # dumpvar_goals
endif # CALLED_FROM_SETUP

28
core/executable.mk Normal file
View File

@ -0,0 +1,28 @@
###########################################################
## Standard rules for building an executable file.
##
## Additional inputs from base_rules.make:
## None.
###########################################################
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := EXECUTABLES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
endif
# Executables are not prelinked. If we decide to start prelinking
# them, the LOCAL_PRELINK_MODULE definitions should be moved from
# here and shared_library.make and consolidated in dynamic_binary.make.
LOCAL_PRELINK_MODULE := false
include $(BUILD_SYSTEM)/dynamic_binary.mk
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
$(transform-o-to-static-executable)
else
$(linked_module): $(TARGET_CRTBEGIN_DYNAMIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
$(transform-o-to-executable)
endif

25
core/filter_symbols.sh Normal file
View File

@ -0,0 +1,25 @@
NM=$1
shift
PREFIX=$1
shift
SUFFIX=$1
shift
while test "$1" != ""
do
$NM -g -fp $1 | while read -a line
do
type=${line[1]}
# if [[ "$type" != "V" && "$type" != "U" ]]; then
#if [[ "$type" != "W" && "$type" != "V" && "$type" != "U" ]]; then
echo "$PREFIX${line[0]}$SUFFIX # ${line[1]}"
#fi
done
shift
done

10
core/find-jdk-tools-jar.sh Executable file
View File

@ -0,0 +1,10 @@
if [[ "x$ANDROID_JAVA_HOME" != x && -e $ANDROID_JAVA_HOME/lib/tools.jar ]] ; then
echo $ANDROID_JAVA_HOME/lib/tools.jar
else
JAVAC=$(which javac)
while [ -L $JAVAC ] ; do
LSLINE=$(ls -l $JAVAC)
JAVAC=$(echo -n $LSLINE | sed -e "s/.* -> //")
done
echo $JAVAC | sed -e "s:\(.*\)/bin/javac.*:\\1/lib/tools.jar:"
fi

20
core/host_executable.mk Normal file
View File

@ -0,0 +1,20 @@
###########################################################
## Standard rules for building an executable file.
##
## Additional inputs from base_rules.make:
## None.
###########################################################
LOCAL_IS_HOST_MODULE := true
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := EXECUTABLES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
endif
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
$(transform-host-o-to-executable)
$(PRIVATE_POST_PROCESS_COMMAND)

29
core/host_java_library.mk Normal file
View File

@ -0,0 +1,29 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Standard rules for building a host java library.
#
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_IS_HOST_MODULE := true
LOCAL_BUILT_MODULE_STEM := javalib.jar
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): $(java_sources) $(java_resource_sources) $(full_java_lib_deps)
$(transform-host-java-to-package)

18
core/host_prebuilt.mk Normal file
View File

@ -0,0 +1,18 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_IS_HOST_MODULE := true
include $(BUILD_MULTI_PREBUILT)

View File

@ -0,0 +1,29 @@
###########################################################
## Standard rules for building a normal shared library.
##
## Additional inputs from base_rules.make:
## None.
##
## LOCAL_MODULE_SUFFIX will be set for you.
###########################################################
LOCAL_IS_HOST_MODULE := true
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
endif
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
# Put the built modules of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $(HOST_OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-o-to-shared-lib)

View File

@ -0,0 +1,23 @@
###########################################################
## Standard rules for building a static library.
##
## Additional inputs from base_rules.make:
## None.
##
## LOCAL_MODULE_SUFFIX will be set for you.
###########################################################
LOCAL_IS_HOST_MODULE := true
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := .a
endif
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE): $(all_objects)
$(transform-host-o-to-static-lib)

115
core/java.mk Normal file
View File

@ -0,0 +1,115 @@
# Requires:
# LOCAL_MODULE_SUFFIX
# LOCAL_MODULE_CLASS
# all_res_assets
# Make sure there's something to build.
# It's possible to build a package that doesn't contain any classes.
ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)))
$(error $(LOCAL_PATH): Target java module does not define any source or resource files)
endif
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
$(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
else
ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
$(error $(LOCAL_PATH): Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
else
LOCAL_JAVA_LIBRARIES := android_stubs_$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
endif
endif
else
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES := core ext framework $(LOCAL_JAVA_LIBRARIES)
endif
endif
LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
ifeq ($(LOCAL_BUILT_MODULE_STEM),)
$(error $(LOCAL_PATH): Target java template must define LOCAL_BUILT_MODULE_STEM)
endif
ifeq ($(LOCAL_BUILT_MODULE_STEM),classes.jar)
$(error LOCAL_BUILT_MODULE_STEM may not be "classes.jar")
endif
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
# We use intermediates.COMMON because the classes.jar/.dex files will be
# common even if LOCAL_BUILT_MODULE isn't.
#
# Override some target variables that base_rules set up for us.
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
# Since we're using intermediates.COMMON, make sure that it gets cleaned
# properly.
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
# If the module includes java code (i.e., it's not framework-res), compile it.
full_classes_jar :=
built_dex :=
ifneq (,$(strip $(all_java_sources)))
# If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller,
# full_classes_jar will be the same module as LOCAL_BUILT_MODULE.
# Otherwise, the caller will define it as a prerequisite of
# LOCAL_BUILT_MODULE, so it will inherit the necessary PRIVATE_*
# variable definitions.
#
# This intentionally depends on java_sources, not all_java_sources.
# Deps for generated source files must be handled separately,
# via deps on the target that generates the sources.
full_classes_jar := $(intermediates.COMMON)/classes.jar
$(full_classes_jar): $(java_sources) $(full_java_lib_deps)
$(transform-java-to-classes.jar)
built_dex := $(intermediates.COMMON)/classes.dex
# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
# will work even when intermediates != intermediates.COMMON.
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(built_dex): $(full_classes_jar) $(DX)
$(transform-classes.jar-to-dex)
ifneq ($(GENERATE_DEX_DEBUG),)
$(install-dex-debug)
endif
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
$(findbugs_xml) : PRIVATE_JAR_FILE := $(full_classes_jar)
$(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
$(call normalize-path-list,$(filter %.jar,\
$(full_java_libs)))))
# We can't depend directly on full_classes_jar because the PRIVATE_
# vars won't be set up correctly.
$(findbugs_xml) : $(LOCAL_BUILT_MODULE)
@echo Findbugs: $@
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
$(PRIVATE_AUXCLASSPATH) \
$(PRIVATE_JAR_FILE) \
> $@
ALL_FINDBUGS_FILES += $(findbugs_xml)
findbugs_html := $(PRODUCT_OUT)/findbugs/$(LOCAL_MODULE).html
$(findbugs_html) : PRIVATE_XML_FILE := $(findbugs_xml)
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
$(findbugs_html) : $(findbugs_xml)
@mkdir -p $(dir $@)
@echo UnionBugs: $@
$(hide) prebuilt/common/findbugs/bin/unionBugs $(PRIVATE_XML_FILE) \
| prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
> $@
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
endif

47
core/java_library.mk Normal file
View File

@ -0,0 +1,47 @@
###########################################################
## Standard rules for building a java library.
##
###########################################################
ifdef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): Host java libraries must use BUILD_HOST_JAVA_LIBRARY)
endif
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
ifneq (,$(LOCAL_ASSET_DIR))
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_ASSET_DIR)
endif
ifneq (,$(LOCAL_RESOURCE_DIR))
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_RESOURCE_DIR)
endif
#xxx base_rules.mk looks at this
all_res_assets :=
LOCAL_BUILT_MODULE_STEM := javalib.jar
#################################
include $(BUILD_SYSTEM)/java.mk
#################################
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex or resources; all we want are the .class files.
$(LOCAL_BUILT_MODULE): $(full_classes_jar)
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) | $(AAPT)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY

27
core/key_char_map.mk Normal file
View File

@ -0,0 +1,27 @@
###########################################################
## Standard rules for building an executable file.
##
## Additional inputs from base_rules.make:
## None.
###########################################################
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := KEYCHARS
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := .bin
endif
LOCAL_MODULE := $(LOCAL_SRC_FILES)
include $(BUILD_SYSTEM)/base_rules.mk
full_src_files := $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES))
$(LOCAL_BUILT_MODULE) : PRIVATE_SRC_FILES := $(full_src_files)
$(LOCAL_BUILT_MODULE) : $(full_src_files) $(KCM)
@echo KeyCharMap: $@
@mkdir -p $(dir $@)
$(hide) $(KCM) $(PRIVATE_SRC_FILES) $@

669
core/main.mk Normal file
View File

@ -0,0 +1,669 @@
# Use bash, not whatever shell somebody has installed as /bin/sh
SHELL := /bin/bash
# this turns off the suffix rules built into make
.SUFFIXES:
# If a rule fails, delete $@.
.DELETE_ON_ERROR:
# Figure out where we are.
#TOP := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
#TOP := $(patsubst %/,%,$(TOP))
# TOPDIR is the normal variable you should use, because
# if we are executing relative to the current directory
# it can be "", whereas TOP must be "." which causes
# pattern matching probles when make strips off the
# trailing "./" from paths in various places.
#ifeq ($(TOP),.)
#TOPDIR :=
#else
#TOPDIR := $(TOP)/
#endif
# check for broken versions of make
ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") \>= 3.81))
$(warning ********************************************************************************)
$(warning * You are using version $(MAKE_VERSION) of make.)
$(warning * You must upgrade to version 3.81 or greater.)
$(warning * see file://$(shell pwd)/docs/development-environment/machine-setup.html)
$(warning ********************************************************************************)
$(error stopping)
endif
TOP := .
TOPDIR :=
BUILD_SYSTEM := $(TOPDIR)build/core
# Set up various standard variables based on configuration
# and host information.
include $(BUILD_SYSTEM)/config.mk
# This allows us to force a clean build - included after the config.make
# environment setup is done, but before we generate any dependencies. This
# file does the rm -rf inline so the deps which are all done below will
# be generated correctly
include $(BUILD_SYSTEM)/cleanbuild.mk
ifneq ($(HOST_OS),windows)
ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
# check for a case sensitive file system
ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
echo a > $(OUT_DIR)/casecheck.txt; \
echo B > $(OUT_DIR)/CaseCheck.txt; \
cat $(OUT_DIR)/casecheck.txt))
$(warning ************************************************************)
$(warning You are building on a case-insensitive filesystem.)
$(warning Please move your source tree to a case-sensitive filesystem.)
$(warning ************************************************************)
$(error Case-insensitive filesystems not supported)
endif
endif
endif
# Make sure that there are no spaces in the absolute path; the
# build system can't deal with them.
ifneq ($(words $(shell pwd)),1)
$(warning ************************************************************)
$(warning You are building in a directory whose absolute path contains)
$(warning a space character:)
$(warning $(space))
$(warning "$(shell pwd)")
$(warning $(space))
$(warning Please move your source tree to a path that does not contain)
$(warning any spaces.)
$(warning ************************************************************)
$(error Directory names containing spaces not supported)
endif
# Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk
# These are the modifier targets that don't do anything themselves, but
# change the behavior of the build.
# (must be defined before including definitions.make)
INTERNAL_MODIFIER_TARGETS := showcommands
# This is the default target. It must be the first declared target
DEFAULT_TARGET := droid
.PHONY: $(DEFAULT_TARGET)
$(DEFAULT_TARGET):
# Bring in standard build system definitions.
include $(BUILD_SYSTEM)/definitions.mk
###
### DO NOT USE THIS AS AN EXAMPLE FOR ANYTHING ELSE;
### ONLY 'user'/'userdebug'/'tests'/'sdk' GOALS
### SHOULD REFER TO MAKECMDGOALS.
###
## user/userdebug ##
user_goal := $(filter userdebug user,$(MAKECMDGOALS))
enable_target_debugging := true
ifneq (,$(user_goal))
# Make sure that exactly one of {userdebug,user} has been specified,
# and that no non-INTERNAL_MODIFIER_TARGETS goals have been specified.
non_user_goals := \
$(filter-out $(INTERNAL_MODIFIER_TARGETS) $(user_goal),$(MAKECMDGOALS))
ifneq ($(words $(non_user_goals) $(user_goal)),1)
$(error The '$(word 1,$(user_goal))' target may not be specified with any other targets)
endif
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
override_build_tags := user
ifeq ($(user_goal),userdebug)
# Pick up some extra useful tools
override_build_tags += debug
else
# Disable debugging in plain user builds.
enable_target_debugging :=
endif
# TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
# Also, remove the corresponding block in config/product_config.make.
ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
WITH_DEXPREOPT := true
endif
else # !user_goal
# Turn on checkjni for non-user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
# Set device insecure for non-user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
endif # !user_goal
ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
# Include the debugging/testing OTA keys in this build.
INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
endif # !enable_target_debugging
## tests ##
ifneq ($(filter tests,$(MAKECMDGOALS)),)
ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
$(error The 'tests' target may not be specified with any other targets)
endif
override_build_tags := eng debug user development tests
endif
## sdk ##
ifneq ($(filter sdk,$(MAKECMDGOALS)),)
ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
$(error The 'sdk' target may not be specified with any other targets)
endif
override_build_tags := development
ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
ifeq "" "$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES))"
# Install an apns-conf.xml file if one's not already being installed.
PRODUCT_COPY_FILES += development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
endif
else # !sdk
# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
endif
ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
# enable vm tracing in files for now to help track
# the cause of ANRs in the content process
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
# non-empty if that module should be installed in /system.
# For most goals, anything tagged with "eng"/"debug"/"user" should
# be installed in /system.
define should-install-to-system
$(filter eng debug user,$(1))
endef
ifneq (,$(filter sdk,$(MAKECMDGOALS)))
# For the sdk goal, anything with the "samples" tag should be
# installed in /data even if that module also has "eng"/"debug"/"user".
define should-install-to-system
$(if $(filter samples,$(1)),,$(filter eng debug user development,$(1)))
endef
endif
ifneq (,$(filter user,$(MAKECMDGOALS)))
# For the user goal, everything should be installed in /system.
define should-install-to-system
true
endef
endif
# If all they typed was make showcommands, we'll actually build
# the default target.
ifeq ($(MAKECMDGOALS),showcommands)
.PHONY: showcommands
showcommands: $(DEFAULT_TARGET)
endif
# These targets are going to delete stuff, don't bother including
# the whole directory tree if that's all we're going to do
ifeq ($(MAKECMDGOALS),clean)
dont_bother := true
endif
ifeq ($(MAKECMDGOALS),clobber)
dont_bother := true
endif
ifeq ($(MAKECMDGOALS),dataclean)
dont_bother := true
endif
ifeq ($(MAKECMDGOALS),installclean)
dont_bother := true
endif
# Bring in all modules that need to be built.
ifneq ($(dont_bother),true)
subdir_makefiles :=
ifeq ($(HOST_OS),windows)
SDK_ONLY := true
endif
ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
SDK_ONLY := true
endif
ifeq ($(SDK_ONLY),true)
subdirs := \
build/libs/host \
dalvik/dexdump \
dalvik/libdex \
dalvik/tools/dmtracedump \
development/emulator/mksdcard \
development/tools/activitycreator \
development/tools/line_endings \
external/expat \
external/libpng \
external/qemu \
external/sqlite/dist \
external/zlib \
frameworks/base/libs/utils \
frameworks/base/tools/aapt \
frameworks/base/tools/aidl \
system/core/adb \
system/core/fastboot \
system/core/libcutils \
system/core/liblog \
system/core/libzipfile
# The following can only be built if "javac" is available.
# This check is used when building parts of the SDK under Cygwin.
ifneq (,$(shell which javac 2>/dev/null))
$(warning sdk-only: javac available.)
subdirs += \
build/tools/signapk \
build/tools/zipalign \
dalvik/dx \
dalvik/libcore \
development/apps \
development/tools/androidprefs \
development/tools/apkbuilder \
development/tools/jarutils \
development/tools/layoutlib_utils \
development/tools/ninepatch \
development/tools/sdkstats \
frameworks/base \
frameworks/base/tools/layoutlib \
packages
else
$(warning sdk-only: javac not available.)
endif
# Exclude tools/acp when cross-compiling windows under linux
ifeq ($(findstring Linux,$(UNAME)),)
subdirs += build/tools/acp
endif
else # !SDK_ONLY
ifeq ($(BUILD_TINY_ANDROID), true)
# TINY_ANDROID is a super-minimal build configuration, handy for board
# bringup and very low level debugging
INTERNAL_DEFAULT_DOCS_TARGETS :=
subdirs := \
system/core \
external/zlib \
build/tools \
tools/kcm \
external/yaffs2
else # !BUILD_TINY_ANDROID
#
# Typical build; include any Android.mk files we can find.
#
INTERNAL_DEFAULT_DOCS_TARGETS := framework-docs
subdirs := $(TOP)
FULL_BUILD := true
endif # !BUILD_TINY_ANDROID
endif # !SDK_ONLY
# Can't use first-makefiles-under here because
# --mindepth=2 makes the prunes not work.
subdir_makefiles += \
$(shell build/tools/findleaves.sh \
--prune="./vendor" --prune="./out" $(subdirs) Android.mk)
# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_PRODUCT)
# or under vendor/*/$(TARGET_PRODUCT). Search in both places, but
# make sure only one exists.
# Real boards should always be associated with an OEM vendor.
board_config_mk := \
$(strip $(wildcard \
$(SRC_TARGET_DIR)/board/$(TARGET_PRODUCT)/BoardConfig.mk \
vendor/*/$(TARGET_PRODUCT)/BoardConfig.mk \
))
ifeq ($(board_config_mk),)
$(error No config file found for TARGET_PRODUCT $(TARGET_PRODUCT))
endif
ifneq ($(words $(board_config_mk)),1)
$(error Multiple board config files for TARGET_PRODUCT $(TARGET_PRODUCT): $(board_config_mk))
endif
include $(board_config_mk)
TARGET_PRODUCT_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
board_config_mk :=
ifdef CUSTOM_PKG
$(info ***************************************************************)
$(info ***************************************************************)
$(error CUSTOM_PKG is obsolete; use CUSTOM_MODULES)
$(info ***************************************************************)
$(info ***************************************************************)
endif
ifdef CUSTOM_TARGETS
$(info ***************************************************************)
$(info ***************************************************************)
$(error CUSTOM_TARGETS is obsolete; use CUSTOM_MODULES)
$(info ***************************************************************)
$(info ***************************************************************)
endif
#
# Include all of the makefiles in the system
#
ifneq ($(ONE_SHOT_MAKEFILE),)
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.
include $(ONE_SHOT_MAKEFILE)
# Change CUSTOM_MODULES to include only modules that were
# defined by this makefile; this will install all of those
# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
# so that the modules will be installed in the same place they
# would have been with a normal make.
CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
FULL_BUILD :=
INTERNAL_DEFAULT_DOCS_TARGETS :=
# Stub out the notice targets, which probably aren't defined
# when using ONE_SHOT_MAKEFILE.
NOTICE-HOST-%: ;
NOTICE-TARGET-%: ;
else
include $(subdir_makefiles)
endif
# -------------------------------------------------------------------
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Fix up CUSTOM_MODULES to refer to installed files rather than
# just bare module names. Leave unknown modules alone in case
# they're actually full paths to a particular file.
known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
CUSTOM_MODULES := \
$(call module-installed-files,$(known_custom_modules)) \
$(unknown_custom_modules)
# -------------------------------------------------------------------
# Define dependencies for modules that require other modules.
# This can only happen now, after we've read in all module makefiles.
#
# TODO: deal with the fact that a bare module name isn't
# unambiguous enough. Maybe declare short targets like
# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
# BUG: the system image won't know to depend on modules that are
# brought in as requirements of other modules.
define add-required-deps
$(1): $(2)
endef
$(foreach m,$(ALL_MODULES), \
$(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
$(if $(r), \
$(eval r := $(call module-installed-files,$(r))) \
$(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
) \
)
m :=
r :=
add-required-deps :=
# -------------------------------------------------------------------
# Figure out our module sets.
# Of the modules defined by the component makefiles,
# determine what we actually want to build.
# If a module has the "restricted" tag on it, it
# poisons the rest of the tags and shouldn't appear
# on any list.
Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
$(ALL_BUILT_MODULES) \
$(CUSTOM_MODULES))
ifdef FULL_BUILD
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
# by product_config.make.
user_PACKAGES := $(call module-installed-files, \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
ifeq (0,1)
$(info user packages for $(TARGET_PRODUCT) ($(INTERNAL_PRODUCT)):)
$(foreach p,$(user_PACKAGES),$(info : $(p)))
$(error done)
endif
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
# requested by the product, because we probably won't have rules
# to build them.
user_PACKAGES :=
endif
# Use tags to get the non-APPS user modules. Use the product
# definition files to get the APPS user modules.
user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
user_MODULES := $(user_MODULES) $(user_PACKAGES)
eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
# Don't include any GNU targets in the SDK. It's ok (and necessary)
# to build the host tools, but nothing that's going to be installed
# on the target (including static libraries).
all_development_MODULES := \
$(sort $(call get-tagged-modules,development,restricted))
target_gnu_MODULES := \
$(filter \
$(TARGET_OUT_INTERMEDIATES)/% \
$(TARGET_OUT)/% \
$(TARGET_OUT_DATA)/%, \
$(sort $(call get-tagged-modules,gnu)))
#$(info Removing from development:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
development_MODULES := \
$(filter-out $(target_gnu_MODULES),$(all_development_MODULES))
droid_MODULES := $(sort $(Default_MODULES) \
$(eng_MODULES) \
$(debug_MODULES) \
$(user_MODULES) \
$(all_development_MODULES))
# The list of everything that's not on droid_MODULES.
# Also skip modules tagged as "restricted", which are
# never installed unless explicitly mentioned in
# CUSTOM_MODULES.
nonDroid_MODULES := $(sort $(call get-tagged-modules,\
$(ALL_MODULE_TAGS),\
eng debug user development restricted))
# THIS IS A TOTAL HACK AND SHOULD NOT BE USED AS AN EXAMPLE
modules_to_build := $(droid_MODULES)
ifneq ($(override_build_tags),)
modules_to_build := $(sort $(Default_MODULES) \
$(foreach tag,$(override_build_tags),$($(tag)_MODULES)))
#$(error skipping modules $(filter-out $(modules_to_build),$(Default_MODULES) $(droid_MODULES)))
endif
# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
# Filter out (do not install) any overridden packages.
overridden_packages := $(call get-package-overrides,$(modules_to_build))
ifdef overridden_packages
# old_modules_to_build := $(modules_to_build)
modules_to_build := \
$(filter-out $(foreach p,$(overridden_packages),%/$(p) %/$(p).apk), \
$(modules_to_build))
endif
#$(error filtered out $(filter-out $(modules_to_build),$(old_modules_to_build)))
# config/Makefile contains extra stuff that we don't want to pollute this
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further
# extends ALL_DEFAULT_INSTALLED_MODULES.
ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_build)
include $(BUILD_SYSTEM)/Makefile
modules_to_build := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
ALL_DEFAULT_INSTALLED_MODULES :=
endif # dont_bother
# -------------------------------------------------------------------
# This is used to to get the ordering right, you can also use these,
# but they're considered undocumented, so don't complain if their
# behavior changes.
.PHONY: prebuilt
prebuilt: $(ALL_PREBUILT) report_config
# An internal target that depends on all copied headers
# (see copy_headers.make). Other targets that need the
# headers to be copied first can depend on this target.
.PHONY: all_copied_headers
all_copied_headers: ;
$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
# All the droid stuff, in directories
.PHONY: files
files: report_config prebuilt $(modules_to_build) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
# -------------------------------------------------------------------
.PHONY: ramdisk
ramdisk: $(INSTALLED_RAMDISK_TARGET) report_config
.PHONY: userdataimage
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET) report_config
.PHONY: bootimage
bootimage: $(INSTALLED_BOOTIMAGE_TARGET) report_config
ifeq ($(BUILD_TINY_ANDROID), true)
INSTALLED_RECOVERYIMAGE_TARGET :=
endif
# Build files and then package it into the rom formats
.PHONY: droidcore
droidcore: report_config files \
systemimage \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INTERNAL_DEFAULT_DOCS_TARGETS)
# The actual files built by the droidcore target changes depending
# on MAKECMDGOALS. THIS IS A TOTAL HACK AND SHOULD NOT BE USED AS AN EXAMPLE
.PHONY: droid user userdebug tests
droid user userdebug tests: droidcore
$(call dist-for-goals,user userdebug droid, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
$(SYMBOLS_ZIP) \
$(APPS_ZIP) \
$(HOST_OUT_EXECUTABLES)/adb$(HOST_EXECUTABLE_SUFFIX) \
$(INTERNAL_EMULATOR_PACKAGE_TARGET) \
$(PACKAGE_STATS_FILE) \
$(INSTALLED_FILES_FILE) \
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
)
# Tests are installed in userdata.img; copy it for "make tests dist".
# Also copy a zip of the contents of userdata.img, so that people can
# easily extract a single .apk.
$(call dist-for-goals,tests, \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(BUILT_TESTS_ZIP_PACKAGE) \
)
.PHONY: docs
docs: $(ALL_DOCS)
.PHONY: sdk
ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
sdk: report_config $(ALL_SDK_TARGETS)
$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
# Also do the targets not built by "make droid".
.PHONY: all
all: droid $(nonDroid_MODULES) docs sdk
.PHONY: clean
dirs_to_clean := \
$(PRODUCT_OUT) \
$(TARGET_COMMON_OUT_ROOT) \
$(HOST_OUT) \
$(HOST_COMMON_OUT_ROOT)
clean:
@for dir in $(dirs_to_clean) ; do \
echo "Cleaning $$dir..."; \
rm -rf $$dir; \
done
@echo "Clean."; \
.PHONY: clobber
clobber:
@rm -rf $(OUT_DIR)
@echo "Entire build directory removed."
.PHONY: dataclean
dataclean:
@rm -rf $(PRODUCT_OUT)/data/*
@rm -rf $(PRODUCT_OUT)/data-qemu/*
@rm -rf $(PRODUCT_OUT)/userdata-qemu.img
@echo "Deleted emulator userdata images."
.PHONY: installclean
# Deletes all of the files that change between different build types,
# like "make user" vs. "make sdk". This lets you work with different
# build types without having to do a full clean each time. E.g.:
#
# $ make -j8 all
# $ make installclean
# $ make -j8 user
# $ make installclean
# $ make -j8 sdk
#
installclean: dataclean
$(hide) rm -rf ./$(PRODUCT_OUT)/system
$(hide) rm -rf ./$(PRODUCT_OUT)/recovery
$(hide) rm -rf ./$(PRODUCT_OUT)/data
$(hide) rm -rf ./$(PRODUCT_OUT)/root
$(hide) rm -rf ./$(PRODUCT_OUT)/obj/NOTICE_FILES
@# Remove APPS because they may contain the wrong resources.
$(hide) rm -rf ./$(PRODUCT_OUT)/obj/APPS
$(hide) rm -rf ./$(HOST_OUT)/obj/NOTICE_FILES
$(hide) rm -rf ./$(HOST_OUT)/sdk
$(hide) rm -rf ./$(PRODUCT_OUT)/obj/PACKAGING
$(hide) rm -f ./$(PRODUCT_OUT)/*.img
$(hide) rm -f ./$(PRODUCT_OUT)/*.zip
$(hide) rm -f ./$(PRODUCT_OUT)/*.txt
$(hide) rm -f ./$(PRODUCT_OUT)/*.xlb
@echo "Deleted images and staging directories."
#xxx scrape this from ALL_MODULE_NAME_TAGS
.PHONY: modules
modules:
@echo "Available sub-modules:"
@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
sed -e 's/ */\n/g' | sort -u | $(COLUMN)
.PHONY: showcommands
showcommands:
@echo >/dev/null

111
core/multi_prebuilt.mk Normal file
View File

@ -0,0 +1,111 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Save these before they get cleared by CLEAR_VARS.
prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS))
prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS))
prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES)
prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES)
prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
ifndef multi_prebuilt_once
multi_prebuilt_once := true
# $(1): file list
# $(2): IS_HOST_MODULE
# $(3): MODULE_CLASS
# $(4): OVERRIDE_BUILT_MODULE_PATH
# $(5): UNINSTALLABLE_MODULE
# $(6): BUILT_MODULE_STEM
#
# Elements in the file list may be bare filenames,
# or of the form "<modulename>:<filename>".
# If the module name is not specified, the module
# name will be the filename with the suffix removed.
#
define auto-prebuilt-boilerplate
$(if $(filter %: :%,$(1)), \
$(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \
$(foreach t,$(1), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_IS_HOST_MODULE := $(2)) \
$(eval LOCAL_MODULE_CLASS := $(3)) \
$(eval OVERRIDE_BUILT_MODULE_PATH := $(4)) \
$(eval LOCAL_UNINSTALLABLE_MODULE := $(5)) \
$(eval tw := $(subst :, ,$(strip $(t)))) \
$(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \
$(if $(word 2,$(tw)), \
$(eval LOCAL_MODULE := $(word 1,$(tw))) \
$(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
, \
$(eval LOCAL_MODULE := $(basename $(t))) \
$(eval LOCAL_SRC_FILES := $(t)) \
) \
$(if $(6), \
$(eval LOCAL_BUILT_MODULE_STEM := $(6)) \
, \
$(eval LOCAL_BUILT_MODULE_STEM := $(LOCAL_SRC_FILES)) \
) \
$(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
$(eval include $(BUILD_PREBUILT)) \
)
endef
endif # multi_prebuilt_once
$(call auto-prebuilt-boilerplate, \
$(prebuilt_static_libs), \
$(prebuilt_is_host), \
STATIC_LIBRARIES, \
, \
true)
$(call auto-prebuilt-boilerplate, \
$(prebuilt_shared_libs), \
$(prebuilt_is_host), \
SHARED_LIBRARIES, \
$($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES))
$(call auto-prebuilt-boilerplate, \
$(prebuilt_executables), \
$(prebuilt_is_host), \
EXECUTABLES)
$(call auto-prebuilt-boilerplate, \
$(prebuilt_java_libraries), \
$(prebuilt_is_host), \
JAVA_LIBRARIES, \
, \
, \
javalib.jar)
$(call auto-prebuilt-boilerplate, \
$(prebuilt_static_java_libraries), \
$(prebuilt_is_host), \
JAVA_LIBRARIES, \
, \
true, \
javalib.jar)
prebuilt_static_libs :=
prebuilt_shared_libs :=
prebuilt_executables :=
prebuilt_java_libraries :=
prebuilt_static_java_libraries :=
prebuilt_is_host :=

238
core/node_fns.mk Normal file
View File

@ -0,0 +1,238 @@
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Clears a list of variables using ":=".
#
# E.g.,
# $(call clear-var-list,A B C)
# would be the same as:
# A :=
# B :=
# C :=
#
# $(1): list of variable names to clear
#
define clear-var-list
$(foreach v,$(1),$(eval $(v):=))
endef
#
# Copies a list of variables into another list of variables.
# The target list is the same as the source list, but has
# a dotted prefix affixed to it.
#
# E.g.,
# $(call copy-var-list, PREFIX, A B)
# would be the same as:
# PREFIX.A := $(A)
# PREFIX.B := $(B)
#
# $(1): destination prefix
# $(2): list of variable names to copy
#
define copy-var-list
$(foreach v,$(2),$(eval $(strip $(1)).$(v):=$($(v))))
endef
#
# Moves a list of variables into another list of variables.
# The variable names differ by a prefix. After moving, the
# source variable is cleared.
#
# NOTE: Spaces are not allowed around the prefixes.
#
# E.g.,
# $(call move-var-list,SRC,DST,A B)
# would be the same as:
# DST.A := $(SRC.A)
# SRC.A :=
# DST.B := $(SRC.B)
# SRC.B :=
#
# $(1): source prefix
# $(2): destination prefix
# $(3): list of variable names to move
#
define move-var-list
$(foreach v,$(3), \
$(eval $(2).$(v) := $($(1).$(v))) \
$(eval $(1).$(v) :=) \
)
endef
#
# $(1): haystack
# $(2): needle
#
# Guarantees that needle appears at most once in haystack,
# without changing the order of other elements in haystack.
# If needle appears multiple times, only the first occurrance
# will survive.
#
# How it works:
#
# - Stick everything in haystack into a single word,
# with "|||" separating the words.
# - Replace occurrances of "|||$(needle)|||" with "||| |||",
# breaking haystack back into multiple words, with spaces
# where needle appeared.
# - Add needle between the first and second words of haystack.
# - Replace "|||" with spaces, breaking haystack back into
# individual words.
#
empty :=
space := $(empty) $(empty)
define uniq-word
$(strip \
$(if $(filter $(2),$(1)), \
$(eval h := |||$(subst $(space),|||,$(strip $(1)))|||) \
$(eval h := $(subst |||$(strip $(2))|||,|||$(space)|||,$(h))) \
$(eval h := $(word 1,$(h)) $(2) $(wordlist 2,9999,$(h))) \
$(subst |||,$(space),$(h)) \
, \
$(1) \
))
endef
INHERIT_TAG := @inherit:
#
# Walks through the list of variables, each qualified by the prefix,
# and finds instances of words beginning with INHERIT_TAG. Scrape
# off INHERIT_TAG from each matching word, and return the sorted,
# unique set of those words.
#
# E.g., given
# PREFIX.A := A $(INHERIT_TAG)aaa B C
# PREFIX.B := B $(INHERIT_TAG)aaa C $(INHERIT_TAG)bbb D E
# Then
# $(call get-inherited-nodes,PREFIX,A B)
# returns
# aaa bbb
#
# $(1): variable prefix
# $(2): list of variables to check
#
define get-inherited-nodes
$(sort \
$(subst $(INHERIT_TAG),, \
$(filter $(INHERIT_TAG)%, \
$(foreach v,$(2),$($(1).$(v))) \
)))
endef
#
# for each variable ( (prefix + name) * vars ):
# get list of inherited words; if not empty:
# for each inherit:
# replace the first occurrence with (prefix + inherited + var)
# clear the source var so we can't inherit the value twice
#
# $(1): context prefix
# $(2): name of this node
# $(3): list of variable names
#
define _expand-inherited-values
$(foreach v,$(3), \
$(eval ### "Shorthand for the name of the target variable") \
$(eval _eiv_tv := $(1).$(2).$(v)) \
$(eval ### "Get the list of nodes that this variable inherits") \
$(eval _eiv_i := \
$(sort \
$(patsubst $(INHERIT_TAG)%,%, \
$(filter $(INHERIT_TAG)%, $($(_eiv_tv)) \
)))) \
$(foreach i,$(_eiv_i), \
$(eval ### "Make sure that this inherit appears only once") \
$(eval $(_eiv_tv) := \
$(call uniq-word,$($(_eiv_tv)),$(INHERIT_TAG)$(i))) \
$(eval ### "Expand the inherit tag") \
$(eval $(_eiv_tv) := \
$(patsubst $(INHERIT_TAG)$(i),$($(1).$(i).$(v)), \
$($(_eiv_tv)))) \
$(eval ### "Clear the child so DAGs don't create duplicate entries" ) \
$(eval $(1).$(i).$(v) :=) \
$(eval ### "If we just inherited ourselves, it's a cycle.") \
$(if $(filter $(INHERIT_TAG)$(2),$($(_eiv_tv))), \
$(warning Cycle detected between "$(2)" and "$(i)" for context "$(1)") \
$(error import of "$(2)" failed) \
) \
) \
) \
$(eval _eiv_tv :=) \
$(eval _eiv_i :=)
endef
#
# $(1): context prefix
# $(2): makefile representing this node
# $(3): list of node variable names
#
#TODO: keep a debug stack to make error messages more helpful
define _import-node
$(call clear-var-list, $(3))
$(eval include $(2))
$(call copy-var-list, $(1).$(2), $(3))
$(call clear-var-list, $(3))
$(eval $(1).$(2).inherited := \
$(call get-inherited-nodes,$(1).$(2),$(3)))
$(call _import-nodes-inner,$(1),$($(1).$(2).inherited),$(3))
$(call _expand-inherited-values,$(1),$(2),$(3))
$(eval $(1).$(2).inherited :=)
endef
#
# $(1): context prefix
# $(2): list of makefiles representing nodes to import
# $(3): list of node variable names
#
#TODO: Make the "does not exist" message more helpful;
# should print out the name of the file trying to include it.
define _import-nodes-inner
$(foreach _in,$(2), \
$(if $(wildcard $(_in)), \
$(if $($(1).$(_in).seen), \
$(eval ### "skipping already-imported $(_in)") \
, \
$(eval $(1).$(_in).seen := true) \
$(call _import-node,$(1),$(strip $(_in)),$(3)) \
) \
, \
$(error $(1): "$(_in)" does not exist) \
) \
)
endef
#
# $(1): output list variable name, like "PRODUCTS" or "DEVICES"
# $(2): list of makefiles representing nodes to import
# $(3): list of node variable names
#
define import-nodes
$(if \
$(foreach _in,$(2), \
$(eval _node_import_context := _nic.$(1).[[$(_in)]]) \
$(call _import-nodes-inner,$(_node_import_context),$(_in),$(3)) \
$(call move-var-list,$(_node_import_context).$(_in),$(1).$(_in),$(3)) \
$(eval _node_import_context :=) \
$(eval $(1) := $($(1)) $(_in)) \
) \
,)
endef

65
core/notice_files.mk Normal file
View File

@ -0,0 +1,65 @@
###########################################################
## Track NOTICE files
###########################################################
notice_file:=$(shell find $(LOCAL_PATH) -maxdepth 1 -name NOTICE)
ifneq ($(strip $(notice_file)),)
# This relies on the name of the directory in PRODUCT_OUT matching where
# it's installed on the target - i.e. system, data, etc. This does
# not work for root and isn't exact, but it's probably good enough for
# compliance.
# Includes the leading slash
ifdef LOCAL_INSTALLED_MODULE
module_installed_filename := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
else
# This module isn't installable
ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
# Stick the static libraries with the dynamic libraries.
# We can't use xxx_OUT_STATIC_LIBRARIES because it points into
# device-obj or host-obj.
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
else
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# Stick the static java libraries with the regular java libraries.
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
else
$(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
endif # JAVA_LIBRARIES
endif # STATIC_LIBRARIES
endif
# In case it's actually a host file
module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
$(installed_notice_file): $(notice_file)
@echo Notice file: $< -- $@
$(hide) mkdir -p $(dir $@)
$(hide) cat $< >> $@
ifdef LOCAL_INSTALLED_MODULE
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
# libraries so they get installed along with it. Make it an order-only
# dependency so we don't re-install a module when the NOTICE changes.
$(LOCAL_INSTALLED_MODULE): | $(installed_notice_file)
endif
else
# NOTICE file does not exist
installed_notice_file :=
endif
# Create a predictable, phony target to build this notice file.
# Define it even if the notice file doesn't exist so that other
# modules can depend on it.
notice_target := NOTICE-$(if \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
.PHONY: $(notice_target)
$(notice_target): $(installed_notice_file)

259
core/package.mk Normal file
View File

@ -0,0 +1,259 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###########################################################
## Standard rules for building an application package.
##
## Additional inputs from base_rules.make:
## LOCAL_PACKAGE_NAME: The name of the package; the directory
## will be called this.
##
## MODULE, MODULE_PATH, and MODULE_SUFFIX will
## be set for you.
###########################################################
LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
ifeq ($(LOCAL_PACKAGE_NAME),)
$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
endif
LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
ifeq ($(LOCAL_MODULE_TAGS),)
$(error $(LOCAL_PATH): Package modules must define LOCAL_MODULE_TAGS)
endif
#$(warning $(LOCAL_PATH) $(LOCAL_PACKAGE_NAME) $(sort $(LOCAL_MODULE_TAGS)))
ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
endif
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
ifneq ($(strip $(LOCAL_MODULE)),)
$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
endif
LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
# Android packages should use Android resources or assets.
ifneq (,$(LOCAL_JAVA_RESOURCE_DIRS))
$(error $(LOCAL_PATH): Package modules may not set LOCAL_JAVA_RESOURCE_DIRS)
endif
ifneq (,$(LOCAL_JAVA_RESOURCE_FILES))
$(error $(LOCAL_PATH): Package modules may not set LOCAL_JAVA_RESOURCE_FILES)
endif
ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
endif
LOCAL_MODULE_CLASS := APPS
ifeq (,$(LOCAL_ASSET_DIR))
LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
endif
ifeq (,$(LOCAL_RESOURCE_DIR))
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
endif
# this is an app, so add the system libraries to the search path
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
#$(warning Finding assets for $(LOCAL_ASSET_DIR))
all_assets := $(call find-subdir-assets,$(LOCAL_ASSET_DIR))
all_assets := $(addprefix $(LOCAL_ASSET_DIR)/,$(patsubst assets/%,%,$(all_assets)))
all_resources := $(call find-subdir-assets,$(LOCAL_RESOURCE_DIR))
all_resources := $(addprefix $(LOCAL_RESOURCE_DIR)/,$(patsubst res/%,%,$(all_resources)))
all_res_assets := $(strip $(all_assets) $(all_resources))
# If no assets or resources were found, clear the directory variables so
# we don't try to build them.
ifeq (,$(all_assets))
LOCAL_ASSET_DIR:=
endif
ifeq (,$(all_resources))
LOCAL_RESOURCE_DIR:=
R_file_stamp :=
else
# Make sure that R_file_stamp inherits the proper PRIVATE vars.
# If R.stamp moves, be sure to update the framework makefile,
# which has intimate knowledge of its location.
package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON)
R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp
LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
endif
LOCAL_BUILT_MODULE_STEM := package.apk
# The dex files go in the package, so we don't
# want to install them separately for this module.
old_DONT_INSTALL_DEX_FILES := $(DONT_INSTALL_DEX_FILES)
DONT_INSTALL_DEX_FILES := true
#################################
include $(BUILD_SYSTEM)/java.mk
#################################
DONT_INSTALL_DEX_FILES := $(old_DONT_INSTALL_DEX_FILES)
old_DONT_INSTALL_DEX_FILES =
full_android_manifest := $(LOCAL_PATH)/AndroidManifest.xml
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
ifneq ($(all_resources),)
# Since we don't know where the real R.java file is going to end up,
# we need to use another file to stand in its place. We'll just
# copy the generated file to src/R.stamp, which means it will
# have the same contents and timestamp as the actual file.
#
# At the same time, this will copy the R.java file to a central
# 'R' directory to make it easier to add the files to an IDE.
#
#TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of
# $(intermediates.COMMON)/src
ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON))
$(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)")
endif
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
$(intermediates.COMMON)/public_resources.xml
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(AAPT) | $(ACP)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
@rm -f $@
$(create-resource-java-files)
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
-name Manifest.java 2> /dev/null`; do \
dir=`grep package $$GENERATED_MANIFEST_FILE | head -n1 | \
awk '{print $$2}' | tr -d ";" | tr . /`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fpt $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
done;
$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
-name R.java 2> /dev/null`; do \
dir=`grep package $$GENERATED_R_FILE | head -n1 | \
awk '{print $$2}' | tr -d ";" | tr . /`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fpt $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|| exit 31; \
$(ACP) -fpt $$GENERATED_R_FILE $@ || exit 32; \
done; \
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
# Put this module's resources into a PRODUCT-agnositc package that
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
# files.
resource_export_package := $(intermediates.COMMON)/package-export.apk
$(R_file_stamp): $(resource_export_package)
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
# can't know anything about PRODUCT. Clear it out just for this target.
$(resource_export_package): PRODUCT_AAPT_CONFIG :=
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
endif
# Other modules should depend on the BUILT module if
# they want to use this module's R.java file.
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
ifneq ($(full_classes_jar),)
$(full_classes_jar): $(R_file_stamp)
endif
endif # all_resources
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
# We need to explicitly clear this var so that we don't
# inherit the value from whomever caused us to be built.
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
else
# Most packages should link against the resources defined by framework-res.
# Even if they don't have their own resources, they may use framework
# resources.
framework_res_package_export := \
$(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
# We can't depend directly on the export.apk file; it won't get its
# PRIVATE_ vars set up correctly if we do. Instead, depend on the
# corresponding R.stamp file, which lists the export.apk as a dependency.
framework_res_package_export_deps := \
$(dir $(framework_res_package_export))src/R.stamp
$(R_file_stamp): $(framework_res_package_export_deps)
endif
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): $(built_dex)
endif # full_classes_jar
# Get the list of jni libraries to be included in the apk file.
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
jni_shared_libraries := \
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(LOCAL_JNI_SHARED_LIBRARIES)))
# Pick a key to sign the package with. If this package hasn't specified
# an explicit certificate, use the default.
# Secure release builds will have their packages signed after the fact,
# so it's ok for these private keys to be in the clear.
ifeq ($(LOCAL_CERTIFICATE),)
LOCAL_CERTIFICATE := testkey
endif
# If this is not an absolute certificate, assign it to a generic one.
ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
endif
private_key := $(LOCAL_CERTIFICATE).pk8
certificate := $(LOCAL_CERTIFICATE).x509.pem
$(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
endif
ifneq ($(full_classes_jar),)
$(add-dex-to-package)
endif
$(sign-package)
@# Alignment must happen after all other zip operations.
$(align-package)
# Save information about this package
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)

81
core/pathmap.mk Normal file
View File

@ -0,0 +1,81 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# A central place to define mappings to paths, to avoid hard-coding
# them in Android.mk files.
#
# TODO: Allow each project to define stuff like this before the per-module
# Android.mk files are included, so we don't need to have a big central
# list.
#
#
# A mapping from shorthand names to include directories.
#
pathmap_INCL := \
bluez-libs:external/bluez/libs/include \
bluez-utils:external/bluez/utils \
bootloader:bootloader/legacy/include \
corecg:external/skia/include/corecg \
dbus:external/dbus \
frameworks-base:frameworks/base/include \
graphics:external/skia/include/graphics \
libc:bionic/libc/include \
libdrm1:frameworks/base/media/libdrm/mobile1/include \
libdrm2:frameworks/base/media/libdrm/mobile2/include \
libhardware:hardware/libhardware/include \
libhost:build/libs/host/include \
libm:bionic/libm/include \
libnativehelper:dalvik/libnativehelper/include \
libpagemap:system/extras/libpagemap/include \
libril:hardware/ril/include \
libstdc++:bionic/libstdc++/include \
libthread_db:bionic/libthread_db/include \
mkbootimg:system/core/mkbootimg \
recovery:recovery \
system-core:system/core/include
#
# Returns the path to the requested module's include directory,
# relative to the root of the source tree. Does not handle external
# modules.
#
# $(1): a list of modules (or other named entities) to find the includes for
#
define include-path-for
$(foreach n,$(1),$(patsubst $(n):%,%,$(filter $(n):%,$(pathmap_INCL))))
endef
#
# Many modules expect to be able to say "#include <jni.h>",
# so make it easy for them to find the correct path.
#
JNI_H_INCLUDE := $(call include-path-for,libnativehelper)/nativehelper
FRAMEWORKS_BASE_SUBDIRS := \
core \
graphics \
location \
media \
opengl \
sax \
services \
telephony \
wifi
FRAMEWORKS_BASE_JAVA_SRC_DIRS := \
$(patsubst %,frameworks/base/%/java,$(FRAMEWORKS_BASE_SUBDIRS))

37
core/prebuilt.mk Normal file
View File

@ -0,0 +1,37 @@
###########################################################
## Standard rules for copying files that are prebuilt
##
## Additional inputs from base_rules.make:
## None.
##
###########################################################
ifneq ($(LOCAL_PREBUILT_LIBS),)
$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
endif
ifneq ($(LOCAL_PREBUILT_EXECUTABLES),)
$(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH))
endif
ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),)
$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
endif
include $(BUILD_SYSTEM)/base_rules.mk
# Deal with the OSX library timestamp issue when installing
# a prebuilt simulator library.
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
prebuilt_module_is_a_library := true
else
prebuilt_module_is_a_library :=
endif
$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
$(transform-prebuilt-to-target)
ifneq ($(prebuilt_module_is_a_library),)
ifneq ($(LOCAL_IS_HOST_MODULE),)
$(transform-host-ranlib-copy-hack)
else
$(transform-ranlib-copy-hack)
endif
endif

115
core/prelink-linux-arm.map Normal file
View File

@ -0,0 +1,115 @@
# 0xC0000000 - 0xFFFFFFFF Kernel
# 0xB0100000 - 0xBFFFFFFF Thread 0 Stack
# 0xB0000000 - 0xB00FFFFF Linker
# 0xA0000000 - 0xBFFFFFFF Prelinked System Libraries
# 0x90000000 - 0x9FFFFFFF Prelinked App Libraries
# 0x80000000 - 0x8FFFFFFF Non-prelinked Libraries
# 0x40000000 - 0x7FFFFFFF mmap'd stuff
# 0x10000000 - 0x3FFFFFFF Thread Stacks
# 0x00000000 - 0x0FFFFFFF .text / .data / heap
# core system libraries
libdl.so 0xAFF00000
libc.so 0xAFE00000
libstdc++.so 0xAFD00000
libm.so 0xAFC00000
liblog.so 0xAFBC0000
libcutils.so 0xAFB00000
libthread_db.so 0xAFA00000
libz.so 0xAF900000
libevent.so 0xAF800000
libssl.so 0xAF700000
libcrypto.so 0xAF500000
# extended system libraries
libbluedroid.so 0xAED00000
libbluetooth.so 0xAEC00000
libdbus.so 0xAE800000
libril.so 0xAE400000
libreference-ril.so 0xAE000000
libwpa_client.so 0xADC00000
libnetutils.so 0xADB00000
# core dalvik runtime support
libandroid_servers.so 0xAD900000
libicudata.so 0xAD600000
libicuuc.so 0xAD500000
libicui18n.so 0xAD400000
libandroid_runtime.so 0xAD300000
libnativehelper.so 0xAD200000
libdvm-ARM.so 0xAD100000
libdvm.so 0xAD000000
# graphics
libpixelflinger.so 0xACF00000
libcorecg.so 0xACE00000
libsurfaceflinger.so 0xACD00000
libagl.so 0xACC00000
libGLES_CM.so 0xACB00000
libexif.so 0xAC500000
libui.so 0xAC400000
libsgl.so 0xAC000000
# audio
libaudio.so 0xAB700000
libsonivox.so 0xAB600000
libsoundpool.so 0xAB500000
libvorbisidec.so 0xAB400000
libmedia_jni.so 0xAB300000
libmediaplayerservice.so 0xAB280000
libmedia.so 0xAB200000
libFFTEm.so 0xAB100000
libaudioflinger.so 0xAB000000
# assorted system libraries
libsqlite.so 0xAAC00000
libexpat.so 0xAA800000
libwebcore.so 0xAA000000
libutils.so 0xA9D00000
libcameraservice.so 0xA9C80000
libhardware.so 0xA9C00000
libapp_process.so 0xA9B00000
libsystem_server.so 0xA9A00000
libime.so 0xA9800000
libgps.so 0xA9700000
libcamera.so 0xA9680000
libqcamera.so 0xA9400000
# pv libraries
libpvasf.so 0xA7BC0000
libpvasfreg.so 0xA7B70000
libopencoredownload.so 0xA7B40000
libopencoredownloadreg.so 0xA7B00000
libopencorenet_support.so 0xA7A00000
libopencorertsp.so 0xA7900000
libopencorertspreg.so 0xA7800000
libopencoreauthor.so 0xA7600000
libopencorecommon.so 0xA7500000
libopencoremp4.so 0xA7400000
libopencoremp4reg.so 0xA7300000
libopencoreplayer.so 0xA7000000
# libraries for specific apps or temporary libraries
libcam_ipl.so 0x9F000000
libwbxml.so 0x9E800000
libwbxml_jni.so 0x9E400000
libxml2wbxml.so 0x9E000000
libaes.so 0x9DC00000
libdrm1.so 0x9D800000
libdrm1_jni.so 0x9D400000
libwapcore.so 0x9D000000
libstreetview.so 0x9CC00000
libwapbrowsertest.so 0x9C800000
libminiglobe.so 0x9C400000
libearth.so 0x9C000000
libembunit.so 0x9BC00000
libneon.so 0x9B800000
libjni_example.so 0x9B400000
libjni_load_test.so 0x9B000000
libjni_lib_test.so 0x9AC00000
librunperf.so 0x9A800000
libctest.so 0x9A700000
libUAPI_jni.so 0x9A500000
librpc.so 0x9A400000
libtrace_test.so 0x9A300000

17
core/process_wrapper.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# When using a process wrapper, this is the top-level
# command that is executed instead of the server
# command. It starts a new xterm in which the user can
# interact with the new process.
#
# Inside of the xterm is a gdb session, through which
# the user can debug the new process.
# Save away these variables, since we may loose them
# when starting in the xterm.
export PREV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
export PREV_PATH=$PATH
gnome-terminal -t "Wrapper: $1" --disable-factory -x $2/process_wrapper_gdb.sh "$@"

View File

@ -0,0 +1 @@
run

17
core/process_wrapper_gdb.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# This is the command running inside the xterm of our
# debug wrapper. It needs to take care of starting
# the server command, so it can attach to the parent
# process. In addition, here we run the command inside
# of a gdb session to allow for debugging.
# On some systems, running xterm will cause LD_LIBRARY_PATH
# to be cleared, so restore it and PATH to be safe.
export PATH=$PREV_PATH
export LD_LIBRARY_PATH=$PREV_LD_LIBRARY_PATH
# Start binderproc (or whatever sub-command is being run)
# inside of gdb, giving gdb an initial command script to
# automatically run the process without user intervention.
gdb -q -x $2/process_wrapper_gdb.cmds --args "$@"

157
core/product.mk Normal file
View File

@ -0,0 +1,157 @@
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Functions for including AndroidProducts.mk files
#
#
# Returns the list of all AndroidProducts.mk files.
# $(call ) isn't necessary.
#
define _find-android-products-files
$(foreach vendor,$(wildcard vendor/*), \
$(if $(wildcard $(vendor)/AndroidProducts.mk), \
$(vendor)/AndroidProducts.mk \
, \
$(wildcard $(vendor)/*/AndroidProducts.mk) \
) \
) \
$(wildcard $(SRC_TARGET_DIR)/product/AndroidProducts.mk)
endef
#
# Returns the sorted concatenation of all PRODUCT_MAKEFILES
# variables set in all AndroidProducts.mk files.
# $(call ) isn't necessary.
#
define get-all-product-makefiles
$(sort \
$(foreach f,$(_find-android-products-files), \
$(eval PRODUCT_MAKEFILES :=) \
$(eval LOCAL_DIR := $(patsubst %/,%,$(dir $(f)))) \
$(eval include $(f)) \
$(PRODUCT_MAKEFILES) \
) \
$(eval PRODUCT_MAKEFILES :=) \
$(eval LOCAL_DIR :=) \
)
endef
#
# Functions for including product makefiles
#
_product_var_list := \
PRODUCT_NAME \
PRODUCT_MODEL \
PRODUCT_LOCALES \
PRODUCT_PACKAGES \
PRODUCT_DEVICE \
PRODUCT_MANUFACTURER \
PRODUCT_BRAND \
PRODUCT_PROPERTY_OVERRIDES \
PRODUCT_COPY_FILES \
PRODUCT_OTA_PUBLIC_KEYS
define dump-product
$(info ==== $(1) ====)\
$(foreach v,$(_product_var_list),\
$(info PRODUCTS.$(1).$(v) := $(PRODUCTS.$(1).$(v))))\
$(info --------)
endef
define dump-products
$(foreach p,$(PRODUCTS),$(call dump-product,$(p)))
endef
#
# $(1): product to inherit
#
define inherit-product
$(foreach v,$(_product_var_list), \
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1))))
endef
#
# $(1): product makefile list
#
#TODO: check to make sure that products have all the necessary vars defined
define import-products
$(call import-nodes,PRODUCTS,$(1),$(_product_var_list))
endef
#
# Does various consistency checks on all of the known products.
# Takes no parameters, so $(call ) is not necessary.
#
define check-all-products
$(if ,, \
$(eval _cap_names :=) \
$(foreach p,$(PRODUCTS), \
$(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \
$(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \
$(if $(filter $(pn),$(_cap_names)), \
$(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \
$(foreach \
pp,$(PRODUCTS),
$(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \
$(pp) \
))) \
) \
) \
$(eval _cap_names += $(pn)) \
$(if $(call is-c-identifier,$(pn)),, \
$(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \
) \
$(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \
$(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \
$(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \
$(if $(filter 2,$(words $(subst :,$(space),$(cf)))),, \
$(error $(p): malformed COPY_FILE "$(cf)") \
) \
) \
) \
)
endef
#
# Returns the product makefile path for the product with the provided name
#
# $(1): short product name like "generic"
#
define _resolve-short-product-name
$(eval pn := $(strip $(1)))
$(eval p := \
$(foreach p,$(PRODUCTS), \
$(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \
$(p) \
)) \
)
$(eval p := $(sort $(p)))
$(if $(filter 1,$(words $(p))), \
$(p), \
$(if $(filter 0,$(words $(p))), \
$(error No matches for product "$(pn)"), \
$(error Product "$(pn)" ambiguous: matches $(p)) \
) \
)
endef
define resolve-short-product-name
$(strip $(call _resolve-short-product-name,$(1)))
endef

243
core/product_config.mk Normal file
View File

@ -0,0 +1,243 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ---------------------------------------------------------------
# Generic functions
# TODO: Move these to definitions.make once we're able to include
# definitions.make before config.make.
###########################################################
## Return non-empty if $(1) is a C identifier; i.e., if it
## matches /^[a-zA-Z_][a-zA-Z0-9_]*$/. We do this by first
## making sure that it isn't empty and doesn't start with
## a digit, then by removing each valid character. If the
## final result is empty, then it was a valid C identifier.
##
## $(1): word to check
###########################################################
_ici_digits := 0 1 2 3 4 5 6 7 8 9
_ici_alphaunderscore := \
a b c d e f g h i j k l m n o p q r s t u v w x y z \
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _
define is-c-identifier
$(strip \
$(if $(1), \
$(if $(filter $(addsuffix %,$(_ici_digits)),$(1)), \
, \
$(eval w := $(1)) \
$(foreach c,$(_ici_digits) $(_ici_alphaunderscore), \
$(eval w := $(subst $(c),,$(w))) \
) \
$(if $(w),,TRUE) \
$(eval w :=) \
) \
) \
)
endef
# ---------------------------------------------------------------
# if TARGET_PRODUCT isn't set, fall back to the hardware- and
# vendor-agnostic "generic" product.
#
ifeq ($(strip $(TARGET_PRODUCT)),)
TARGET_PRODUCT := generic
endif
# ---------------------------------------------------------------
# Provide "PRODUCT-<prodname>-<goal>" targets, which lets you build
# a particular configuration without needing to set up the environment.
#
product_goals := $(strip $(filter PRODUCT-%,$(MAKECMDGOALS)))
ifdef product_goals
# Scrape the product and build names out of the goal,
# which should be of the form PRODUCT-<productname>-<buildname>.
#
ifneq ($(words $(product_goals)),1)
$(error Only one PRODUCT-* goal may be specified; saw "$(product_goals)")
endif
goal_name := $(product_goals)
product_goals := $(patsubst PRODUCT-%,%,$(product_goals))
product_goals := $(subst -, ,$(product_goals))
ifneq ($(words $(product_goals)),2)
$(error Bad PRODUCT-* goal "$(goal_name)")
endif
product_name := $(word 1,$(product_goals))
product_build := $(word 2,$(product_goals))
ifeq ($(product_build),eng)
product_build := droid
endif
# Hack to make the linux build servers use dexpreopt.
# OSX is still a little flaky. Most engineers don't use this
# type of target ("make PRODUCT-blah-user"), so this should
# only tend to happen when using buildbot.
# TODO: remove this and fix the matching lines in //device/Makefile
# once dexpreopt works better on OSX.
ifeq ($(product_build),user)
WITH_DEXPREOPT_buildbot := true
endif
# Replace the PRODUCT-* goal with the build goal that it refers to.
# Note that this will ensure that it appears in the same relative
# position, in case it matters.
#
# Note that modifying this will not affect the goals that make will
# attempt to build, but it's important because we inspect this value
# in certain situations (like for "make user").
#
MAKECMDGOALS := $(patsubst $(goal_name),$(product_build),$(MAKECMDGOALS))
# Keep track of the requested product.
REQUESTED_PRODUCT := $(product_name)
# Define a rule for the PRODUCT-* goal, and make it depend on the
# patched-up command-line goals as well as any other goals that we
# want to force.
#
.PHONY: $(goal_name)
$(goal_name): $(MAKECMDGOALS)
else
# Use the value set in the environment or buildspec.mk.
#
REQUESTED_PRODUCT := $(TARGET_PRODUCT)
endif
# ---------------------------------------------------------------
# Make the SDK build against generic by default.
ifneq (,$(filter sdk,$(MAKECMDGOALS)))
ifeq (,$(strip $(REQUESTED_PRODUCT)))
REQUESTED_PRODUCT := generic
endif
endif
# ---------------------------------------------------------------
# Make the PDK build against generic by default.
ifneq (,$(filter pdk,$(MAKECMDGOALS)))
ifeq (,$(strip $(REQUESTED_PRODUCT)))
REQUESTED_PRODUCT := generic
endif
endif
# ---------------------------------------------------------------
# Include the product definitions.
# We need to do this to translate TARGET_PRODUCT into its
# underlying TARGET_DEVICE before we start defining any rules.
#
include $(BUILD_SYSTEM)/node_fns.mk
include $(BUILD_SYSTEM)/product.mk
include $(BUILD_SYSTEM)/device.mk
# Read in all of the product definitions specified by the AndroidProducts.mk
# files in the tree.
#
#TODO: when we start allowing direct pointers to product files,
# guarantee that they're in this list.
$(call import-products, $(get-all-product-makefiles))
$(check-all-products)
#$(dump-products)
#$(error done)
# Convert a short name like "sooner" into the path to the product
# file defining that product.
#
INTERNAL_PRODUCT := $(call resolve-short-product-name, $(REQUESTED_PRODUCT))
#$(error REQUESTED_PRODUCT $(REQUESTED_PRODUCT) --> $(INTERNAL_PRODUCT))
# Convert from the real product (which represents everything about a
# build) to the old product (which represents a board/device/sku).
#
# Use "override" in case make was invoked like "make TARGET_PRODUCT=xyz"
# TODO: get rid of the old meaning of "product" in favor of
# device/board.
#
override TARGET_PRODUCT := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)
# Figure out which resoure configuration options to use for this
# product.
PRODUCT_LOCALES := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_LOCALES))
# TODO: also keep track of things like "port", "land" in product files.
# Assemble the list of options.
PRODUCT_AAPT_CONFIG := $(PRODUCT_LOCALES)
# Convert spaces to commas.
comma := ,
PRODUCT_AAPT_CONFIG := \
$(subst $(space),$(comma),$(strip $(PRODUCT_AAPT_CONFIG)))
PRODUCT_BRAND := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BRAND))
PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MODEL))
ifndef PRODUCT_MODEL
PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_NAME))
endif
PRODUCT_MANUFACTURER := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MANUFACTURER))
ifndef PRODUCT_MANUFACTURER
PRODUCT_MANUFACTURER := unknown
endif
# A list of words like <source path>:<destination path>. The file at
# the source path should be copied to the destination path when building
# this product. <destination path> is relative to $(PRODUCT_OUT), so
# it should look like, e.g., "system/etc/file.xml". The rules
# for these copy steps are defined in config/Makefile.
PRODUCT_COPY_FILES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_COPY_FILES))
# A list of property assignments, like "key = value", with zero or more
# whitespace characters on either side of the '='.
PRODUCT_PROPERTY_OVERRIDES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PROPERTY_OVERRIDES))
# Add the product-defined properties to the build properties.
ADDITIONAL_BUILD_PROPERTIES := \
$(ADDITIONAL_BUILD_PROPERTIES) \
$(PRODUCT_PROPERTY_OVERRIDES)
# Get the list of OTA public keys for the product.
OTA_PUBLIC_KEYS := \
$(sort \
$(OTA_PUBLIC_KEYS) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_PUBLIC_KEYS) \
)
# HACK: Not all products define OTA keys yet, and the -user build
# will fail if no keys are defined.
# TODO: Let a product opt out of needing OTA keys, and stop defaulting to
# the test key as soon as possible.
ifeq (,$(strip $(OTA_PUBLIC_KEYS)))
$(warning WARNING: adding test OTA key)
OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
endif
# ---------------------------------------------------------------
# Force the simulator to be the simulator, and make BUILD_TYPE
# default to debug.
ifeq ($(TARGET_PRODUCT),sim)
TARGET_SIMULATOR := true
ifeq (,$(strip $(TARGET_BUILD_TYPE)))
TARGET_BUILD_TYPE := debug
endif
# dexpreopt doesn't work when building the simulator
DISABLE_DEXPREOPT := true
endif

25
core/raw_executable.mk Normal file
View File

@ -0,0 +1,25 @@
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_SUFFIX :=
LOCAL_FORCE_STATIC_EXECUTABLE := true
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE) : PRIVATE_ELF_FILE := $(intermediates)/$(PRIVATE_MODULE).elf
$(LOCAL_BUILT_MODULE) : PRIVATE_LIBS := `$(TARGET_CC) -mthumb-interwork -print-libgcc-file-name`
$(all_objects) : TARGET_PROJECT_INCLUDES :=
$(all_objects) : TARGET_C_INCLUDES :=
$(all_objects) : TARGET_GLOBAL_CFLAGS :=
$(all_objects) : TARGET_GLOBAL_CPPFLAGS :=
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
@$(mkdir -p $(dir $@)
@echo "target Linking: $(PRIVATE_MODULE)"
$(hide) $(TARGET_LD) \
--script $(PRIVATE_LINK_SCRIPT) \
-o $(PRIVATE_ELF_FILE) \
$(PRIVATE_ALL_OBJECTS) \
--start-group $(PRIVATE_ALL_STATIC_LIBRARIES) --end-group \
$(PRIVATE_LIBS)
$(hide) $(TARGET_OBJCOPY) -O binary $(PRIVATE_ELF_FILE) $@

View File

@ -0,0 +1,5 @@
LOCAL_RAW_STATIC_LIBRARY:=true
include $(BUILD_STATIC_LIBRARY)

3
core/root.mk Normal file
View File

@ -0,0 +1,3 @@
### DO NOT EDIT THIS FILE ###
include build/core/main.mk
### DO NOT EDIT THIS FILE ###

30
core/shared_library.mk Normal file
View File

@ -0,0 +1,30 @@
###########################################################
## Standard rules for building a normal shared library.
##
## Additional inputs from base_rules.make:
## None.
##
## LOCAL_MODULE_SUFFIX will be set for you.
###########################################################
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
endif
ifeq ($(strip $(LOCAL_PRELINK_MODULE)),)
LOCAL_PRELINK_MODULE := $(strip $(TARGET_PRELINK_MODULE))
endif
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
# Put the built targets of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_SYSTEM)/dynamic_binary.mk
$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-o-to-shared-lib)

View File

@ -0,0 +1,25 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Standard rules for building a "static" java library.
# Static java libraries are not installed, nor listed on any
# classpaths. They can, however, be included wholesale in
# other java modules.
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_IS_STATIC_JAVA_LIBRARY := true
include $(BUILD_SYSTEM)/java_library.mk
LOCAL_IS_STATIC_JAVA_LIBRARY :=

29
core/static_library.mk Normal file
View File

@ -0,0 +1,29 @@
###########################################################
## Standard rules for building a static library.
##
## Additional inputs from base_rules.make:
## None.
##
## LOCAL_MODULE_SUFFIX will be set for you.
###########################################################
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := .a
endif
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_SYSTEM)/binary.mk
ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
LOCAL_RAW_STATIC_LIBRARY:=
$(all_objects) : TARGET_PROJECT_INCLUDES :=
$(all_objects) : TARGET_C_INCLUDES :=
$(all_objects) : TARGET_GLOBAL_CFLAGS :=
$(all_objects) : TARGET_GLOBAL_CPPFLAGS :=
endif
$(LOCAL_BUILT_MODULE): $(all_objects)
$(transform-o-to-static-lib)

72
core/tasks/apicheck.mk Normal file
View File

@ -0,0 +1,72 @@
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Rules for running apicheck to confirm that you haven't broken
# api compatibility or added apis illegally.
#
.PHONY: checkapi
# eval this to define a rule that runs apicheck.
#
# Args:
# $(1) target
# $(2) stable api xml file
# $(3) api xml file to be tested
# $(4) arguments for apicheck
# $(5) command to run if apicheck failed
define check-api
$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(APICHECK)
@echo "Checking API:" $(1)
$(hide) ( $(APICHECK) $(4) $(2) $(3) || ( $(5) ; exit 38 ) )
$(hide) mkdir -p $$(dir $$@)
$(hide) touch $$@
checkapi: $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
endef
# Run the checkapi rules by default.
droidcore: checkapi
# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
# Check that the API we're building hasn't broken the last-released
# SDK version.
$(eval $(call check-api, \
checkapi-last, \
$(BUILD_SYSTEM)/api/$(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)).xml, \
$(INTERNAL_PLATFORM_API_FILE), \
-hide 2 -hide 3 -hide 4 -hide 5 -hide 6 \
-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
-error 16 -error 17 -error 18 , \
cat $(BUILD_SYSTEM)/apicheck_msg_last.txt \
))
# Check that the API we're building hasn't changed from the not-yet-released
# SDK version.
$(eval $(call check-api, \
checkapi-current, \
$(BUILD_SYSTEM)/api/current.xml, \
$(INTERNAL_PLATFORM_API_FILE), \
-error 2 -error 3 -error 4 -error 5 -error 6 \
-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
-error 16 -error 17 -error 18 -error 19 -error 20 -error 21 , \
cat $(BUILD_SYSTEM)/apicheck_msg_current.txt \
))
.PHONY: update-api
update-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP)
@echo Copying current.xml
$(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) $(BUILD_SYSTEM)/api/current.xml

47
core/tasks/localize.mk Normal file
View File

@ -0,0 +1,47 @@
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Rules for building the xlb files for export for translation.
#
# Gather all of the resource files for the default locale -- that is,
# all resources in directories called values or values-something, where
# one of the - separated segments is not two characters long -- those are the
# language directories, and we don't want those.
all_resource_files := $(foreach pkg, \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \
$(PACKAGES.$(pkg).RESOURCE_FILES))
values_resource_files := $(shell echo $(all_resource_files) | \
tr -s / | \
tr " " "\n" | \
grep -E "\/values[^/]*/(strings.xml|arrays.xml)$$" | \
grep -v -E -e "-[a-zA-Z]{2}[/\-]")
xlb_target := $(PRODUCT_OUT)/strings.xlb
$(xlb_target): $(values_resource_files) | $(LOCALIZE)
@echo XLB: $@
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $@
$(hide) $(LOCALIZE) xlb $@ $^
# Add a phony target so typing make xlb is convenient
.PHONY: xlb
xlb: $(xlb_target)
# We want this on the build-server builds, but no reason to inflict it on
# everyone
$(call dist-for-goals, user droid, $(xlb_target))

73
core/version_defaults.mk Normal file
View File

@ -0,0 +1,73 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Handle various build version information.
#
# Guarantees that the following are defined:
# PLATFORM_VERSION
# PLATFORM_SDK_VERSION
# BUILD_ID
# BUILD_NUMBER
#
# Look for an optional file containing overrides of the defaults,
# but don't cry if we don't find it. We could just use -include, but
# the build.prop target also wants INTERNAL_BUILD_ID_MAKEFILE to be set
# if the file exists.
#
INTERNAL_BUILD_ID_MAKEFILE := $(wildcard $(BUILD_SYSTEM)/build_id.mk)
ifneq "" "$(INTERNAL_BUILD_ID_MAKEFILE)"
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
ifeq "" "$(PLATFORM_VERSION)"
# This is the canonical definition of the platform version,
# which is the version that we reveal to the end user.
# Update this value when the platform version changes (rather
# than overriding it somewhere else). Can be an arbitrary string.
PLATFORM_VERSION := 1.0
endif
ifeq "" "$(PLATFORM_SDK_VERSION)"
# This is the canonical definition of the SDK version, which defines
# the set of APIs and functionality available in the platform. This is
# a single integer, that increases monotonically as updates to the SDK
# are released.
PLATFORM_SDK_VERSION := 1
endif
ifeq "" "$(BUILD_ID)"
# Used to signify special builds. E.g., branches and/or releases,
# like "M5-RC7". Can be an arbitrary string, but must be a single
# word and a valid file name.
#
# If there is no BUILD_ID set, make it obvious.
BUILD_ID := UNKNOWN
endif
ifeq "" "$(BUILD_NUMBER)"
# BUILD_NUMBER should be set to the source control value that
# represents the current state of the source code. E.g., a
# perforce changelist number or a git hash. Can be an arbitrary string
# (to allow for source control that uses something other than numbers),
# but must be a single word and a valid file name.
#
# If no BUILD_NUMBER is set, create a useful "I am an engineering build
# from this date/time" value. Make it start with a non-digit so that
# anyone trying to parse it as an integer will probably get "0".
BUILD_NUMBER := eng.$(USER).$(shell date +%Y%m%d.%H%M%S)
endif

784
envsetup.sh Normal file
View File

@ -0,0 +1,784 @@
function help() {
cat <<EOF
Invoke ". envsetup.sh" from your shell to add the following functions to your environment:
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
Look at the source to view more functions. The complete list is:
EOF
T=$(gettop)
local A
A=""
for i in `cat $T/build/envsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
A="$A $i"
done
echo $A
}
# Get the value of a build variable as an absolute path.
function get_abs_build_var()
{
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
CALLED_FROM_SETUP=true \
make --no-print-directory -C "$T" -f build/core/envsetup.mk dumpvar-abs-$1
}
# Get the exact value of a build variable.
function get_build_var()
{
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
CALLED_FROM_SETUP=true \
make --no-print-directory -C "$T" -f build/core/envsetup.mk dumpvar-$1
}
function setpaths()
{
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
return
fi
##################################################################
# #
# Read me before you modify this code #
# #
# This function sets ANDROID_BUILD_PATHS to what it is adding #
# to PATH, and the next time it is run, it removes that from #
# PATH. This is required so lunch can be run more than once #
# and still have working paths. #
# #
##################################################################
# out with the old
if [ -n $ANDROID_BUILD_PATHS ] ; then
export PATH=${PATH/$ANDROID_BUILD_PATHS/}
fi
# and in with the new
CODE_REVIEWS=
prebuiltdir=$(getprebuilt)
export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain-eabi-4.2.1/bin
export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
export ANDROID_QTOOLS=$T/development/emulator/qtools
export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
export PATH=$PATH$ANDROID_BUILD_PATHS
export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
export OUT=$ANDROID_PRODUCT_OUT
# needed for building linux on MacOS
# TODO: fix the path
#export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
}
function printconfig()
{
echo "=============================================="
echo "Build System Configuration"
echo
echo " TARGET_SIMULATOR: " $TARGET_SIMULATOR
echo " TARGET_BUILD_TYPE: " $TARGET_BUILD_TYPE
echo " TARGET_PRODUCT: " $TARGET_PRODUCT
echo "=============================================="
}
function set_stuff_for_environment()
{
if [ "$TARGET_SIMULATOR" -a "$TARGET_PRODUCT" -a "$TARGET_BUILD_TYPE" ]
then
settitle
printconfig
setpaths
set_sequence_number
# Don't try to do preoptimization until it works better on OSX.
export DISABLE_DEXPREOPT=true
export ANDROID_BUILD_TOP=$(gettop)
fi
}
function set_sequence_number()
{
export BUILD_ENV_SEQUENCE_NUMBER=8
}
function settitle()
{
if [ "$STAY_OFF_MY_LAWN" = "" ]; then
TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export PROMPT_COMMAND='echo -ne "\033]0;[${TARGET_PRODUCT}] ${USER}@${HOSTNAME}: ${PWD}\007"'
fi
}
case `uname -s` in
Linux)
function choosesim()
{
echo "Build for the simulator or the device?"
echo " 1. Device"
echo " 2. Simulator"
echo
export TARGET_SIMULATOR=$1
while [ -z $TARGET_SIMULATOR ]
do
echo -n "Which would you like? [1] "
read ANSWER
case $ANSWER in
"")
export TARGET_SIMULATOR=false
;;
1)
export TARGET_SIMULATOR=false
;;
2)
export TARGET_SIMULATOR=true
;;
*)
echo
echo "I didn't understand your response. Please try again."
echo
continue
;;
esac
done
set_stuff_for_environment
}
;;
*)
function choosesim()
{
echo "Only device builds are supported for" `uname -s`
echo " Forcing TARGET_SIMULATOR=false"
echo
echo -n "Press enter: "
read
export TARGET_SIMULATOR=false
set_stuff_for_environment
}
;;
esac
function choosetype()
{
echo "Build type choices are:"
echo " 1. release"
echo " 2. debug"
echo
if [ $TARGET_SIMULATOR = "false" ] ; then
DEFAULT_NUM=1
DEFAULT_VALUE=release
else
DEFAULT_NUM=2
DEFAULT_VALUE=debug
fi
export TARGET_BUILD_TYPE=$1
while [ -z $TARGET_BUILD_TYPE ]
do
echo -n "Which would you like? ["$DEFAULT_NUM"] "
read ANSWER
case $ANSWER in
"")
export TARGET_BUILD_TYPE=$DEFAULT_VALUE
;;
1)
export TARGET_BUILD_TYPE=release
;;
2)
export TARGET_BUILD_TYPE=debug
;;
*)
echo
echo "I didn't understand your response. Please try again."
echo
continue
;;
esac
done
set_stuff_for_environment
}
function chooseproduct()
{
# Find the makefiles that must exist for a product.
# Send stderr to /dev/null in case partner isn't present.
choices=(`/bin/ls build/target/board/*/BoardConfig.mk vendor/*/*/BoardConfig.mk 2> /dev/null`)
count=${#choices[@]}
index=0
echo "Product choices are:"
while [ "$index" -lt "$count" ]
do
# The product name is the name of the directory containing
# the makefile we found, above.
choices[$index]=`dirname ${choices[$index]} | xargs basename`
echo " $index. ${choices[$index]}"
let "index = $index + 1"
done
if [ "x$TARGET_PRODUCT" != x ] ; then
default_value=$TARGET_PRODUCT
else
if [ "$TARGET_SIMULATOR" = true ] ; then
default_value=sim
else
default_value=generic
fi
fi
export TARGET_PRODUCT=$1
while [ -z "$TARGET_PRODUCT" ]
do
echo -n "which would you like? [$default_value] "
read ANSWER
if [ -z "$ANSWER" ] ; then
export TARGET_PRODUCT=$default_value
elif [ "$ANSWER" -lt "$count" ] ; then
export TARGET_PRODUCT=${choices[$ANSWER]}
fi
done
set_stuff_for_environment
}
function tapas()
{
choosecombo
}
function choosecombo()
{
choosesim $1
echo
echo
choosetype $2
echo
echo
chooseproduct $3
echo
set_stuff_for_environment
}
function print_lunch_menu()
{
local uname=$(uname)
echo
echo "You're building on" $uname
echo
echo "Lunch menu... pick a combo:"
echo " 1. device release generic"
if [ $uname = Linux ]
then
echo " 2. simulator debug sim"
else
echo " <no simulator on $uname>"
fi
echo
}
function lunch()
{
if [ "$1" ] ; then
ANSWER=$1
else
print_lunch_menu
echo -n "Which would you like? "
read ANSWER
fi
if [ $ANSWER -eq 2 -a $(uname) != Linux ]
then
echo "Simulator builds are not supported on this platform"
ANSWER=0
fi
case $ANSWER in
1)
export TARGET_SIMULATOR=false
export TARGET_BUILD_TYPE=release
export TARGET_PRODUCT=generic
;;
2)
export TARGET_SIMULATOR=true
export TARGET_BUILD_TYPE=debug
export TARGET_PRODUCT=sim
;;
*)
echo
if [ "$1" ] ; then
echo "I didn't understand your request. Please try again"
print_lunch_menu
else
echo "I didn't understand your response. Please try again."
fi
return
;;
esac
echo
set_stuff_for_environment
}
function partner_setup()
{
# Set up the various TARGET_ variables so that we can use
# the lunch helper functions to build the PATH.
#
if [ $# -lt 1 ] ; then
export TARGET_PRODUCT=generic
echo "Usage: partner_setup <product-name>" >&2
echo " Defaulting to product \"$TARGET_PRODUCT\"" >&2
else
export TARGET_PRODUCT=$1
fi
if [ $TARGET_PRODUCT = "sim" ] ; then
export TARGET_SIMULATOR=true
export TARGET_BUILD_TYPE=debug
else
export TARGET_SIMULATOR=false
export TARGET_BUILD_TYPE=release
fi
# setpaths will fix up the PATH to point to the tools, and will also
# set ANDROID_PRODUCT_OUT. set_sequence_number is necessary for
# certain consistency checks within the build system.
#
setpaths
set_sequence_number
# Clear the TARGET_ variables so that the build is based purely on
# buildspec.mk and the commandline, except for sim
#
if [ $TARGET_PRODUCT != sim ] ; then
export TARGET_PRODUCT=
export TARGET_SIMULATOR=
export TARGET_BUILD_TYPE=
fi
export ANDROID_BUILD_TOP=$(gettop)
# Don't try to do preoptimization until it works better on OSX.
export DISABLE_DEXPREOPT=true
echo " ANDROID_PRODUCT_OUT: $ANDROID_PRODUCT_OUT"
echo " ANDROID_BUILD_TOP: $ANDROID_BUILD_TOP"
}
function gettop
{
TOPFILE=build/core/envsetup.mk
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
echo $TOP
else
if [ -f $TOPFILE ] ; then
echo $PWD
else
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
cd .. > /dev/null
T=$PWD
done
cd $HERE > /dev/null
if [ -f "$T/$TOPFILE" ]; then
echo $T
fi
fi
fi
}
function m()
{
T=$(gettop)
if [ "$T" ]; then
make -C $T $@
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
}
function findmakefile()
{
TOPFILE=build/core/envsetup.mk
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=$PWD
if [ -f "$T/Android.mk" ]; then
echo $T/Android.mk
cd $HERE > /dev/null
return
fi
cd .. > /dev/null
done
cd $HERE > /dev/null
}
function mm()
{
# If we're sitting in the root of the build tree, just do a
# normal make.
if [ -f build/core/envsetup.mk -a -f Makefile ]; then
make $@
else
# Find the closest Android.mk file.
T=$(gettop)
M=$(findmakefile)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
elif [ ! "$M" ]; then
echo "Couldn't locate a makefile from the current directory."
else
ONE_SHOT_MAKEFILE=$M make -C $T files $@
fi
fi
}
function mmm()
{
T=$(gettop)
if [ "$T" ]; then
MAKEFILE=
ARGS=
for DIR in $@ ; do
DIR=`echo $DIR | sed -e 's:/$::'`
if [ -f $DIR/Android.mk ]; then
TO_CHOP=`echo $T | wc -c | tr -d ' '`
TO_CHOP=`expr $TO_CHOP + 1`
MFILE=`echo $PWD | cut -c${TO_CHOP}-`
if [ "$MFILE" = "" ] ; then
MFILE=$DIR/Android.mk
else
MFILE=$MFILE/$DIR/Android.mk
fi
MAKEFILE="$MAKEFILE $MFILE"
else
if [ "$DIR" = snod ]; then
ARGS="$ARGS snod"
elif [ "$DIR" = showcommands ]; then
ARGS="$ARGS showcommands"
else
echo "No Android.mk in $DIR."
fi
fi
done
ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T files $ARGS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
}
function croot()
{
T=$(gettop)
if [ "$T" ]; then
cd $(gettop)
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
}
function pid()
{
local EXE="$1"
if [ "$EXE" ] ; then
local PID=`adb shell ps | fgrep $1 | sed -e 's/[^ ]* *\([0-9]*\).*/\1/'`
echo "$PID"
else
echo "usage: pid name"
fi
}
function gdbclient()
{
OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED)
PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
local EXE="$1"
if [ "$EXE" ] ; then
EXE=$1
else
EXE="app_process"
fi
local PORT="$2"
if [ "$PORT" ] ; then
PORT=$2
else
PORT=":5039"
fi
local PID
local PROG="$3"
if [ "$PROG" ] ; then
PID=`pid $3`
adb forward "tcp$PORT" "tcp$PORT"
adb shell gdbserver $PORT --attach $PID &
sleep 2
else
echo ""
echo "If you haven't done so already, do this first on the device:"
echo " gdbserver $PORT /system/bin/$EXE"
echo " or"
echo " gdbserver $PORT --attach $PID"
echo ""
fi
echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS"
echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
echo >>"$OUT_ROOT/gdbclient.cmds" ""
arm-eabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
else
echo "Unable to determine build system output dir."
fi
}
case `uname -s` in
Darwin)
function sgrep()
{
find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n "$@"
}
;;
*)
function sgrep()
{
find . -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\)' -print0 | xargs -0 grep --color -n "$@"
}
;;
esac
function jgrep()
{
find . -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
}
function cgrep()
{
find . -type f -name "*\.c*" -print0 | xargs -0 grep --color -n "$@"
}
function resgrep()
{
for dir in `find . -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
}
case `uname -s` in
Darwin)
function mgrep()
{
find -E . -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
}
function treegrep()
{
find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
}
;;
*)
function mgrep()
{
find . -regextype posix-egrep -iregex '\(.*\/Makefile\|.*\/Makefile\..*\|.*\.make\|.*\.mak\|.*\.mk\)' -type f -print0 | xargs -0 grep --color -n "$@"
}
function treegrep()
{
find . -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
}
;;
esac
function getprebuilt
{
get_abs_build_var ANDROID_PREBUILTS
}
function tracedmdump()
{
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
return
fi
prebuiltdir=$(getprebuilt)
KERNEL=$T/prebuilt/android-arm/vmlinux-qemu
TRACE=$1
if [ ! "$TRACE" ] ; then
echo "usage: tracedmdump tracename"
return
fi
BASETRACE=$(basename $TRACE)
if [ "$BASETRACE" = "$TRACE" ] ; then
TRACE=$ANDROID_PRODUCT_OUT/traces/$TRACE
fi
echo "post-processing traces..."
rm -f $TRACE/qtrace.dexlist
post_trace $TRACE
if [ $? -ne 0 ]; then
echo "***"
echo "*** Error: malformed trace. Did you remember to exit the emulator?"
echo "***"
return
fi
echo "generating dexlist output..."
/bin/ls $ANDROID_PRODUCT_OUT/system/framework/*.jar $ANDROID_PRODUCT_OUT/system/app/*.apk $ANDROID_PRODUCT_OUT/data/app/*.apk 2>/dev/null | xargs dexlist > $TRACE/qtrace.dexlist
echo "generating dmtrace data..."
q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace || return
echo "generating html file..."
dmtracedump -h $TRACE/dmtrace >| $TRACE/dmtrace.html || return
echo "done, see $TRACE/dmtrace.html for details"
echo "or run:"
echo " traceview $TRACE/dmtrace"
}
function runhat()
{
targetPid=$1
outputFile=$2
if [ "$targetPid" = "" ]; then
echo "Usage: runhat target-pid [output-file]"
return
fi
adb shell >/dev/null mkdir /data/misc
adb shell chmod 777 /data/misc
echo "Poking $targetPid and waiting for data..."
adb shell kill -10 $targetPid
echo "Press enter when logcat shows \"GC freed ## objects / ## bytes\""
echo -n "> "
read
availFiles=( $(adb shell ls /data/misc | grep '^heap-dump' | sed -e 's/.*heap-dump-/heap-dump-/' | sort -r | tr '[:space:][:cntrl:]' ' ') )
devHeadFile=/data/misc/${availFiles[0]}
devTailFile=/data/misc/${availFiles[1]}
localHeadFile=/tmp/$$-hprof-head
localTailFile=/tmp/$$-hprof-tail
echo "Retrieving file $devHeadFile..."
adb pull $devHeadFile $localHeadFile
echo "Retrieving file $devTailFile..."
adb pull $devTailFile $localTailFile
combinedFile=$outputFile
if [ "$combinedFile" = "" ]; then
combinedFile=/tmp/$$.hprof
fi
cat $localHeadFile $localTailFile >$combinedFile
adb shell rm $devHeadFile
adb shell rm $devTailFile
rm $localHeadFile
rm $localTailFile
echo "Running hat on $combinedFile"
echo "View the output by pointing your browser at http://localhost:7000/"
echo ""
hat $combinedFile
}
function getbugreports()
{
reports=(`adb shell ls /sdcard/bugreports | tr -d '\r'`)
if [ ! "$reports" ]; then
echo "Could not locate any bugreports."
return
fi
count=${#reports[@]}
index=0
while [ "$index" -lt "$count" ]
do
echo "/sdcard/bugreports/${reports[$index]}"
adb pull /sdcard/bugreports/${reports[$index]} ${reports[$index]}
gunzip ${reports[$index]}
let "index = $index + 1"
done
}
function startviewserver()
{
port=4939
if [ $# -gt 0 ]; then
port=$1
fi
adb shell service call window 1 i32 $port
}
function stopviewserver()
{
adb shell service call window 2
}
function isviewserverstarted()
{
adb shell service call window 3
}
function smoketest()
{
if [ ! "$ANDROID_PRODUCT_OUT" ]; then
echo "Couldn't locate output files. Try running 'lunch' first." >&2
return
fi
T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
(cd "$T" && mmm tests/SmokeTest) &&
adb uninstall com.android.smoketest > /dev/null &&
adb uninstall com.android.smoketest.tests > /dev/null &&
adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTest.apk &&
adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner
}

26
libs/host/Android.mk Normal file
View File

@ -0,0 +1,26 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
CopyFile.c \
Directories.cpp \
pseudolocalize.cpp
ifeq ($(HOST_OS),cygwin)
LOCAL_CFLAGS += -DWIN32_EXE
endif
ifeq ($(HOST_OS),darwin)
LOCAL_CFLAGS += -DMACOSX_RSRC
endif
ifeq ($(HOST_OS),linux)
endif
LOCAL_MODULE:= libhost
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
# acp uses libhost, so we can't use
# acp to install libhost.
LOCAL_ACP_UNAVAILABLE:= true
include $(BUILD_HOST_STATIC_LIBRARY)

626
libs/host/CopyFile.c Normal file
View File

@ -0,0 +1,626 @@
/*
* Copyright 2005 The Android Open Source Project
*
* Android "cp" replacement.
*
* The GNU/Linux "cp" uses O_LARGEFILE in its open() calls, utimes() instead
* of utime(), and getxattr()/setxattr() instead of chmod(). These are
* probably "better", but are non-portable, and not necessary for our
* purposes.
*/
#include <host/CopyFile.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
#include <dirent.h>
#include <fcntl.h>
#include <utime.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
#ifdef HAVE_MS_C_RUNTIME
# define mkdir(path,mode) _mkdir(path)
#endif
#ifndef HAVE_SYMLINKS
# define lstat stat
# ifndef EACCESS /* seems to be missing from the Mingw headers */
# define EACCESS 13
# endif
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
/*#define DEBUG_MSGS*/
#ifdef DEBUG_MSGS
# define DBUG(x) printf x
#else
# define DBUG(x) ((void)0)
#endif
#define FSSEP '/' /* filename separator char */
static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options);
/*
* Returns true if the source file is newer than the destination file.
*
* The check is based on the modification date, whole seconds only. This
* also returns true if the file sizes don't match.
*/
static bool isSourceNewer(const struct stat* pSrcStat, const struct stat* pDstStat)
{
return (pSrcStat->st_mtime > pDstStat->st_mtime) ||
(pSrcStat->st_size != pDstStat->st_size);
}
/*
* Returns true if the source and destination files are actually the
* same thing. We detect this by checking the inode numbers, which seems
* to work on Cygwin.
*/
static bool isSameFile(const struct stat* pSrcStat, const struct stat* pDstStat)
{
#ifndef HAVE_VALID_STAT_ST_INO
/* with MSVCRT.DLL, stat always sets st_ino to 0, and there is no simple way to */
/* get the equivalent information with Win32 (Cygwin does some weird stuff in */
/* its winsup/cygwin/fhandler_disk_file.cc to emulate this, too complex for us) */
return 0;
#else
return (pSrcStat->st_ino == pDstStat->st_ino);
#endif
}
static void printCopyMsg(const char* src, const char* dst, unsigned int options)
{
if ((options & COPY_VERBOSE_MASK) > 0)
printf(" '%s' --> '%s'\n", src, dst);
}
static void printNotNewerMsg(const char* src, const char* dst, unsigned int options)
{
if ((options & COPY_VERBOSE_MASK) > 1)
printf(" '%s' is up-to-date\n", dst);
}
/*
* Copy the contents of one file to another.
*
* The files are assumed to be seeked to the start.
*/
static int copyFileContents(const char* dst, int dstFd, const char* src, int srcFd)
{
unsigned char buf[8192];
ssize_t readCount, writeCount;
/*
* Read a chunk, write it, and repeat.
*/
while (1) {
readCount = read(srcFd, buf, sizeof(buf));
if (readCount < 0) {
fprintf(stderr,
"acp: failed reading '%s': %s\n", src, strerror(errno));
return -1;
}
if (readCount > 0) {
writeCount = write(dstFd, buf, readCount);
if (writeCount < 0) {
fprintf(stderr,
"acp: failed writing '%s': %s\n", dst, strerror(errno));
return -1;
}
if (writeCount != readCount) {
fprintf(stderr, "acp: partial write to '%s' (%d of %d)\n",
dst, writeCount, readCount);
return -1;
}
}
if (readCount < (ssize_t) sizeof(buf))
break;
}
return 0;
}
/*
* Set the permissions, owner, and timestamps on the destination file
* equal to those of the source file.
*
* Failures here are "soft"; they don't produce warning messages and don't
* cause the cp command to report a failure.
*/
static int setPermissions(const char* dst, const struct stat* pSrcStat, unsigned int options)
{
struct utimbuf ut;
if (options & COPY_TIMESTAMPS) {
/*
* Start with timestamps. The access and mod dates are not affected
* by the next operations.
*/
ut.actime = pSrcStat->st_atime;
ut.modtime = pSrcStat->st_mtime;
if (utime(dst, &ut) != 0) {
DBUG(("--- unable to set timestamps on '%s': %s\n",
dst, strerror(errno)));
}
}
if (options & COPY_PERMISSIONS) {
/*
* Set the permissions.
*/
if (chmod(dst, pSrcStat->st_mode & ~(S_IFMT)) != 0) {
DBUG(("--- unable to set perms on '%s' to 0%o: %s\n",
dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno)));
}
#ifndef HAVE_MS_C_RUNTIME
/*
* Set the owner.
*/
if (chown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) {
DBUG(("--- unable to set owner of '%s' to %d/%d: %s\n",
dst, pSrcStat->st_uid, pSrcStat->st_gid, strerror(errno)));
}
#endif
}
return 0;
}
/*
* Copy a regular file. If the destination file exists and is not a
* regular file, we fail. However, we use stat() rather than lstat(),
* because it's okay to write through a symlink (the noDereference stuff
* only applies to the source file).
*
* If the file doesn't exist, create it. If it does exist, truncate it.
*/
static int copyRegular(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
struct stat dstStat;
int srcFd, dstFd, statResult, copyResult;
DBUG(("--- copying regular '%s' to '%s'\n", src, dst));
statResult = stat(dst, &dstStat);
if (statResult == 0 && !S_ISREG(dstStat.st_mode)) {
fprintf(stderr,
"acp: destination '%s' exists and is not regular file\n",
dst);
return -1;
} else if (statResult != 0 && errno != ENOENT) {
fprintf(stderr, "acp: unable to stat destination '%s'\n", dst);
return -1;
}
if (statResult == 0) {
if (isSameFile(pSrcStat, &dstStat)) {
fprintf(stderr, "acp: '%s' and '%s' are the same file\n",
src, dst);
return -1;
}
if (options & COPY_UPDATE_ONLY) {
if (!isSourceNewer(pSrcStat, &dstStat)) {
DBUG(("--- source is not newer: '%s'\n", src));
printNotNewerMsg(src, dst, options);
return 0;
}
}
}
/* open src */
srcFd = open(src, O_RDONLY | O_BINARY, 0);
if (srcFd < 0) {
fprintf(stderr, "acp: unable to open '%s': %s\n", src, strerror(errno));
return -1;
}
/* open dest with O_CREAT | O_TRUNC */
DBUG(("--- opening '%s'\n", dst));
dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
if (dstFd < 0) {
if (errno == ENOENT) {
/* this happens if the target directory doesn't exist */
fprintf(stderr,
"acp: cannot create '%s': %s\n", dst, strerror(errno));
(void) close(srcFd);
return -1;
}
/* if "force" is set, try removing the destination file and retry */
if (options & COPY_FORCE) {
if (unlink(dst) != 0) {
#ifdef HAVE_MS_C_RUNTIME
/* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */
/* so try to change its mode, and unlink again */
if (errno == EACCESS) {
if (chmod(dst, S_IWRITE|S_IREAD) == 0 && unlink(dst) == 0)
goto Open_File;
}
#endif
fprintf(stderr, "acp: unable to remove '%s': %s\n",
dst, strerror(errno));
(void) close(srcFd);
return -1;
}
#ifdef HAVE_MS_C_RUNTIME
Open_File:
#endif
dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
}
}
if (dstFd < 0) {
fprintf(stderr, "acp: unable to open '%s': %s\n",
dst, strerror(errno));
(void) close(srcFd);
return -1;
}
copyResult = copyFileContents(dst, dstFd, src, srcFd);
(void) close(srcFd);
(void) close(dstFd);
if (copyResult != 0)
return -1;
#ifdef MACOSX_RSRC
{
char* srcRsrcName = NULL;
char* dstRsrcName = NULL;
struct stat rsrcStat;
srcRsrcName = malloc(strlen(src) + 5 + 1);
strcpy(srcRsrcName, src);
strcat(srcRsrcName, "/rsrc");
dstRsrcName = malloc(strlen(dst) + 5 + 1);
strcpy(dstRsrcName, dst);
strcat(dstRsrcName, "/rsrc");
if (stat(srcRsrcName, &rsrcStat) == 0 && rsrcStat.st_size > 0) {
DBUG(("--- RSRC: %s --> %s\n", srcRsrcName, dstRsrcName));
srcFd = open(srcRsrcName, O_RDONLY);
dstFd = open(dstRsrcName, O_TRUNC | O_WRONLY, 0);
copyResult = -1;
if (srcFd >= 0 && dstFd >= 0) {
copyResult = copyFileContents(dstRsrcName, dstFd,
srcRsrcName, srcFd);
(void) close(srcFd);
(void) close(dstFd);
}
if (copyResult != 0)
return -1;
}
free(srcRsrcName);
free(dstRsrcName);
}
#endif
setPermissions(dst, pSrcStat, options);
printCopyMsg(src, dst, options);
return 0;
}
#ifdef HAVE_SYMLINKS
/*
* Copy a symlink. This only happens if we're in "no derefence" mode,
* in which we copy the links rather than the files that are pointed at.
*
* We always discard the destination file. If it's a symlink already,
* we want to throw it out and replace it. If it's not a symlink, we
* need to trash it so we can create one.
*/
static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
struct stat dstStat;
char linkBuf[PATH_MAX+1];
int statResult, nameLen;
assert(options & COPY_NO_DEREFERENCE);
DBUG(("--- copying symlink '%s' to '%s'\n", src, dst));
/* NOTE: we use lstat() here */
statResult = lstat(dst, &dstStat);
if (statResult == 0 && !S_ISREG(dstStat.st_mode)
&& !S_ISLNK(dstStat.st_mode)
)
{
fprintf(stderr,
"acp: destination '%s' exists and is not regular or symlink\n",
dst);
return -1;
}
if (statResult == 0) {
if (isSameFile(pSrcStat, &dstStat)) {
fprintf(stderr, "acp: '%s' and '%s' are the same file\n",
src, dst);
return -1;
}
if (options & COPY_UPDATE_ONLY) {
if (!isSourceNewer(pSrcStat, &dstStat)) {
DBUG(("--- source is not newer: '%s'\n", src));
printNotNewerMsg(src, dst, options);
return 0;
}
}
}
/* extract the symlink contents */
nameLen = readlink(src, linkBuf, sizeof(linkBuf)-1);
if (nameLen <= 0) {
fprintf(stderr, "acp: unable to read symlink '%s': %s\n",
src, strerror(errno));
return -1;
}
linkBuf[nameLen] = '\0';
DBUG(("--- creating symlink file '%s' (--> %s)\n", dst, linkBuf));
if (statResult == 0) {
DBUG(("--- removing '%s'\n", dst));
if (unlink(dst) != 0) {
fprintf(stderr, "acp: unable to remove '%s': %s\n",
dst, strerror(errno));
return -1;
}
}
if (symlink(linkBuf, dst) != 0) {
fprintf(stderr, "acp: unable to create symlink '%s' [%s]: %s\n",
dst, linkBuf, strerror(errno));
return -1;
}
/*
* There's no way to set the file date or access permissions, but
* it is possible to set the owner.
*/
if (options & COPY_PERMISSIONS) {
if (lchown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0)
DBUG(("--- lchown failed: %s\n", strerror(errno)));
}
printCopyMsg(src, dst, options);
return 0;
}
#endif /* HAVE_SYMLINKS */
/*
* Copy the contents of one directory to another. Both "src" and "dst"
* must be directories. We will create "dst" if it does not exist.
*/
int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
int retVal = 0;
struct stat dstStat;
DIR* dir;
int cc, statResult;
DBUG(("--- copy dir '%s' to '%s'\n", src, dst));
statResult = stat(dst, &dstStat);
if (statResult == 0 && !S_ISDIR(dstStat.st_mode)) {
fprintf(stderr,
"acp: destination '%s' exists and is not a directory\n", dst);
return -1;
} else if (statResult != 0 && errno != ENOENT) {
fprintf(stderr, "acp: unable to stat destination '%s'\n", dst);
return -1;
}
if (statResult == 0) {
if (isSameFile(pSrcStat, &dstStat)) {
fprintf(stderr,
"acp: cannot copy directory into itself ('%s' and '%s')\n",
src, dst);
return -1;
}
} else {
DBUG(("--- creating dir '%s'\n", dst));
cc = mkdir(dst, 0755);
if (cc != 0) {
fprintf(stderr, "acp: unable to create directory '%s': %s\n",
dst, strerror(errno));
return -1;
}
/* only print on mkdir */
printCopyMsg(src, dst, options);
}
/*
* Open the directory, and plow through its contents.
*/
dir = opendir(src);
if (dir == NULL) {
fprintf(stderr, "acp: unable to open directory '%s': %s\n",
src, strerror(errno));
return -1;
}
while (1) {
struct dirent* ent;
char* srcFile;
char* dstFile;
int srcLen, dstLen, nameLen;
ent = readdir(dir);
if (ent == NULL)
break;
if (strcmp(ent->d_name, ".") == 0 ||
strcmp(ent->d_name, "..") == 0)
{
continue;
}
nameLen = strlen(ent->d_name);
srcLen = strlen(src);
dstLen = strlen(dst);
srcFile = malloc(srcLen +1 + nameLen +1);
memcpy(srcFile, src, srcLen);
srcFile[srcLen] = FSSEP;
memcpy(srcFile + srcLen+1, ent->d_name, nameLen +1);
dstFile = malloc(dstLen +1 + nameLen +1);
memcpy(dstFile, dst, dstLen);
dstFile[dstLen] = FSSEP;
memcpy(dstFile + dstLen+1, ent->d_name, nameLen +1);
if (copyFileRecursive(srcFile, dstFile, false, options) != 0)
retVal = -1; /* note failure and keep going */
free(srcFile);
free(dstFile);
}
closedir(dir);
setPermissions(dst, pSrcStat, options);
return retVal;
}
/*
* Do the actual copy. This is called recursively from copyDirectory().
*
* "dst" should only be a directory if "src" is also a directory.
*
* Returns 0 on success.
*/
static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options)
{
char* srcExe = NULL;
char* dstExe = NULL;
char* dstDir = NULL;
struct stat srcStat;
int retVal = 0;
int statResult, statErrno;
/*
* Stat the source file. If it doesn't exist, fail.
*/
if (options & COPY_NO_DEREFERENCE)
statResult = lstat(src, &srcStat);
else
statResult = stat(src, &srcStat);
statErrno = errno; /* preserve across .exe attempt */
#ifdef WIN32_EXE
/*
* Here's the interesting part. Under Cygwin, if you have a file
* called "foo.exe", stat("foo", ...) will succeed, but open("foo", ...)
* will fail. We need to figure out what its name is supposed to be
* so we can create the correct destination file.
*
* If we don't have the "-e" flag set, we want "acp foo bar" to fail,
* not automatically find "foo.exe". That way, if we really were
* trying to copy "foo", it doesn't grab something we don't want.
*/
if (isCmdLine && statResult == 0) {
int tmpFd;
tmpFd = open(src, O_RDONLY | O_BINARY, 0);
if (tmpFd < 0) {
statResult = -1;
statErrno = ENOENT;
} else {
(void) close(tmpFd);
}
}
/*
* If we didn't find the file, try it again with ".exe".
*/
if (isCmdLine && statResult < 0 && statErrno == ENOENT && (options & COPY_TRY_EXE)) {
srcExe = malloc(strlen(src) + 4 +1);
strcpy(srcExe, src);
strcat(srcExe, ".exe");
if (options & COPY_NO_DEREFERENCE)
statResult = lstat(srcExe, &srcStat);
else
statResult = stat(srcExe, &srcStat);
if (statResult == 0 && !S_ISREG(srcStat.st_mode))
statResult = -1; /* fail, use original statErrno below */
if (statResult == 0) {
/* found a .exe, copy that instead */
dstExe = malloc(strlen(dst) + 4 +1);
strcpy(dstExe, dst);
strcat(dstExe, ".exe");
src = srcExe;
dst = dstExe;
} else {
DBUG(("--- couldn't find '%s' either\n", srcExe));
}
}
#endif
if (statResult < 0) {
if (statErrno == ENOENT)
fprintf(stderr, "acp: file '%s' does not exist\n", src);
else
fprintf(stderr, "acp: unable to stat '%s': %s\n",
src, strerror(statErrno));
retVal = -1;
goto bail;
}
/*
* If "src" is a directory, ignore it if "recursive" isn't set.
*
* We want to create "dst" as a directory (or verify that it already
* exists as a directory), and then copy its contents.
*/
if (S_ISDIR(srcStat.st_mode)) {
if (!(options & COPY_RECURSIVE)) {
fprintf(stderr, "acp: omitting directory '%s'\n", src);
} else {
retVal = copyDirectory(src, dst, &srcStat, options);
}
#ifdef HAVE_SYMLINKS
} else if (S_ISLNK(srcStat.st_mode)) {
retVal = copySymlink(src, dst, &srcStat, options);
#endif
} else if (S_ISREG(srcStat.st_mode)) {
retVal = copyRegular(src, dst, &srcStat, options);
} else {
fprintf(stderr, "acp: skipping unusual file '%s' (mode=0%o)\n",
src, srcStat.st_mode);
retVal = -1;
}
bail:
free(srcExe);
free(dstExe);
free(dstDir);
return retVal;
}
int copyFile(const char* src, const char* dst, unsigned int options)
{
return copyFileRecursive(src, dst, true, options);
}

42
libs/host/Directories.cpp Normal file
View File

@ -0,0 +1,42 @@
#include <host/Directories.h>
#include <utils/String8.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_MS_C_RUNTIME
#include <direct.h>
#endif
using namespace android;
using namespace std;
string
parent_dir(const string& path)
{
return string(String8(path.c_str()).getPathDir().string());
}
int
mkdirs(const char* last)
{
String8 dest;
const char* s = last-1;
int err;
do {
s++;
if (s > last && (*s == '.' || *s == 0)) {
String8 part(last, s-last);
dest.appendPath(part);
#ifdef HAVE_MS_C_RUNTIME
err = _mkdir(dest.string());
#else
err = mkdir(dest.string(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP);
#endif
if (err != 0) {
return err;
}
last = s+1;
}
} while (*s);
return 0;
}

View File

@ -0,0 +1,30 @@
#ifndef _HOST_COPYFILE_H
#define _HOST_COPYFILE_H
#include <stdbool.h>
#include <sys/stat.h>
#if __cplusplus
extern "C" {
#endif
// command line options
enum {
COPY_NO_DEREFERENCE = 0x00010000, // copy symlink link instead of target
COPY_TRY_EXE = 0x00020000, // on Win32, try adding '.exe' to filename
COPY_FORCE = 0x00040000, // override access permissions
COPY_PERMISSIONS = 0x00080000, // preserve mode, ownership, timestamps
COPY_TIMESTAMPS = 0x00100000, // preserve mode, ownership, timestamps
COPY_RECURSIVE = 0x00200000, // copy directories
COPY_UPDATE_ONLY = 0x00400000, // only copy if source file is newer
COPY_VERBOSE_MASK = 0x000000ff // talk lots
};
int copyFile(const char* src, const char* dst, unsigned int options);
#if __cplusplus
} // extern "C"
#endif
#endif // _HOST_COPYFILE_H

View File

@ -0,0 +1,10 @@
#ifndef HOST_MKDIRS_H
#define HOST_MKDIRS_H
#include <string>
std::string parent_dir(const std::string& path);
extern "C" int mkdirs(const char* path);
#endif // HOST_MKDIRS_H

View File

@ -0,0 +1,9 @@
#ifndef HOST_PSEUDOLOCALIZE_H
#define HOST_PSEUDOLOCALIZE_H
#include <string>
std::string pseudolocalize_string(const std::string& source);
#endif // HOST_PSEUDOLOCALIZE_H

35
libs/host/list.java Normal file
View File

@ -0,0 +1,35 @@
import java.io.*;
public class list {
private static char nibble(int c) {
return (char)(c < 10 ? ('0' + c) : ('a' + (c-10)));
}
public static void main(String[] argv)
{
ByteArrayOutputStream stream = new ByteArrayOutputStream(100);
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(stream, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace(System.err);
}
int n = Integer.parseInt(argv[1], 16);
try {
writer.write(n);
writer.close();
} catch (IOException e) {
e.printStackTrace(System.err);
}
byte[] array = stream.toByteArray();
System.out.print(" case '" + argv[0] + "': return \"");
for (int i=0; i<array.length; i++) {
int b = array[i];
System.out.print("\\x" + nibble((b >> 4) & 0x0f) + nibble(b & 0xf));
}
System.out.println("\";");
}
}

View File

@ -0,0 +1,119 @@
#include <host/pseudolocalize.h>
using namespace std;
static const char*
pseudolocalize_char(char c)
{
switch (c) {
case 'a': return "\xc4\x83";
case 'b': return "\xcf\x84";
case 'c': return "\xc4\x8b";
case 'd': return "\xc4\x8f";
case 'e': return "\xc4\x99";
case 'f': return "\xc6\x92";
case 'g': return "\xc4\x9d";
case 'h': return "\xd1\x9b";
case 'i': return "\xcf\x8a";
case 'j': return "\xc4\xb5";
case 'k': return "\xc4\xb8";
case 'l': return "\xc4\xba";
case 'm': return "\xe1\xb8\xbf";
case 'n': return "\xd0\xb8";
case 'o': return "\xcf\x8c";
case 'p': return "\xcf\x81";
case 'q': return "\x51";
case 'r': return "\xd2\x91";
case 's': return "\xc5\xa1";
case 't': return "\xd1\x82";
case 'u': return "\xce\xb0";
case 'v': return "\x56";
case 'w': return "\xe1\xba\x85";
case 'x': return "\xd1\x85";
case 'y': return "\xe1\xbb\xb3";
case 'z': return "\xc5\xba";
case 'A': return "\xc3\x85";
case 'B': return "\xce\xb2";
case 'C': return "\xc4\x88";
case 'D': return "\xc4\x90";
case 'E': return "\xd0\x84";
case 'F': return "\xce\x93";
case 'G': return "\xc4\x9e";
case 'H': return "\xc4\xa6";
case 'I': return "\xd0\x87";
case 'J': return "\xc4\xb5";
case 'K': return "\xc4\xb6";
case 'L': return "\xc5\x81";
case 'M': return "\xe1\xb8\xbe";
case 'N': return "\xc5\x83";
case 'O': return "\xce\x98";
case 'P': return "\xcf\x81";
case 'Q': return "\x71";
case 'R': return "\xd0\xaf";
case 'S': return "\xc8\x98";
case 'T': return "\xc5\xa6";
case 'U': return "\xc5\xa8";
case 'V': return "\xce\xbd";
case 'W': return "\xe1\xba\x84";
case 'X': return "\xc3\x97";
case 'Y': return "\xc2\xa5";
case 'Z': return "\xc5\xbd";
default: return NULL;
}
}
/**
* Converts characters so they look like they've been localized.
*
* Note: This leaves escape sequences untouched so they can later be
* processed by ResTable::collectString in the normal way.
*/
string
pseudolocalize_string(const string& source)
{
const char* s = source.c_str();
string result;
const size_t I = source.length();
for (size_t i=0; i<I; i++) {
char c = s[i];
if (c == '\\') {
if (i<I-1) {
result += '\\';
i++;
c = s[i];
switch (c) {
case 'u':
// this one takes up 5 chars
result += string(s+i, 5);
i += 4;
break;
case 't':
case 'n':
case '#':
case '@':
case '?':
case '"':
case '\'':
case '\\':
default:
result += c;
break;
}
} else {
result += c;
}
} else {
const char* p = pseudolocalize_char(c);
if (p != NULL) {
result += p;
} else {
result += c;
}
}
}
//printf("result=\'%s\'\n", result.c_str());
return result;
}

45
target/board/Android.mk Normal file
View File

@ -0,0 +1,45 @@
#
# Set up product-global definitions and include product-specific rules.
#
ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
else
INSTALLED_2NDBOOTLOADER_TARGET :=
endif
else
INSTALLED_BOOTLOADER_MODULE :=
INSTALLED_2NDBOOTLOADER_TARGET :=
endif # TARGET_NO_BOOTLOADER
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
else
INSTALLED_KERNEL_TARGET :=
endif
ifneq ($(strip $(TARGET_NO_RADIOIMAGE)),true)
INSTALLED_RADIOIMAGE_TARGET := $(PRODUCT_OUT)/radio.img
else
INSTALLED_RADIOIMAGE_TARGET :=
endif
include $(TARGET_PRODUCT_DIR)/Android.mk
# Generate a file that contains various information about the
# device we're building for. This file is typically packaged up
# with everything else.
#
# If the file "board-info.txt" appears in $(TARGET_PRODUCT_DIR),
# it will be appended to the output file.
#
INSTALLED_ANDROID_INFO_TXT_TARGET := $(PRODUCT_OUT)/android-info.txt
board_info_txt := $(wildcard $(TARGET_PRODUCT_DIR)/board-info.txt)
$(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt)
$(call pretty,"Generated: ($@)")
$(hide) echo "board=$(TARGET_BOOTLOADER_BOARD_NAME)" > $@
ifdef board_info_txt
$(hide) cat $< >> $@
endif

View File

@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
file := $(TARGET_OUT_KEYLAYOUT)/tuttle2.kl
ALL_PREBUILT += $(file)
$(file) : $(LOCAL_PATH)/tuttle2.kl | $(ACP)
$(transform-prebuilt-to-target)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tuttle2.kcm
include $(BUILD_KEY_CHAR_MAP)

View File

@ -0,0 +1,9 @@
# config.mk
#
# Product-specific compile-time definitions.
#
# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
HAVE_HTC_AUDIO_DRIVER := true

View File

@ -0,0 +1,10 @@
The "emulator" product defines an almost non-hardware-specific target
without a kernel or bootloader, except that it defines the
HAVE_HTC_AUDIO_DRIVER constant, since that is what the emulator
emulates currently.
It can be used to build the entire user-level system, and
will work with the emulator.
It is not a product "base class"; no other products inherit
from it or use it in any way.

View File

@ -0,0 +1,66 @@
[type=QWERTY]
# keycode display number base caps fn caps_fn
A 'A' '%' 'a' 'A' '%' 0x00
B 'B' '=' 'b' 'B' '=' 0x00
C 'C' '8' 'c' 'C' '8' 0x00E7
D 'D' '5' 'd' 'D' '5' 0x00
E 'E' '2' 'e' 'E' '2' 0x0301
F 'F' '6' 'f' 'F' '6' 0x00A5
G 'G' '-' 'g' 'G' '-' '_'
H 'H' '[' 'h' 'H' '[' '{'
I 'I' '$' 'i' 'I' '$' 0x0302
J 'J' ']' 'j' 'J' ']' '}'
K 'K' '"' 'k' 'K' '"' '~'
L 'L' ''' 'l' 'L' ''' '`'
M 'M' '>' 'm' 'M' '>' 0x00
N 'N' '<' 'n' 'N' '<' 0x0303
O 'O' '(' 'o' 'O' '(' 0x00
P 'P' ')' 'p' 'P' ')' 0x00
Q 'Q' '*' 'q' 'Q' '*' 0x0300
R 'R' '3' 'r' 'R' '3' 0x20AC
S 'S' '4' 's' 'S' '4' 0x00DF
T 'T' '+' 't' 'T' '+' 0x00A3
U 'U' '&' 'u' 'U' '&' 0x0308
V 'V' '9' 'v' 'V' '9' '^'
W 'W' '1' 'w' 'W' '1' 0x00
X 'X' '7' 'x' 'X' '7' 0xEF00
Y 'Y' '!' 'y' 'Y' '!' 0x00A1
Z 'Z' '#' 'z' 'Z' '#' 0x00
COMMA ',' ',' ',' ';' ';' '|'
PERIOD '.' '.' '.' ':' ':' 0x2026
AT '@' '0' '@' '0' '0' 0x2022
SLASH '/' '/' '/' '?' '?' '\'
SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
ENTER 0xa 0xa 0xa 0xa 0xa 0xa
# on pc keyboards
TAB 0x9 0x9 0x9 0x9 0x9 0x9
0 '0' '0' '0' ')' ')' ')'
1 '1' '1' '1' '!' '!' '!'
2 '2' '2' '2' '@' '@' '@'
3 '3' '3' '3' '#' '#' '#'
4 '4' '4' '4' '$' '$' '$'
5 '5' '5' '5' '%' '%' '%'
6 '6' '6' '6' '^' '^' '^'
7 '7' '7' '7' '&' '&' '&'
8 '8' '8' '8' '*' '*' '*'
9 '9' '9' '9' '(' '(' '('
GRAVE '`' '`' '`' '~' '`' '~'
MINUS '-' '-' '-' '_' '-' '_'
EQUALS '=' '=' '=' '+' '=' '+'
LEFT_BRACKET '[' '[' '[' '{' '[' '{'
RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
BACKSLASH '\' '\' '\' '|' '\' '|'
SEMICOLON ';' ';' ';' ':' ';' ':'
APOSTROPHE ''' ''' ''' '"' ''' '"'
STAR '*' '*' '*' '*' '*' '*'
POUND '#' '#' '#' '#' '#' '#'
PLUS '+' '+' '+' '+' '+' '+'

View File

@ -0,0 +1,74 @@
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
key 212 SLASH
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 14 DEL
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 28 ENTER
key 56 ALT_LEFT
key 42 SHIFT_LEFT
key 215 AT
key 57 SPACE
key 53 SLASH
key 127 SYM
key 100 ALT_RIGHT
key 399 GRAVE

View File

@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
file := $(TARGET_OUT_KEYLAYOUT)/tuttle2.kl
ALL_PREBUILT += $(file)
$(file) : $(LOCAL_PATH)/tuttle2.kl | $(ACP)
$(transform-prebuilt-to-target)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tuttle2.kcm
include $(BUILD_KEY_CHAR_MAP)

View File

@ -0,0 +1,11 @@
# config.mk
#
# Product-specific compile-time definitions.
#
# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
TARGET_NO_RADIOIMAGE := true
HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true

View File

@ -0,0 +1,9 @@
The "generic" product defines a non-hardware-specific target
without a kernel or bootloader.
It can be used to build the entire user-level system, and
will work with the emulator, though sound will not work
(see the "emulator" product for that).
It is not a product "base class"; no other products inherit
from it or use it in any way.

View File

@ -0,0 +1,6 @@
#
# system.prop for generic sdk
#
rild.libpath=/system/lib/libreference-ril.so
rild.libargs=-d /dev/ttyS0

View File

@ -0,0 +1,66 @@
[type=QWERTY]
# keycode display number base caps fn caps_fn
A 'A' '%' 'a' 'A' '%' 0x00
B 'B' '=' 'b' 'B' '=' 0x00
C 'C' '8' 'c' 'C' '8' 0x00E7
D 'D' '5' 'd' 'D' '5' 0x00
E 'E' '2' 'e' 'E' '2' 0x0301
F 'F' '6' 'f' 'F' '6' 0x00A5
G 'G' '-' 'g' 'G' '-' '_'
H 'H' '[' 'h' 'H' '[' '{'
I 'I' '$' 'i' 'I' '$' 0x0302
J 'J' ']' 'j' 'J' ']' '}'
K 'K' '"' 'k' 'K' '"' '~'
L 'L' ''' 'l' 'L' ''' '`'
M 'M' '>' 'm' 'M' '>' 0x00
N 'N' '<' 'n' 'N' '<' 0x0303
O 'O' '(' 'o' 'O' '(' 0x00
P 'P' ')' 'p' 'P' ')' 0x00
Q 'Q' '*' 'q' 'Q' '*' 0x0300
R 'R' '3' 'r' 'R' '3' 0x20AC
S 'S' '4' 's' 'S' '4' 0x00DF
T 'T' '+' 't' 'T' '+' 0x00A3
U 'U' '&' 'u' 'U' '&' 0x0308
V 'V' '9' 'v' 'V' '9' '^'
W 'W' '1' 'w' 'W' '1' 0x00
X 'X' '7' 'x' 'X' '7' 0xEF00
Y 'Y' '!' 'y' 'Y' '!' 0x00A1
Z 'Z' '#' 'z' 'Z' '#' 0x00
COMMA ',' ',' ',' ';' ';' '|'
PERIOD '.' '.' '.' ':' ':' 0x2026
AT '@' '0' '@' '0' '0' 0x2022
SLASH '/' '/' '/' '?' '?' '\'
SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
ENTER 0xa 0xa 0xa 0xa 0xa 0xa
# on pc keyboards
TAB 0x9 0x9 0x9 0x9 0x9 0x9
0 '0' '0' '0' ')' ')' ')'
1 '1' '1' '1' '!' '!' '!'
2 '2' '2' '2' '@' '@' '@'
3 '3' '3' '3' '#' '#' '#'
4 '4' '4' '4' '$' '$' '$'
5 '5' '5' '5' '%' '%' '%'
6 '6' '6' '6' '^' '^' '^'
7 '7' '7' '7' '&' '&' '&'
8 '8' '8' '8' '*' '*' '*'
9 '9' '9' '9' '(' '(' '('
GRAVE '`' '`' '`' '~' '`' '~'
MINUS '-' '-' '-' '_' '-' '_'
EQUALS '=' '=' '=' '+' '=' '+'
LEFT_BRACKET '[' '[' '[' '{' '[' '{'
RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
BACKSLASH '\' '\' '\' '|' '\' '|'
SEMICOLON ';' ';' ';' ':' ';' ':'
APOSTROPHE ''' ''' ''' '"' ''' '"'
STAR '*' '*' '*' '*' '*' '*'
POUND '#' '#' '#' '#' '#' '#'
PLUS '+' '+' '+' '+' '+' '+'

View File

@ -0,0 +1,74 @@
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
key 212 SLASH
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 14 DEL
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 28 ENTER
key 56 ALT_LEFT
key 42 SHIFT_LEFT
key 215 AT
key 57 SPACE
key 53 SLASH
key 127 SYM
key 100 ALT_LEFT
key 399 GRAVE

View File

View File

@ -0,0 +1,22 @@
# config.mk
#
# Product-specific compile-time definitions.
#
# Don't try prelinking or compressing the shared libraries
# used by the simulator. The host OS won't know what to do
# with them, and they may not even be ELF files.
#
# These definitions override the defaults in config/config.make.
TARGET_COMPRESS_MODULE_SYMBOLS := false
TARGET_PRELINK_MODULE := false
# Don't try to build a bootloader.
TARGET_NO_BOOTLOADER := true
# Don't bother with a kernel
TARGET_NO_KERNEL := true
#the simulator partially emulates the original HTC /dev/eac audio interface
HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true

View File

@ -0,0 +1,32 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# This file should set PRODUCT_MAKEFILES to a list of product makefiles
# to expose to the build system. LOCAL_DIR will already be set to
# the directory containing this file.
#
# This file may not rely on the value of any variable other than
# LOCAL_DIR; do not use any conditionals, and do not look up the
# value of any variable that isn't set in this file or in a file that
# it includes.
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/generic.mk \
$(LOCAL_DIR)/sdk.mk \
$(LOCAL_DIR)/sim.mk \
$(LOCAL_DIR)/generic_with_google.mk

23
target/product/core.mk Normal file
View File

@ -0,0 +1,23 @@
PRODUCT_BRAND :=
PRODUCT_NAME :=
PRODUCT_DEVICE :=
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=F1_New_SMS.ogg
PRODUCT_PACKAGES := \
framework-res \
Browser \
Contacts \
Home \
HTMLViewer \
Phone \
ContactsProvider \
DownloadProvider \
GoogleSearch \
ImProvider \
ImCredentialProvider \
MediaProvider \
SettingsProvider \
TelephonyProvider \
PackageInstaller \
Bugreport

25
target/product/generic.mk Normal file
View File

@ -0,0 +1,25 @@
# This is a generic product that isn't specialized for a specific device.
# It includes the base Android platform. If you need Google-specific features,
# you should derive from generic_with_google.mk
PRODUCT_PACKAGES := \
AlarmClock \
AlarmProvider \
Calendar \
Camera \
DrmProvider \
Mms \
Music \
Settings \
Sync \
Updater \
CalendarProvider \
SubscribedFeedsProvider \
SyncProvider
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
# Overrides
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic

View File

@ -0,0 +1,13 @@
# This is a generic product that isn't specialized for a specific device.
# It includes the base Android platform including some Google-specific features.
# If you do not want to include Google specific features, you should derive
# from generic.mk
PRODUCT_PACKAGES := \
GoogleContactsProvider \
GoogleSubscribedFeedsProvider
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
# Overrides
PRODUCT_NAME := generic_with_google

13
target/product/sdk.mk Normal file
View File

@ -0,0 +1,13 @@
PRODUCT_PROPERTY_OVERRIDES :=
PRODUCT_PACKAGES := \
ApiDemos \
Development \
Fallback \
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
# Overrides
PRODUCT_BRAND := generic
PRODUCT_NAME := sdk
PRODUCT_DEVICE := generic

View File

@ -0,0 +1,38 @@
The following commands were used to generate the test key pair:
openssl genrsa -3 -out testkey.pem 2048
openssl req -new -x509 -key testkey.pem -out testkey.x509.pem -days 10000 \
-subj '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
openssl pkcs8 -in testkey.pem -topk8 -outform DER -out testkey.pk8 -nocrypt
Alternatively you can use the "mkkey.sh" command included in this directory.
The following standard test keys are currently included:
testkey -- a generic key for packages that do not otherwise specify a key.
platform -- a test key for packages that are part of the core platform.
shared -- a test key for things that are shared in the home/contacts process.
media -- a test key for packages that are part of the media/download system.
These test keys are used strictly in development, and should never be assumed
to convey any sort of validity. When $BUILD_SECURE=true, the code should not
honor these keys in any context.
signing using the openssl commandline (for boot/system images)
--------------------------------------------------------------
1. convert pk8 format key to pem format
% openssl pkcs8 -inform DER -nocrypt -in testkey.pk8 -out testkey.pem
2. create a signature using the pem format key
% openssl dgst -binary -sha1 -sign testkey.pem FILE > FILE.sig
extracting public keys for embedding
------------------------------------
it's a Java tool
but it generates C code
take a look at commands/recovery/Android.mk
you'll see it running $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar

Binary file not shown.

View File

@ -0,0 +1,27 @@
-----BEGIN CERTIFICATE-----
MIIEqDCCA5CgAwIBAgIJAPK5jmEjVyxOMA0GCSqGSIb3DQEBBAUAMIGUMQswCQYD
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
Fw0wODA0MTUyMzQwNTdaFw0zNTA5MDEyMzQwNTdaMIGUMQswCQYDVQQGEwJVUzET
MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p
ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI
hvcNAQEBBQADggENADCCAQgCggEBAK4lDFoW75f8KGmsZRsyF8w2ug6GlkFo1YoE
n0DOhYZxI6P/tPbZScM88to6BcI+rKpX2AOImxdZvPWefG8hiQriUIW37VaqYmwJ
ie+czTY2LKDo0blgP9TYModnkmzMCQxot3Wuf/MJNMw2nvKFWiZn3wxmf9DHz12O
umVYBnNzA7tiRybquu37cvB+16dqs8uaOBxLfc2AmxQNiR8AITvkAfWNagamHq3D
qcLxxlZyhbCa4JNCpm+kIer5Ot91c6AowzHXBgGrOvfMhAM+znx3KjpbhrDb6dd3
w6SKqYAe3O4ngVifRNnkETl5YAV2qZQQuoEJElna2YxsaP94S48CAQOjgfwwgfkw
HQYDVR0OBBYEFMopPKqLwO0+VC7vQgWiv/K1fk11MIHJBgNVHSMEgcEwgb6AFMop
PKqLwO0+VC7vQgWiv/K1fk11oYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH
QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG
CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAPK5jmEjVyxOMAwGA1Ud
EwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBAITelRbV5KhyF6c9qEhwSPUzc6X3
M/OQ1hvfPMnlJRYlv8qnwxWcriddFyqa4eh21UWBJ6xUL2gpDdUQwAKdj1Hg7hVr
e3tazbOUJBuOx4t05cQsXK+uFWyvW9GZojonUk2gct6743hGSlM2MLDk0P+34I7L
cB+ttjecdEZ/bgDG7YiFlTgHkgOHVgB4csjjAHr0I6V6LKs6KChptkxLe9X8GH0K
fiQVll1ark4Hpt91G0p16Xk8kYphK4HNC2KK7gFo3ETkexDTWTJghJ1q321yfcJE
RMIh0/nsw2jK0HmZ8rgQW8HyDTjUEGbMFBHCV6lupDSfV0ZWVQfk6AIKGoE=
-----END CERTIFICATE-----

View File

@ -0,0 +1,15 @@
if ["$1" == ""]; then
echo "Create a test certificate key."
echo "Usage: $0 NAME"
echo "Will generate NAME.pk8 and NAME.x509.pem"
echo " /C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com"
return
fi
openssl genrsa -3 -out $1.pem 2048
openssl req -new -x509 -key $1.pem -out $1.x509.pem -days 10000 \
-subj '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
openssl pkcs8 -in $1.pem -topk8 -outform DER -out $1.pk8 -nocrypt

Binary file not shown.

View File

@ -0,0 +1,27 @@
-----BEGIN CERTIFICATE-----
MIIEqDCCA5CgAwIBAgIJALOZgIbQVs/6MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYD
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
Fw0wODA0MTUyMjQwNTBaFw0zNTA5MDEyMjQwNTBaMIGUMQswCQYDVQQGEwJVUzET
MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p
ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI
hvcNAQEBBQADggENADCCAQgCggEBAJx4BZKsDV04HN6qZezIpgBuNkgMbXIHsSAR
vlCGOqvitV0Amt9xRtbyICKAx81Ne9smJDuKgGwms0sTdSOkkmgiSQTcAUk+fArP
GgXIdPabA3tgMJ2QdNJCgOFrrSqHNDYZUer3KkgtCbIEsYdeEqyYwap3PWgAuer9
5W1Yvtjo2hb5o2AJnDeoNKbf7be2tEoEngeiafzPLFSW8s821k35CjuNjzSjuqtM
9TNxqydxmzulh1StDFP8FOHbRdUeI0+76TybpO35zlQmE1DsU1YHv2mi/0qgfbX3
6iANCabBtJ4hQC+J7RGQiTqrWpGA8VLoL4WkV1PPX8GQccXuyCcCAQOjgfwwgfkw
HQYDVR0OBBYEFE/koLPdnLop9x1yh8Tnw48ghsKZMIHJBgNVHSMEgcEwgb6AFE/k
oLPdnLop9x1yh8Tnw48ghsKZoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH
QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG
CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJALOZgIbQVs/6MAwGA1Ud
EwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBAFclUbjZOh9z3g9tRp+G2tZwFAAp
PIigzXzXeLc9r8wZf6t25iEuVsHHYc/EL9cz3lLFCuCIFM78CjtaGkNGBU2Cnx2C
tCsgSL+ItdFJKe+F9g7dEtctVWV+IuPoXQTIMdYT0Zk4u4mCJH+jISVroS0dao+S
6h2xw3Mxe6DAN/DRr/ZFrvIkl5+6bnoUvAJccbmBOM7z3fwFlhfPJIRc97QNY4L3
J17XOElatuWTG5QhdlxJG3L7aOCA29tYwgKdNHyLMozkPvaosVUz7fvpib1qSN1L
IC7alMarjdW4OZID2q4u1EYjLk/pvZYTlMYwDlE448/Shebk5INTjLixs1c=
-----END CERTIFICATE-----

Binary file not shown.

View File

@ -0,0 +1,27 @@
-----BEGIN CERTIFICATE-----
MIIEqDCCA5CgAwIBAgIJAPKnM5a9OHZ6MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYD
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
Fw0wODA3MjMyMTU3NTlaFw0zNTEyMDkyMTU3NTlaMIGUMQswCQYDVQQGEwJVUzET
MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p
ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI
hvcNAQEBBQADggENADCCAQgCggEBAMjC2/0JSi30XD/xoy7SGAXscvxY0BeXG9D2
tSwmLXCBnRkZZ+FY39Oix/Gz4OgM5UXXnShIIgIR64bw/YMS03tCDBE3UMyUYYro
cvSIZGO9xGJ8qgwEg8hkk+NRVXEXAzi/3MTNat3RwKLzX1zyTtPkBDo+WOKwXmZM
zeEry2dzX9bfEknDaeYlQrwKRynlORf1w4/6UtF7c8nHN5jdsY7UgVkIdVR+Zr/F
2spMJabrlg7ZaSNwnaMCumRstJazJehsXIsuejN3srvkx88zJUKRFj9okVKsCIVQ
yDxQj0v1rfCu1aLcoFg/mrCtF2UNt+6ksj/bRYhVR9D+q3IYOIkCAQOjgfwwgfkw
HQYDVR0OBBYEFMtMfizbs/CtqY2reZaNFy6dux7RMIHJBgNVHSMEgcEwgb6AFMtM
fizbs/CtqY2reZaNFy6dux7RoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH
QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG
CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAPKnM5a9OHZ6MAwGA1Ud
EwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBAECo0JaZeVnpF6NsRCRra6wrrgVD
fs2JeUEY94NHIDUtHG+KObCGmUL02mWYH6opUdM5cRKewZIdeVZxxSfW4knyUoKf
r1tZExAxHi3gllANVorUEUplbcNKjG9hBFOvwep5ktukqns/hUOm41wHKN53/pfu
rIN3H9DskPjkRJQ07gtgRXg+cMei5GAkkmDgA892CNw1Kkye9wbe9LJgUOl4ri//
16MyN4cBSRXrPMh0/MeprpMId8XIx9HC4qjuhjyJGA0YVc7bpADnukPMyqckPTl+
fA6Ojk19T5K2u+rUnAzwGAae3coufi+0Zo2J2715UNDNJUGA+h6q/CpVb4Q=
-----END CERTIFICATE-----

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More