|
The MIDP build environment is a set of makefiles, the Java™ platform tools, and the free tools from the CygWin project such as gcc and make. For more information on CygWin tools, see:
http://sources.redhat.com/cygwin
The tools and makefiles work together to create a specific target. A target is a name in a makefile that is associated with a file or set of related files on which a set of commands will be run. The commands will typically act on the target’s files to create, update, or delete them.
The build environment provides configuration options to enable you to customize the target. For example, configuration options control whether to include debugging symbols. These configuration options are macros in the makefiles.
Gnumake accepts targets and configuration options on the command line using the general syntax:
The make command has more options, however. See your make documentation for more information. Instead of being a make tutorial, this section shows you how to use the tool in the context of the MIDP build environment.
This chapter contains advice to help you build different versions of the midp executable command. It contains the sections:
This section covers the makefiles that the make command uses, how to run a build, and how the full build works. It contains the sections:
The Release Contents contains a list of all files in the build. The table in this section shows only the makefiles, along with a brief description of their purposes, in roughly the order that they are used in the build. In the table, midpInstallDir is the directory that holds your MIDP installation. In addition, when a file is in a shared directory, the table shows the directory with Windows-style separators (\).
For more information on the targets in these makefiles, see Appendix A, "Build Targets.” For more information on the definitions, see Appendix B, "Configuration Options.”
To build the MIDP executable or documentation bundle:
On a Microsoft Windows platform this is the directory midpInstallDir\build\win32\kvm. For example:
On a UNIX® platform, the directory is midpInstallDir/build/linux/kvm or midpInstallDir/build/solaris.
You can choose to use the default target and configuration options, or choose other targets and options.
The default build target, all, creates a MIDP executable and builds the examples. The default configuration options direct the build environment to create an executable that supports the full CLDC reference implementation, supports internationalization, and does not include debugging symbols.
See Appendix A, "Build Targets” for a list of targets and common build options.
Providing no arguments uses the default build target and configuration-options.
For example, to clean up from any previous builds, then build a MIDP executable you would run the command:
If the target that you use creates a MIDP executable, it will be placed in the following directory:
\build\win32\kvm\bin on a Microsoft Windows 2000 platform/build/linux/kvm/bin on a Linux platform/build/solaris/bin in the Solaris™ Operating Environment.The following list describes common functionality requirements and the combinations of targets and configuration-options that provide them.
The command uses the default build target, all and creates the MIDP executable midp.
gdb if you compiled with gcc).
The command uses the default build target, all and creates the MIDP executable midp_g.
The command uses the default build target, all and creates the MIDP executable midp.
The command creates the MIDP executable midp.
classes.zip file:The command does not create the MIDP executable.
When you build the MIDP Reference Implementation with the target all, GNUmake performs the following steps:
classes.zip fileclasses.zip and generates ROMjavaplatform.cextractOffsets toolextractOffsets tool to generate header files with offsets into the classes of the Java programming languageMEKeyTool and JadTool utilities/build/appdb directory
The MIDP build environment allows you to add new class files and object files to the build that are not part of the source distribution. To add the files, you must update the contents of the Defs-pre.gmk file. (See TABLE 7 for more information on this file.)
This section shows you how to update the file in the topics:
You can add two types of classes written in the Java programming language to the build: platform-specific and platform-generic.
If you add platform-specific classes, they must be in PLATFORM_CLASS_DIR, which has the default value midpInstallDir/src/platform/classes. There is no required location for platform-generic classes.
The two types of classes are held in different variables in the Defs-pre.gmk file:
PLATFORM_INCLUDE_CLASSES — Holds the file names of platform-specific classes. The filenames that are the value of this variable have the form
Note that these file names use a slash (“/”) delimiter, even on Windows 2000.
MIDP_INCLUDE_CLASSES — Holds the file names of platform-generic classes.
To add a file to one of these variables, add a line that has the following syntax to the Defs-pre.gmk file:
For example, to add the platform-specific class com.MyCompany.productY.Foo, you would update the PLATFORM_INCLUDE_CLASSES variable like this:
Similarly, to add the platform-generic class com.MyCompany.midp.bar, you would update the MIDP_INCLUDE_CLASSES variable like this:
The classes will be included in the build the next time you use the default target, all.
You can add two types of C language files to the build: platform-specific and platform-generic. Different variables in Defs-pre.gmk hold these two kinds of files:
PLATFORM_INCLUDE_SRC — Holds the names of platform-specific C filesMIDP_INCLUDE_SRC — Holds the names of platform-generic C files
To add a file to one of these variables, add a line that has the following syntax to the Defs-pre.gmk file:
For example, to add the platform-specific file, productY_natives.c, you would update the PLATFORM_INCLUDE_SRC variable like this:
Similarly, to add the platform-generic file, common_natives.c, you would update the MIDP_INCLUDE_SRC variable like this:
This is the normal way to add native method implementations to MIDP. The files will be included in the build the next time you use the default target, all.
Removing unused code can improve the footprint of your port. This section covers two areas where you might find code to remove: configuration code and code made obsolete by your customization.
The MIDP Reference Implementation uses a configuration mechanism to select among alternate behaviors at runtime. In commercial ports of the RI, many of these design choices will have been made. (For example, whether the device has a color or grey scale screen.) You can eliminate the branches created by the configuration options that your device does not use. To locate these branches, look for calls to the Configuration.getProperty method. The list of classes that include optional behavior based on calls to access configuration parameters is:
com.sun.midp.Maincom.sun.midp.io.j2me.http.Protocolcom.sun.midp.io.j2me.https.Protocolcom.sun.midp.io.j2me.socket.Protocolcom.sun.midp.io.j2me.comm.Protocolcom.sun.midp.lcdui.InputMethodHandlercom.sun.midp.lcdui.Resourcecom.sun.midp.midlet.Schedulercom.sun.midp.midletsuite.Installerjavax.microedition.lcdui.DisplayIn addition, if you have customized the MIDP Reference Implementation (for example, by re-implementing one or more components in native code), there could be Java programming language or C code that is no longer used. Some examples have already appeared in the text, such as in Section 6.3 "Using Native Widgets for MIDP Screens" . You can use the examples in this guide as a starting point for a more thorough search.
|
Porting MIDP MIDP Reference Implementation, Version 2.0 FCS |
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.