diff --git a/core/build-system.html b/core/build-system.html index caade583b..3f638c3b0 100644 --- a/core/build-system.html +++ b/core/build-system.html @@ -462,26 +462,17 @@ LOCAL_GENERATED_SOURCES += $(GEN)

Sometimes you need to set flags specifically for different platforms. Here is a list of which values the different build-system defined variables will be set to and some examples.

-

For a device build, TARGET_OS is linux (we're using -linux!), and TARGET_ARCH is arm.

-

For a simulator build, TARGET_OS and TARGET_ARCH -are set to the same as HOST_OS and HOST_ARCH are -on your platform. TARGET_PRODUCT is the name of the target -hardware/product you are building for. The value sim is used -for the simulator. We haven't thought through the full extent of customization -that will happen here, but likely there will be additional UI configurations -specified here as well.

- -
HOST_OS
linux
- darwin
- (cygwin) + darwin
HOST_ARCH
- x86 + x86
+ x86_64
HOST_BUILD_TYPE
@@ -490,43 +481,41 @@ specified here as well.

- TARGET_OS
- linux
- darwin
- (cygwin) -
TARGET_ARCH
arm
- x86 + arm64
+ mips
+ mips64
+ x86
+ x86_64
TARGET_BUILD_TYPE
release
debug
- TARGET_PRODUCT
- sim
- dream
- sooner -
+

There are also special variables to use instead of conditionals. Many of the +normal variables (LOCAL_SRC_FILES, LOCAL_CFLAGS, etc) can be conditionally added +to with _{arch} _{32|64}, and for the host, _{os}.

+

Some Examples

ifeq ($(TARGET_BUILD_TYPE),release)
 LOCAL_CFLAGS += -DNDEBUG=1
 endif
 
+LOCAL_CFLAGS_arm += -DTARGET_IS_ARM
+
+LOCAL_CFLAGS_64 += -DBIG_POINTER
+
 # from libutils
-ifeq ($(TARGET_OS),linux)
 # Use the futex based mutex and condition variable
 # implementation from android-arm because it's shared mem safe
-LOCAL_SRC_FILES += futex_synchro.c
-LOCAL_LDLIBS += -lrt -ldl
-endif
+LOCAL_SRC_FILES_linux += futex_synchro.c
+LOCAL_LDLIBS_linux += -lrt -ldl
 
 
@@ -554,7 +543,7 @@ LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) the unstripped executables so GDB can find the symbols. LOCAL_UNSTRIPPED_PATH is not necessary if you only specified LOCAL_MODULE_RELATIVE_PATH.

-

Look in config/envsetup.make for all of the variables defining +

Look in core/envsetup.mk for all of the variables defining places to build things.

FYI: If you're installing an executable to /sbin, you probably also want to set LOCAL_FORCE_STATIC_EXCUTABLE := true in your Android.mk, which @@ -587,6 +576,11 @@ alphabetically.

and definitions that are specific to either the host or the target builds. Do not set variables that start with HOST_ or TARGET_ in your makefiles. +
  • HOST_CROSS_ - These contain the directories and definitions that + are specific to cross-building host binaries. The common case is building + windows host tools on linux. Do not set variables that start with + HOST_CROSS_ in your makefiles. +
  • BUILD_ and CLEAR_VARS - These contain the names of well-defined template makefiles to include. Some examples are CLEAR_VARS and BUILD_HOST_PACKAGE.
  • @@ -773,13 +767,13 @@ LOCAL_POST_PROCESS_COMMAND := /Developer/Tools/Rez -d __DARWIN__ -t APPL\

    LOCAL_PREBUILT_EXECUTABLES

    -

    When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to -executables that you want copied. They're located automatically into the +

    When including $(BUILD_MULTI_PREBUILT) or $(BUILD_HOST_PREBUILT), set these +to executables that you want copied. They're located automatically into the right bin directory.

    LOCAL_PREBUILT_LIBS

    -

    When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to -libraries that you want copied. They're located automatically into the +

    When including $(BUILD_MULTI_PREBUILT) or $(BUILD_HOST_PREBUILT), set these +to libraries that you want copied. They're located automatically into the right lib directory.

    LOCAL_SHARED_LIBRARIES

    @@ -836,6 +830,16 @@ set LOCAL_UNSTRIPPED_PATH, the unstripped binaries will also use the relative path.

    See Putting modules elsewhere for more.

    +

    LOCAL_MODULE_HOST_OS

    +

    This specifies which OSes are supported by this host module. It is not used +for target builds. The accepted values here are combinations of +linux, darwin, and windows. By default, +linux and darwin(MacOS) are considered to be supported. If a module should +build under windows, you must specify windows, and any others to be supported. +Some examples:

    +

    LOCAL_MODULE_HOST_OS := linux
    +LOCAL_MODULE_HOST_OS := darwin linux windows

    +

    LOCAL_UNSTRIPPED_PATH

    Instructs the build system to put the unstripped version of the module somewhere other than what's normal for its type. Usually, you override this @@ -878,10 +882,10 @@ system expects, it fails printing an error message explaining what happened. If you make a change that requires an update, you need to update two places so this message will be printed.

    The scripts automatically get the value from the build system, so they will trigger the warning as well. @@ -900,53 +904,39 @@ isn't actually built in to it, you can add those make targets to for some other dependency that isn't created automatically.

    LOCAL_BUILT_MODULE

    +

    This should not be used, since multiple binaries are now +created from a single module defintiion.

    When a module is built, the module is created in an intermediate directory then copied to its final location. LOCAL_BUILT_MODULE is the full path to the intermediate file. See LOCAL_INSTALLED_MODULE for the path to the final installed location of the module.

    -

    LOCAL_HOST

    -

    Set by the host_xxx.make includes to tell base_rules.make and the other -includes that we're building for the host. Kenneth did this as part of -openbinder, and I would like to clean it up so the rules, includes and -definitions aren't duplicated for host and target.

    +

    LOCAL_IS_HOST_MODULE

    +

    Set by the host_xxx.mk includes to tell base_rules.mk and the other +includes that we're building for the host.

    LOCAL_INSTALLED_MODULE

    +

    This should not be used, since multiple binaries are now +created from a single module defintiion.

    The fully qualified path name of the final location of the module. See LOCAL_BUILT_MODULE for the location of the intermediate file that the make rules should actually be constructing.

    -

    LOCAL_REPLACE_VARS

    -

    Used in some stuff remaining from the openbinder for building scripts -with particular values set,

    - -

    LOCAL_SCRIPTS

    -

    Used in some stuff remaining from the openbinder build system that we -might find handy some day.

    -

    LOCAL_MODULE_CLASS

    Which kind of module this is. This variable is used to construct other -variable names used to locate the modules. See base_rules.make and -envsetup.make.

    - -

    LOCAL_MODULE_NAME

    -

    Set to the leaf name of the LOCAL_BUILT_MODULE. I'm not sure, -but it looks like it's just used in the WHO_AM_I variable to identify -in the pretty printing what's being built.

    +variable names used to locate the modules. See base_rules.mk and +envsetup.mk.

    LOCAL_MODULE_SUFFIX

    The suffix that will be appended to LOCAL_MODULE to form LOCAL_MODULE_NAME. For example, .so, .a, .dylib.

    LOCAL_STRIP_MODULE

    -

    Calculated in base_rules.make to determine if this module should actually -be stripped or not, based on whether LOCAL_STRIPPABLE_MODULE -is set, and whether the combo is configured to ever strip modules. With -Iliyan's stripping tool, this might change.

    - -

    LOCAL_STRIPPABLE_MODULE

    -

    Set by the include makefiles if that type of module is strippable. -Executables and shared libraries are.

    +

    If set to true (the default), the binary will be stripped and a debug +link will be set up so that GDB will still work. If set to no_debuglink, +the binary will be stripped, but no debug link will be added. If set to +keep_symbols, it will strip the debug information, but keep the symbol table. +Any other value will prevent stripping.

    LOCAL_SYSTEM_SHARED_LIBRARIES

    Used while building the base libraries: libc, libm, libdl. Usually