Chapter 23. Generated Build Script

The -genbuild option causes a build script to be generated. This script can be used to Java compile the generated source files.

For Windows, the -w32 command line option should be specified along with -genbuild to generate a DOS batch file (.bat). This file is named build.bat.

For Linux/UNIX, a shell script is generated. The name of this file is build.sh.

When a build script is generated, it is assumed that the ASN1C project exists within the ASN1C installation directory tree. The generation logic tries to determine the root directory of the installation by traversing upward from the project directory in an attempt to locate the java subdirectory which is assumed to be the installation root directory. If the project is located outside of the ASN1C hierarchy, the user can set the OSROOTDIR environment variable to point at the root directory.

If the root directory is located successfully, the generated build script will use that directory; however, if the compiler fails to find the installation root directory, it will use @ROOT_DIR@ instead and print an error message. Users will have to manually replace @ROOT_DIR@ with the actual compiler installation root directory. Also, for the -xer or -xml option along with -genbuild, an XML parser is required. The compiler will try to locate a parser and use it if found. However, if a parser is not found, then the compiler will use @XERCES_ROOT@ instead of the parser root directory. An error message will be printed and the user will update the file accordingly.