HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 97 (of 101)
Chapter 11 Software Development
October 29, 2013
Compiler Related Variables
Every HP compiler knows a specific environment variable that is read by the compiler frontend
to allow specifying additional command line parameters without making changes to the
command line itself.
The contents of this variable are handled as if they were passed to the compiler on the command
line. This makes it easy to pass additional parameters to a compile command, even if the
command itself is located somewhere in a cascaded makefile structure.
The following table lists these variables for each compiler:
Variable
Compiler
CCOPTS
C (bundled and ANSI)
CXXOPTS
ANSI C++)
HP_F90OPTS
Fortran 90
E.g. if we wanted to switch on the verbose mode of cc, we simply could do
export CCOPTS=-v # for sh, ksh
setenv CCOPTS -v # for csh
Then every subsequently executed compiler call would use the -v option, although it is not
specified at the command line, and so each compilation would be done in verbose mode.
Because often the order of the compiler options is important, these environment variables
provide a way to add the options before and after the options specified on the command line. E.g.
if we would do the following:
export CCOPTS="-v|-lcl"
cc -o HelloWorld HelloWorld.c
the resulting command line would be
cc -v o HelloWorld HelloWorld.c -lcl
Everything before the pipe symbol is added at the beginning of the command line, and
everything after the pipe symbol at the end. Details on using these variables can be found in the
appropriate compiler man pages.