IBM SC34-4499-03 Personal Computer User Manual


 
Writing a simple build script
This kind of build script is written into the Script attribute of the builder. When you
create or modify the builder, you specify in this attribute the name of the transformation
tool to be invoked.
For example, suppose you want to create a builder that compiles a C source file into a
.exe file using IBM’s VisualAge C++ compiler. You specify the following attributes for the
builder:
Build script
icc
Parameters
"$(TC_INPUT) /Fe$(TC_OUTPUT)"
You can create this builder using the following command:
teamc builder -create c_builder -env OS2 -script icc -none
-parameters "$(TC_INPUT) /Fe$(TC_OUTPUT)"
If you use this builder to create hello.exe from hello.c, the command actually issued
during the build process is the following:
"icc hello.c /Fehello.exe"
Writing an executable file for a build script
Suppose you need to build a C application and you want to specify at build time
whether to use debug information. To do this, you define in the builder parameters a
variable called
debug
and set the variable when you start the build. In this case, you
need a build script that is a separate executable file to pass the debug parameter after
the variable substitution.
For a build script of this form, you first write a program or command file; this file is
stored in the TeamConnection database when you create the builder. When a build is
performed, this build script file is extracted from the database and run. It interprets the
parameters passed to it and then invokes the actual transformation tool, such as the
compiler.
Our earlier example describes a builder that compiles a C source file into a .obj file
using IBM’s VisualAge C++ compiler. Using this builder, you can specify at build time
whether to use debug information. Here is the complete build script for such a builder,
written in IBM’s REXX language (it could just as easily have been written in C or
COBOL).
/* sample C Build Script using debug flag */
parse arg parms
environ = 'OS2ENVIRONMENT'
input = VALUE('TC_INPUT',,environ)
output = VALUE('TC_OUTPUT',,environ)
Chapter 12. Working with build scripts and builders 153