Print this page
cw: give cw(1onbld) a new interface allowing for multiple arbitrary shadows
*** 1,195 ****
CW(1ONBLD) illumos Build Tools CW(1ONBLD)
-
-
NAME
cw - invoke one or more compilers with argument translation
SYNOPSIS
! cw {-_cc|-_gcc|-_CC|-_g++} [options] [compiler args...]
DESCRIPTION
cw is a facility for invoking one or more compilers, providing
! translation from Sun Studio arguments as appropriate. This allows the
! use of arbitrary compilers without the need to alter large numbers of
! makefiles. A mode called shadow compilation, the default, invokes two
! different compilers so that warnings and errors may be obtained from
! both. See SHADOW COMPILATION for details. This version of cw supports
! Sun Studio 10 and 11 and gcc 3.4.3 as shipped in Solaris.
ARGUMENTS
! Exactly one of the following arguments is required, and must appear
! immediately following cw in the argument list:
!
! -_cc
! Select Sun Studio C (cc) as the primary compiler.
!
! -_gcc
! Select GNU C (gcc) as the primary compiler.
!
! -_CC
! Select Sun Studio C++ (CC) as the primary compiler.
!
! -_g++
! Select GNU C++ (g++) as the primary compiler.
!
! OPTIONS
! The following options are supported:
!
! -_compiler
! Do not invoke any compiler; instead, write to standard output the
! full path to the primary compiler that would be invoked. If this
! option is given, it must appear immediately following the compiler
! selection argument, and all other options will be disregarded.
!
! -_versions
! Print the cw version, followed in turn by the path to and versions
! of each compiler which would be invoked. If this option is given,
! it must appear immediately following the compiler selection
! argument, and all other options will be disregarded.
!
! -_noecho
! Normally, cw writes to standard error the actual compiler commands
! invoked, each prefixed with '+'. This option suppresses these
! messages.
!
! -_cc=,-_gcc=,-_CC=,-g++=
! Pass compiler-dependent options. See ARGUMENT TRANSLATION.
SHADOW COMPILATION
! Unless otherwise directed by environment variables (see ENVIRONMENT),
! cw will invoke both the compiler specified by its first argument
! (primary) and a designated alternate compiler (shadow). The primary
! compiler will be invoked with the arguments given to cw, translated as
! described in ARGUMENT TRANSLATION. The secondary compiler will be
! invoked in parallel with the primary (but see ENVIRONMENT); its
! arguments will likewise be translated. However, the shadow compiler's
! arguments will also be modified as follows:
1. If none of -c, -E, -P, or -S appears in the argument list (that is,
! linking is attempted), the shadow compiler will not be invoked.
This is because the objects built with that compiler which would be
linked have been previously discarded.
! 2. If an option of the form -ofilename was provided, it will be
! replaced by two options of the form -o tempfile.
!
! 3. If the option -o was provided, its following argument will be
! replaced by tempfile.
!
! 4. If neither of the above options was provided, two options of the
! form -o tempfile will be added to the end of the argument list used
! to invoke the shadow compiler.
!
! In all three cases, tempfile is the name of a temporary file which will
! be removed by cw before it terminates.
When shadow compilation is in effect, cw writes to standard error each
compiler's standard error output following its argument list. Messages
! from the two compilers will not be interleaved. If cw is used to
! invoke the preprocessor and no output location is specified, cw will
! write to standard output the primary compiler's standard output, and
! the secondary compiler's standard output will be discarded.
!
! Because the Studio compilers write intermediate objects to fixed
! filenames in the current directory when instructed to compile and link
! multiple source files via a single command line, it would be unsafe to
! invoke more than one compiler in this fashion. Therefore cw does not
! accept multiple source files unless the preprocessor is to be invoked.
! An attempt to invoke cw in this manner will result in an error.
ARGUMENT TRANSLATION
! The arguments provided to cw will be passed through to each compiler
! invoked, altered as follows:
!
! 1. Options intended for cw itself are removed.
!
! 2. The shadow compiler's arguments are modified as described in SHADOW
! COMPILATION so that its output is discarded.
!
! 3. If the compiler to be invoked is a GNU C or C++ compiler, a set of
! default flags is added to the beginning of the argument list, and
! the remaining arguments are translated to their closest appropriate
! semantic equivalents and passed in the same order as their
! counterparts given to cw. Arguments which begin with -_gcc= or
! -_g++= will be passed in place with the leading portion removed.
! Arguments which begin with -_cc= or -_CC= will be discarded. See
! the comments at the head of usr/src/tools/cw/cw.c for a detailed
list of translations.
- 4. If the compiler to be invoked is a Studio C or C++ compiler, the
- remaining arguments are passed unmodified and in the same order as
- given to cw. Arguments which begin with -_cc= or -_CC= will be
- passed in place with the leading portion removed. Arguments which
- begin with -_gcc= or -_g++= will be discarded.
-
ENVIRONMENT
- CW_NO_SHADOW
- If this variable is set in the environment, invoke only the primary
- compiler.
-
CW_SHADOW_SERIAL
If this variable is set in the environment, invoke the primary
! compiler, wait for it to complete, then invoke the shadow compiler.
! Normally the two compilers are invoked in parallel. If
! CW_NO_SHADOW is set, this has no effect.
CW_NO_EXEC
! If this variable is set in the environment, write the usual output
! to standard error but do not actually invoke any compiler. This is
! useful for debugging the translation engine.
!
! CW_CC, CW_CPLUSPLUS
! If these variables are set in the environment, they specify the
! full pathname for the Studio C and C++ compilers, respectively.
!
! CW_CC_DIR, CW_CPLUSPLUS_DIR, SPRO_VROOT, SPRO_ROOT, BUILD_TOOLS
! If CW_CC or CW_CPLUSPLUS are not set, these variables define the
! search path for Studio compilers as follows: If CW_CC_DIR is set,
! the Studio C compiler in $CW_CC_DIR will be used. Likewise, if
! CW_CPLUSPLUS_DIR is set, the Studio C++ compiler in
! $CW_CPLUSPLUS_DIR will be used. Otherwise, if SPRO_VROOT is set,
! the Studio C and C++ compilers in $SPRO_VROOT/bin will be used.
! Otherwise, if SPRO_ROOT is set, the Studio C and C++ compilers in
! $SPRO_ROOT/SS12/bin will be used. Otherwise, if BUILD_TOOLS is
! set, the Studio C and C++ compilers in
! $BUILD_TOOLS/SUNWspro/SS12/bin will be used. Otherwise, the Studio
! compilers in a predefined default location will be used.
!
! CW_GCC, CW_GPLUSPLUS
! If these variables are set in the environment, they specify the
! full pathname for the GNU C and C++ compilers, respectively.
!
! CW_GCC_DIR, CW_GPLUSPLUS_DIR, GNU_ROOT
! If CW_GCC or CW_GPLUSPLUS are not set, these variables alter the
! search path for GNU compilers in a manner similar to that described
! above for the Studio compilers. Specifically: If CW_GCC_DIR is
! set, the GNU C compiler in $CW_GCC_DIR will be used. Likewise, if
! CW_GPLUSPLUS_DIR is set, the GNU C++ compiler in $CW_GPLUSPLUS_DIR
! will be used. Otherwise, if GNU_ROOT is set, the GNU C and C++
! compilers in $GCC_ROOT/bin will be used. Otherwise, the GNU
! compilers in a predefined default location will be used.
EXIT STATUS
The following exit status values are returned:
! 0 The primary compiler, and shadow compiler if invoked, both
completed successfully.
! >0 A usage error occurred, or one or more compilers returned a nonzero
! exit status.
BUGS
! The translations provided for gcc are not always exact and in some
! cases reflect local ON policy rather than actual equivalence.
Additional compiler types should be supported.
The translation engine is hacky.
! SEE ALSO
! cc(1), CC(1), gcc(1)
!
!
!
! March 22, 2010 CW(1ONBLD)
--- 1,131 ----
CW(1ONBLD) illumos Build Tools CW(1ONBLD)
NAME
cw - invoke one or more compilers with argument translation
SYNOPSIS
! cw [-C] [--versions] [--noecho] --primary compiler
! [--shadow compiler ...] -- compiler args ...
DESCRIPTION
cw is a facility for invoking one or more compilers, providing
! translation from Sun style arguments as appropriate. This allows the use
! of arbitrary compilers without the need to alter large numbers of
! makefiles. A mode called shadow compilation invokes multiple compilers
! so that warnings and errors may be obtained from both. See SHADOW
! COMPILATION for details. This version of cw supports compilers with both
! Sun Studio 12 and GCC-style command lines.
ARGUMENTS
! Both the --primary and --secondary parameters take a compiler
! specification. This is a comma-separated list of the form
! name,executable,style Where name is a name for the compiler, executable
! is the full path to the compiler executable, and style is the style of
! command-line options the compiler expects, either sun or gnu.
!
! --primary compiler
! Specify the compiler to be used primarily (that which is used for
! link-editing and pre-processing, and whos objects we deliver).
!
! --shadow compiler
! Specify a shadow compiler, which builds sources for the sake of
! checking code quality and compatibility, but has its output
! discarded.
!
! --noecho
! Do not echo the actual command line of any compilers invoked.
!
! --versions
! Request from each configured primary and shadow compiler its
! version information.
!
! -C The sources being compiled are C++. This is necessary as it
! affects the translation of compiler arguments.
!
! -- Arguments intended for the compilers themselves must be separated
! from those of cw by a --.
!
! -_name=
!
! -_style=
! Parameters intended for the compiler be guarded with options of
! the form -_name= and -_style= Where name and style are those
! passed to --primary and --shadow this allows certain flags to be
! passed only to certain classes of compiler.
!
! For historical reasons, the -_style= option is also translated
! such that a style of sun may use the flag -_cc= and a style of
! gnu may use the flag -_gcc=, and when the -C option is given and
! C++ is in use the style of sun may use the flag -_CC= and the
! style of gnu may use the flag -_g++=.
SHADOW COMPILATION
! If --shadow compilers are specified cw will invoke shadow compiler, with
! the outputs modified (as well as any translation for compiler style) as
! follows:
1. If none of -c, -E, -P, or -S appears in the argument list (that is,
! linking is attempted), the shadow compilers will not be invoked.
This is because the objects built with that compiler which would be
linked have been previously discarded.
! 2. If an option of the form -o filename was provided, it will be
! replaced by two options of the form -o tempfile
+ 3. If the option -o was not provided, -o tempfile will be added to the
+ end of the argument list used to invoke the shadow compilers.
When shadow compilation is in effect, cw writes to standard error each
compiler's standard error output following its argument list. Messages
! from the compilers will not be interleaved. If cw is used to invoke the
! preprocessor and no output location is specified, cw will write to
! standard output the primary compiler's standard output, and the secondary
! compiler's standard output will be discarded.
!
! Because the Sun compilers write intermediate objects to fixed filenames
! in the current directory when instructed to compile and link multiple
! source files via a single command line, it would be unsafe to invoke more
! than one compiler in this fashion. Therefore cw does not accept multiple
! source files unless the preprocessor is to be invoked. An attempt to
! invoke cw in this manner will result in an error.
ARGUMENT TRANSLATION
! If the compiler to be invoked is a GNU-style C or C++ compiler, a set of
! default flags is added to the beginning of the argument list, and the
! remaining arguments are translated to their closest appropriate semantic
! equivalents and passed in the same order as their counterparts given to
! cw. See the comments at the head of usr/src/tools/cw/cw.c for a detailed
list of translations.
ENVIRONMENT
CW_SHADOW_SERIAL
If this variable is set in the environment, invoke the primary
! compiler, wait for it to complete, then invoke the shadow
! compilers. Normally the primary and shadow compilers are invoked
! in parallel.
CW_NO_EXEC
! If this variable is set in the environment, write the usual
! output to standard error but do not actually invoke any compiler.
! This is useful for debugging the translation engine.
EXIT STATUS
The following exit status values are returned:
! 0 The primary compiler, and shadow compilers if invoked, both
completed successfully.
! >0 A usage error occurred, or one or more compilers returned a
! nonzero exit status.
!
! SEE ALSO
! cc(1), CC(1), gcc(1)
BUGS
! The translations provided for gcc are not always exact and in some cases
! reflect local policy rather than actual equivalence.
Additional compiler types should be supported.
The translation engine is hacky.
! illumos February 10, 2018 illumos