Print this page
11461 should use a native link-editor during the build
11463 SUNWonld has passed its use-by date
11464 cmd/sgs/tools should contain tools, not common code
11465 sgsmsg should be built with the rest of the build tools
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/cw/cw.1onbld
+++ new/usr/src/tools/cw/cw.1onbld
1 1 .\"
2 2 .\" CDDL HEADER START
3 3 .\"
4 4 .\" The contents of this file are subject to the terms of the
5 5 .\" Common Development and Distribution License (the "License").
6 6 .\" You may not use this file except in compliance with the License.
7 7 .\"
8 8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 .\" or http://www.opensolaris.org/os/licensing.
10 10 .\" See the License for the specific language governing permissions
11 11 .\" and limitations under the License.
12 12 .\"
13 13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 .\" If applicable, add the following below this CDDL HEADER, with the
16 16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 18 .\"
19 19 .\" CDDL HEADER END
20 20 .\"
21 21 .\" Copyright 2010 Sun Microsystems, Inc. All rights reserved.
22 22 .\" Use is subject to license terms.
23 23 .\"
24 24 .\" Copyright 2018 Joyent, Inc.
25 25 .\"
26 26 .Dd September 4, 2018
27 27 .Dt CW 1ONBLD
28 28 .Os
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
29 29 .Sh NAME
30 30 .Nm cw
31 31 .Nd invoke one or more compilers with argument translation
32 32 .Sh SYNOPSIS
33 33 .Nm cw
34 34 .Op Fl C
35 35 .Op Fl -versions
36 36 .Op Fl -noecho
37 37 .Fl -primary Ar compiler
38 38 .Op Fl -shadow Ar compiler ...
39 +.Op Fl -linker Ar linker
39 40 .Fl -
40 41 .Ar compiler args ...
41 42 .Sh DESCRIPTION
42 43 .Nm cw
43 44 is a facility for invoking one or more compilers, providing translation from
44 45 Sun style arguments as appropriate.
45 46 This allows the use of arbitrary compilers without the need to alter large
46 47 numbers of makefiles.
47 48 A mode called shadow compilation invokes multiple compilers so that warnings
48 49 and errors may be obtained from all of them.
49 50 See
50 51 .Sx SHADOW COMPILATION
51 52 for details.
52 53 This version of cw supports compilers with both Sun Studio 12 and GCC-style
53 54 command lines.
54 55 .Sh ARGUMENTS
55 56 Both the
56 57 .Fl -primary
57 58 and
58 59 .Fl -shadow
59 60 parameters take a
60 61 .Em compiler specification .
61 62 This is a comma-separated list of the form
62 63 .Ar name,executable,style
63 64 Where
64 65 .Ar name
65 66 is a name for the compiler,
66 67 .Ar executable
67 68 is the full path to the compiler executable, and
68 69 .Ar style
69 70 is the style of command-line options the compiler expects, either
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
70 71 .Em sun
71 72 or
72 73 .Em gnu .
73 74 .Bl -tag -width indent
74 75 .It Fl -primary Ar compiler
75 76 Specify the compiler to be used primarily (that which is used for link-editing
76 77 and pre-processing, and whos objects we deliver).
77 78 .It Fl -shadow Ar compiler
78 79 Specify a shadow compiler, which builds sources for the sake of checking code
79 80 quality and compatibility, but has its output discarded.
81 +.It Fl -linker Ar linker
82 +Specify a link-editor to use in place of
83 +.Pa /usr/bin/ld .
84 +.Xr ld 1
85 +itself arranges for this to be executed by any subprocesses.
80 86 .It Fl -noecho
81 87 Do not echo the actual command line of any compilers invoked.
82 88 .It Fl -versions
83 89 Request from each configured primary and shadow compiler its version
84 90 information.
85 91 .It Fl C
86 92 The sources being compiled are C++. This is necessary as it affects the
87 93 translation of compiler arguments.
88 94 .It Fl -
89 95 Arguments intended for the compilers themselves must be separated from those
90 96 of
91 97 .Nm cw
92 98 by a
93 99 .Fl - .
94 100 .It Fl _name=
95 101 .It Fl _style=
96 102 Parameters intended for the compiler be guarded with options of the form
97 103 .Fl _name=
98 104 and
99 105 .Fl _style=
100 106 Where
101 107 .Em name
102 108 and
103 109 .Em style
104 110 are those passed to
105 111 .Fl -primary
106 112 and
107 113 .Fl -shadow
108 114 this allows certain flags to be passed only to certain classes of compiler.
109 115 .Pp
110 116 For historical reasons, the
111 117 .Fl _style=
112 118 option is also translated such that a style of
113 119 .Em sun
114 120 may use the flag
115 121 .Fl _cc=
116 122 and a style of
117 123 .Em gnu
118 124 may use the flag
119 125 .Fl _gcc= ,
120 126 and when the
121 127 .Fl C
122 128 option is given and C++ is in use the style of
123 129 .Em sun
124 130 may use the flag
125 131 .Fl _CC=
126 132 and the style of
127 133 .Em gnu
128 134 may use the flag
129 135 .Fl _g++= .
130 136 .El
131 137 .Sh SHADOW COMPILATION
132 138 If
133 139 .Fl -shadow
134 140 compilers are specified
135 141 .Nm cw
136 142 will invoke each shadow compiler, with the outputs modified (as well as any
137 143 translation for compiler style) as follows:
138 144 .Bl -enum
139 145 .It
140 146 If
141 147 .Nm cw
142 148 is invoked to link-edit without compilation (the input files are all objects),
143 149 the shadow compiler is not invoked.
144 150 .It
145 151 If the
146 152 .Fl o Ar filename
147 153 option was provided, with or without a separating space, it will be replaced with
148 154 .Fl o Ar tempfile
149 155 .It
150 156 If the option
151 157 .Fl o
152 158 was not provided,
153 159 .Fl o Ar tempfile
154 160 will be added to the end of the argument list used to invoke
155 161 the shadow compilers.
156 162 .El
157 163 When shadow compilation is in effect,
158 164 .Nm cw
159 165 writes to standard error each compiler's standard error output following its
160 166 argument list.
161 167 Messages from the compilers will not be interleaved.
162 168 If
163 169 .Nm cw
164 170 is used to invoke the preprocessor and no output location is specified,
165 171 .Nm cw
166 172 will write to standard output the primary compiler's standard output.
167 173 .Pp
168 174 Because the Sun compilers write intermediate objects to fixed
169 175 filenames in the current directory when instructed to compile and
170 176 link multiple source files via a single command line, it would be
171 177 unsafe to invoke more than one compiler in this fashion.
172 178 Therefore
173 179 .Nm cw
174 180 does not accept multiple source files unless the preprocessor is to be
175 181 invoked.
176 182 An attempt to invoke
177 183 .Nm cw
178 184 in this manner will result in an error.
179 185 .Sh ARGUMENT TRANSLATION
180 186 If the compiler to be invoked is a GNU-style C or C++ compiler, a set of
181 187 default flags is added to the beginning of the argument list, and the
182 188 remaining arguments are translated to their closest appropriate
183 189 semantic equivalents and passed in the same order as their
184 190 counterparts given to
185 191 .Nm cw .
186 192 See the comments at the head of
187 193 .Pa usr/src/tools/cw/cw.c
188 194 for a detailed list of translations.
189 195 .Sh ENVIRONMENT
190 196 .Bl -tag -width indent
191 197 .It CW_SHADOW_SERIAL
192 198 If this variable is set in the environment, invoke the primary compiler, wait
193 199 for it to complete, then invoke the shadow compilers.
194 200 Normally the primary and shadow compilers are invoked in parallel.
195 201 .It CW_NO_EXEC
196 202 f this variable is set in the environment, write the usual output to
197 203 standard error but do not actually invoke any compiler.
198 204 This is useful for debugging the translation engine.
199 205 .El
200 206 .Sh EXIT STATUS
201 207 The following exit status values are returned:
202 208 .Bl -tag -width indent
↓ open down ↓ |
113 lines elided |
↑ open up ↑ |
203 209 .It 0
204 210 The primary compiler, and shadow compilers if invoked, all completed
205 211 successfully.
206 212 .It >0
207 213 A usage error occurred, or one or more compilers returned a nonzero
208 214 exit status.
209 215 .El
210 216 .Sh SEE ALSO
211 217 .Xr cc 1 ,
212 218 .Xr CC 1 ,
213 -.Xr gcc 1
219 +.Xr gcc 1 ,
220 +.Xr ld 1
214 221 .Sh BUGS
215 222 The translations provided for gcc are not always exact and in some cases
216 223 reflect local policy rather than actual equivalence.
217 224 .Pp
218 225 Additional compiler types should be supported.
219 226 .Pp
220 227 The translation engine is hacky.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX