Print this page
cw: don't shadow pure pre-processing
cw(1onbld): --shadow not --secondary


  34 .Op Fl -noecho
  35 .Fl -primary Ar compiler
  36 .Op Fl -shadow Ar compiler ...
  37 .Fl -
  38 .Ar compiler args ...
  39 .Sh DESCRIPTION
  40 .Nm cw
  41 is a facility for invoking one or more compilers, providing translation from
  42 Sun style arguments as appropriate.
  43 This allows the use of arbitrary compilers without the need to alter large
  44 numbers of makefiles.
  45 A mode called shadow compilation invokes multiple compilers so that warnings
  46 and errors may be obtained from both.
  47 See SHADOW COMPILATION for details.
  48 This version of cw supports compilers with both Sun Studio 12 and GCC-style
  49 command lines.
  50 .Sh ARGUMENTS
  51 Both the
  52 .Fl -primary
  53 and
  54 .Fl -secondary
  55 parameters take a
  56 .Em compiler specification .
  57 This is a comma-separated list of the form
  58 .Ar name,executable,style
  59 Where
  60 .Ar name
  61 is a name for the compiler,
  62 .Ar executable
  63 is the full path to the compiler executable, and
  64 .Ar style
  65 is the style of command-line options the compiler expects, either
  66 .Em sun
  67 or
  68 .Em gnu .
  69 .Bl -tag -width indent
  70 .It Fl -primary Ar compiler
  71 Specify the compiler to be used primarily (that which is used for link-editing
  72 and pre-processing, and whos objects we deliver).
  73 .It Fl -shadow Ar compiler
  74 Specify a shadow compiler, which builds sources for the sake of checking code


 116 and when the
 117 .Fl C
 118 option is given and C++ is in use the style of
 119 .Em sun
 120 may use the flag
 121 .Fl _CC=
 122 and the style of
 123 .Em gnu
 124 may use the flag
 125 .Fl _g++= .
 126 .El
 127 .Sh SHADOW COMPILATION
 128 If
 129 .Fl -shadow
 130 compilers are specified
 131 .Nm cw
 132 will invoke shadow compiler, with the outputs modified (as well as any
 133 translation for compiler style) as follows:
 134 .Bl -enum
 135 .It
 136 If none of
 137 .Fl c ,
 138 .Fl E ,
 139 .Fl P ,
 140 or
 141 .Fl S
 142 appears in the argument list (that is, linking is attempted), the shadow
 143 compilers will not be invoked.
 144 This is because the objects built with that compiler which would be linked
 145 have been previously discarded.
 146 .It
 147 If the
 148 .Fl o Ar filename
 149 option was provided, with or without a separating space, it will be replaced with
 150 .Fl o Ar tempfile
 151 .It
 152 If the option
 153 .Fl o
 154 was not provided,
 155 .Fl o Ar tempfile
 156 will be added to the end of the argument list used to invoke
 157 the shadow compilers.
 158 .El
 159 When shadow compilation is in effect,
 160 .Nm cw
 161 writes to standard error each compiler's standard error output following its
 162 argument list.
 163 Messages from the compilers will not be interleaved.
 164 If
 165 .Nm cw
 166 is used to invoke the preprocessor and no output location is specified,
 167 .Nm cw
 168 will write to standard output the primary compiler's standard output, and the
 169 secondary compiler's standard output will be discarded.
 170 .Pp
 171 Because the Sun compilers write intermediate objects to fixed
 172 filenames in the current directory when instructed to compile and
 173 link multiple source files via a single command line, it would be
 174 unsafe to invoke more than one compiler in this fashion.
 175 Therefore
 176 .Nm cw
 177 does not accept multiple source files unless the preprocessor is to be
 178 invoked.
 179 An attempt to invoke
 180 .Nm cw
 181 in this manner will result in an error.
 182 .Sh ARGUMENT TRANSLATION
 183 If the compiler to be invoked is a GNU-style C or C++ compiler, a set of
 184 default flags is added to the beginning of the argument list, and the
 185 remaining arguments are translated to their closest appropriate
 186 semantic equivalents and passed in the same order as their
 187 counterparts given to
 188 .Nm cw .
 189 See the comments at the head of




  34 .Op Fl -noecho
  35 .Fl -primary Ar compiler
  36 .Op Fl -shadow Ar compiler ...
  37 .Fl -
  38 .Ar compiler args ...
  39 .Sh DESCRIPTION
  40 .Nm cw
  41 is a facility for invoking one or more compilers, providing translation from
  42 Sun style arguments as appropriate.
  43 This allows the use of arbitrary compilers without the need to alter large
  44 numbers of makefiles.
  45 A mode called shadow compilation invokes multiple compilers so that warnings
  46 and errors may be obtained from both.
  47 See SHADOW COMPILATION for details.
  48 This version of cw supports compilers with both Sun Studio 12 and GCC-style
  49 command lines.
  50 .Sh ARGUMENTS
  51 Both the
  52 .Fl -primary
  53 and
  54 .Fl -shadow
  55 parameters take a
  56 .Em compiler specification .
  57 This is a comma-separated list of the form
  58 .Ar name,executable,style
  59 Where
  60 .Ar name
  61 is a name for the compiler,
  62 .Ar executable
  63 is the full path to the compiler executable, and
  64 .Ar style
  65 is the style of command-line options the compiler expects, either
  66 .Em sun
  67 or
  68 .Em gnu .
  69 .Bl -tag -width indent
  70 .It Fl -primary Ar compiler
  71 Specify the compiler to be used primarily (that which is used for link-editing
  72 and pre-processing, and whos objects we deliver).
  73 .It Fl -shadow Ar compiler
  74 Specify a shadow compiler, which builds sources for the sake of checking code


 116 and when the
 117 .Fl C
 118 option is given and C++ is in use the style of
 119 .Em sun
 120 may use the flag
 121 .Fl _CC=
 122 and the style of
 123 .Em gnu
 124 may use the flag
 125 .Fl _g++= .
 126 .El
 127 .Sh SHADOW COMPILATION
 128 If
 129 .Fl -shadow
 130 compilers are specified
 131 .Nm cw
 132 will invoke shadow compiler, with the outputs modified (as well as any
 133 translation for compiler style) as follows:
 134 .Bl -enum
 135 .It
 136 If neither of 
 137 .Fl c ,



 138 .Fl S
 139 appears in the argument list (that is, linking is attempted or only the
 140 pre-processor is invoked), the shadow compilers will not be invoked.


 141 .It
 142 If the
 143 .Fl o Ar filename
 144 option was provided, with or without a separating space, it will be replaced with
 145 .Fl o Ar tempfile
 146 .It
 147 If the option
 148 .Fl o
 149 was not provided,
 150 .Fl o Ar tempfile
 151 will be added to the end of the argument list used to invoke
 152 the shadow compilers.
 153 .El
 154 When shadow compilation is in effect,
 155 .Nm cw
 156 writes to standard error each compiler's standard error output following its
 157 argument list.
 158 Messages from the compilers will not be interleaved.
 159 If
 160 .Nm cw
 161 is used to invoke the preprocessor and no output location is specified,
 162 .Nm cw
 163 will write to standard output the primary compiler's standard output.

 164 .Pp
 165 Because the Sun compilers write intermediate objects to fixed
 166 filenames in the current directory when instructed to compile and
 167 link multiple source files via a single command line, it would be
 168 unsafe to invoke more than one compiler in this fashion.
 169 Therefore
 170 .Nm cw
 171 does not accept multiple source files unless the preprocessor is to be
 172 invoked.
 173 An attempt to invoke
 174 .Nm cw
 175 in this manner will result in an error.
 176 .Sh ARGUMENT TRANSLATION
 177 If the compiler to be invoked is a GNU-style C or C++ compiler, a set of
 178 default flags is added to the beginning of the argument list, and the
 179 remaining arguments are translated to their closest appropriate
 180 semantic equivalents and passed in the same order as their
 181 counterparts given to
 182 .Nm cw .
 183 See the comments at the head of