Game Development Reference
In-Depth Information
The agcc script defines a series of variables that can be adjusted to match your system (if you choose
to install the G++ toolchain and Android source in different locations):
HOME : This is the root location where all the software components reside (in this
case, /user/home ). This variable is used within other variables.
JAVA_HOME : This is the location of the Java SDK. You need a Java SDK for building
the hybrid games that mix Java and C code, which talk to each other using JNI.
From the SDK, you'll use JNI header files and JNI libraries.
SYS_ROOT : This is the location of the device's system libraries extracted from the
device in the previous section. The default value is $HOME/tmp/android/system .
SYS_DEV : This is the location of the Android source you downloaded earlier. From
this code, you will use header files and shared libraries. The default value is
$HOME/mydroid .
TOOLCHAIN_ROOT : This is the location where the CodeSourcery toolchain is installed
( $HOME/Desktop/android/arm-2008q3 in this case).
Next, the script defines the locations of the basic libraries used in the compilation step. The
following are the most important:
C runtime (LIBC) : This is the location of the C runtime header files, located under
$SYS_DEV/bionic/libc .
Math library (LIBM) : This is a commonly used library. It contains system functions
such as pow , trigonometric functions, and others. It is located under
${SYS_DEV}/bionic/libm .
Kernel headers (KERNEL) : Kernel headers are likely to be used by your games,
especially high-performance 3D games. It is located under ${SYS_DEV}/kernel .
GNU Gzip (LIBZ) : If your game manipulates zip files, you'll need this library. It is
located under ${SYS_DEV}/external/zlib .
XML parser (EXPAT) : Most of today's modern games use XML files to store game
and configuration information. Thus, this library is required. By default, it is
located under ${SYS_DEV}/external/expat/lib .
The following are other variables that are used to include extra compile-time dependencies:
BASE=$SYS_DEV/frameworks/base
TC=${SYS_DEV}/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/lib/gcc/arm-eabi/4.3.1
Next, the script defines the paths to the required header locations (with AND_INC ) as a sequence of
includes: -Ipath1 , -Ipath2 , and so on. And, finally, the critical step is to call the toolchain gcc command,
as follows:
${GCC} -nostdinc ${AND_INC} "$@"
${GCC} will expand to arm-none-linux-gnueabi-gcc , ${AND_INC} will expand to the previously defined
includes, and "$@" indicates that all arguments sent by the user should be passed along. Note the
parameter -nostdinc . This is a critical argument that tells the compiler not to include the standard
Search WWH ::




Custom Search