Setting Up the Code Generation Environment
2-6
Identifying alternate directories for the compiler to search (C_DIR)
The compiler uses the C_DIR environment variable to name alternate direc-
tories that contain #include files and function libraries. To set the C_DIR envi-
ronment variable, use this syntax:
set C_DIR=
pathname
1
[;
pathname
2
. . .]
The
pathnames
are directories that contain #include files or libraries (such as
stdio.h). You can separate the pathnames with a semicolon or with a blank. In
C source, you can use the #include directive without specifying path informa-
tion. Instead, you can specify the path information with C_DIR.
Setting default shell options (C_OPTION)
You may find it useful to set the compiler, assembler, and linker default shell
options using the C_OPTION environment variable. If you do this, the shell
uses the default options and/or input filenames that you name with C_OPTION
every time you run the shell.
Setting up default options with the C_OPTION environment variable is useful
when you want to run the shell consecutive times with the same set of options
and/or input files. After the shell reads the command line and the input file-
names, it reads the C_OPTION environment variable and processes it.
To set the C_OPTION environment variable, use this syntax:
set C_OPTION=
option
1
[
option
2
. . .
]
Environment variable options are specified in the same way and have the
same meaning as they do on the command line. For example, if you want to
always run quietly (the –q option), enable C source interlisting (the –s option),
and link (the –z option), set up the C_OPTION environment variable as follows:
set C_OPTION=–qs –z
In the following examples, each time you run the compiler shell, it runs the
linker. Any options following –z on the command line or in C_OPTION are
passed to the linker. This enables you to use the C_OPTION environment vari-
able to specify default compiler and linker options and then specify additional
compiler and linker options on the shell command line. If you have set –z in
the environment variable and want to compile only, use the –c option of the
shell. These additional examples assume C_OPTION is set as shown above:
cl470 *.c ; compiles and links
cl470 –c *.c ; only compiles
cl470 *.c –z lnk.cmd ; compiles and links using a
; command file
cl470 –c *.c –z lnk.cmd ; only compiles (–c overrides –z)