3 SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
4 SPDX-License-Identifier: MIT
5 SPDX-FileType: DOCUMENTATION
7 This file is processed by the bin/SConsDoc.py module.
11 <!ENTITY % scons SYSTEM '../../doc/scons.mod'>
13 <!ENTITY % builders-mod SYSTEM '../../doc/generated/builders.mod'>
15 <!ENTITY % functions-mod SYSTEM '../../doc/generated/functions.mod'>
17 <!ENTITY % tools-mod SYSTEM '../../doc/generated/tools.mod'>
19 <!ENTITY % variables-mod SYSTEM '../../doc/generated/variables.mod'>
23 <sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
24 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25 xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
27 <builder name="CFile">
30 Builds a C source file given a lex (<filename>.l</filename>)
31 or yacc (<filename>.y</filename>) input file.
32 The suffix specified by the &cv-link-CFILESUFFIX; &consvar;
33 (<filename>.c</filename> by default)
34 is automatically added to the target
35 if it is not already present.
41 env.CFile(target='foo.c', source='foo.l')
44 env.CFile(target='bar', source='bar.y')
47 <!--para> ** Left here for reference, does not need to be user-visible. **
48 Note that for yacc files,
49 the output file name is derived from <parameter>target</parameter>,
50 or from the source file name if a target is not specified;
51 the traditional yacc default name
52 <filename>y.tab.c</filename> is not used.
57 <builder name="CXXFile">
60 Builds a C++ source file given a lex (<filename>.ll</filename>)
61 or yacc (<filename>.yy</filename>)
63 The suffix specified by the &cv-link-CXXFILESUFFIX; &consvar;
64 (<filename>.cc</filename> by default)
65 is automatically added to the target
66 if it is not already present.
72 env.CXXFile(target='foo.cc', source='foo.ll')
75 env.CXXFile(target='bar', source='bar.yy')
78 <!--para> ** Left here for reference, does not need to be user-visible. **
79 Note that for yacc files,
80 the output file name is derived from <parameter>target</parameter>,
81 or from the source file name if a target is not specified;
82 the traditional yacc default name
83 <filename>y.tab.cc</filename> is not used.
88 <builder name="Library">
98 <builder name="LoadableModule">
104 On Mac OS X (Darwin) platforms,
105 this creates a loadable module bundle.
110 <builder name="Object">
120 <builder name="Program">
123 Builds an executable given one or more object files
124 or C, C++, D, or Fortran source files.
125 If any C, C++, D or Fortran source files are specified,
126 then they will be automatically
127 compiled to object files using the
130 see that builder method's description for
131 a list of legal source file suffixes
132 and how they are interpreted.
133 The target executable file prefix,
134 specified by the &cv-link-PROGPREFIX; &consvar;
135 (nothing by default),
137 specified by the &cv-link-PROGSUFFIX; &consvar;
138 (by default, <filename>.exe</filename> on Windows systems,
139 nothing on POSIX systems),
140 are automatically added to the target if not already present.
145 env.Program(target='foo', source=['foo.o', 'bar.c', 'baz.f'])
150 <builder name="SharedLibrary">
153 Builds a shared library
154 given one or more object files
155 and/or C, C++, D or Fortran source files.
156 Any source files listed in the
157 <parameter>source</parameter> parameter
158 will be automatically
159 compiled to object files suitable
160 for use in a shared library.
161 Any object files listed in the
162 <parameter>source</parameter> parameter
163 must have been built for a shared library
168 will raise an error if there is any mismatch.
172 The target library file prefix,
173 specified by the &cv-link-SHLIBPREFIX; &consvar;
174 (by default, <filename>lib</filename> on POSIX systems,
175 nothing on Windows systems),
177 specified by the &cv-link-SHLIBSUFFIX; &consvar;
178 (by default, <filename>.dll</filename> on Windows systems,
179 <filename>.so</filename> on POSIX systems),
180 are automatically added (if not already present)
181 to the target name to make up the library filename.
182 On a POSIX system, if the &cv-link-SHLIBVERSION; &consvar; is set,
183 it is appended (following a period) to the resulting library name.
191 env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'])
195 On Windows systems, the
197 builder method will always build an import library
198 (<filename>.lib</filename>)
199 in addition to the shared library (<filename>.dll</filename>),
200 adding a <filename>.lib</filename> library with the same basename
201 if there is not already a <filename>.lib</filename> file explicitly
202 listed in the targets.
206 On Cygwin systems, the
208 builder method will always build an import library
209 (<filename>.dll.a</filename>)
210 in addition to the shared library (<filename>.dll</filename>),
211 adding a <filename>.dll.a</filename> library with the same basename
212 if there is not already a <filename>.dll.a</filename> file explicitly
213 listed in the targets.
218 On some platforms, there is a distinction between a shared library
219 (loaded automatically by the system to resolve external references)
220 and a loadable module (explicitly loaded by user action).
221 For maximum portability, use the &b-link-LoadableModule; builder for the latter.
225 If &cv-link-SHLIBVERSION; is defined, a versioned
226 shared library is created. This modifies &cv-link-SHLINKFLAGS; as required,
227 adds the version number to the library name, and creates any
228 symbolic links that are needed.
232 env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'], SHLIBVERSION='1.5.2')
236 On a POSIX system, supplying a simple version string (no dots)
237 creates exactly one symbolic link: <literal>SHLIBVERSION="1"</literal>
238 would create (for example) library <filename>libbar.so.1</filename>
239 and symbolic link <filename>libbar.so</filename>.
240 Supplying a dotted version string will create two symbolic links
241 (irrespective of the number of segments in the version):
242 <literal>SHLIBVERSION="1.5.2"</literal> for the same library
243 would create library <filename>libbar.so.1.5.2</filename>
244 and symbolic links <filename>libbar.so</filename> and
245 <filename>libbar.so.1</filename>. A Darwin (OSX)
246 system creates one symlink in either case,
247 for the second example the library would be
248 <filename>libbar.1.5.2.dylib</filename>
249 and the link would be <filename>libbar.dylib</filename>.
253 On Windows systems, specifying the
254 <parameter>register=1</parameter> keyword argument
255 will cause the <filename>.dll</filename> to be
256 registered after it is built.
257 The command that is run is determined by the &cv-link-REGSVR; &consvar;
258 (<command>regsvr32</command> by default),
259 and the flags passed are determined by &cv-link-REGSVRFLAGS;. By
260 default, &cv-link-REGSVRFLAGS; includes the <option>/s</option> option,
261 to prevent dialogs from popping
262 up and requiring user attention when it is run. If you change
263 &cv-link-REGSVRFLAGS;, be sure to include the <option>/s</option> option.
268 env.SharedLibrary(target='bar', source=['bar.cxx', 'foo.obj'], register=1)
272 will register <filename>bar.dll</filename> as a COM object
273 when it is done linking it.
278 <builder name="SharedObject">
281 Builds an object file intended for
282 inclusion in a shared library.
283 Source files must have one of the same set of extensions
284 specified above for the
287 On some platforms building a shared object requires additional
289 (e.g. <option>-fPIC</option> for <command>gcc</command>)
290 in addition to those needed to build a
291 normal (static) object, but on some platforms there is no difference between a
292 shared object and a normal (static) one. When there is a difference, SCons
293 will only allow shared objects to be linked into a shared library, and will
294 use a different suffix for shared objects. On platforms where there is no
295 difference, SCons will allow both normal (static)
296 and shared objects to be linked into a
297 shared library, and will use the same suffix for shared and normal
299 The target object file prefix,
300 specified by the &cv-link-SHOBJPREFIX; &consvar;
301 (by default, the same as &cv-link-OBJPREFIX;),
303 specified by the &cv-link-SHOBJSUFFIX; &consvar;,
304 are automatically added to the target if not already present.
309 env.SharedObject(target='ddd', source='ddd.c')
310 env.SharedObject(target='eee.o', source='eee.cpp')
311 env.SharedObject(target='fff.obj', source='fff.for')
315 Note that the source files will be scanned
316 according to the suffix mappings in the
317 <classname>SourceFileScanner</classname>
319 See the manpage section "Scanner Objects"
320 for more information.
325 <builder name="StaticLibrary">
328 Builds a static library given one or more object files
329 or C, C++, D or Fortran source files.
330 If any source files are given,
331 then they will be automatically
332 compiled to object files.
333 The static library file prefix,
334 specified by the &cv-link-LIBPREFIX; &consvar;
335 (by default, <filename>lib</filename> on POSIX systems,
336 nothing on Windows systems),
338 specified by the &cv-link-LIBSUFFIX; &consvar;
339 (by default, <filename>.lib</filename> on Windows systems,
340 <filename>.a</filename> on POSIX systems),
341 are automatically added to the target if not already present.
346 env.StaticLibrary(target='bar', source=['bar.c', 'foo.o'])
350 Any object files listed in the
351 <parameter>source</parameter>
352 must have been built for a static library
357 will raise an error if there is any mismatch.
362 <builder name="StaticObject">
365 Builds a static object file
366 from one or more C, C++, D, or Fortran source files.
367 Source files must have one of the following extensions:
371 .asm assembly language file
372 .ASM assembly language file
384 .F Windows: Fortran file
385 POSIX: Fortran file + C pre-processor
388 .fpp Fortran file + C pre-processor
389 .FPP Fortran file + C pre-processor
392 .s assembly language file
393 .S Windows: assembly language file
394 ARM: CodeSourcery Sourcery Lite
395 .sx assembly language file + C pre-processor
396 POSIX: assembly language file + C pre-processor
397 .spp assembly language file + C pre-processor
398 .SPP assembly language file + C pre-processor
402 The target object file prefix,
403 specified by the &cv-link-OBJPREFIX; &consvar;
404 (nothing by default),
406 specified by the &cv-link-OBJSUFFIX; &consvar;
407 (<filename>.obj</filename> on Windows systems,
408 <filename>.o</filename> on POSIX systems),
409 are automatically added to the target if not already present.
414 env.StaticObject(target='aaa', source='aaa.c')
415 env.StaticObject(target='bbb.o', source='bbb.c++')
416 env.StaticObject(target='ccc.obj', source='ccc.f')
420 Note that the source files will be scanned
421 according to the suffix mappings in the
422 <classname>SourceFileScanner</classname>
424 See the manpage section "Scanner Objects"
425 for more information.
430 <cvar name="CCVERSION">
433 The version number of the C compiler.
434 This may or may not be set,
435 depending on the specific C compiler being used.
440 <cvar name="CFILESUFFIX">
443 The suffix for C source files.
444 This is used by the internal CFile builder
445 when generating C files from Lex (.l) or YACC (.y) input files.
446 The default suffix, of course, is
447 <filename>.c</filename>
449 On case-insensitive systems (like Windows),
451 <filename>.C</filename>
458 <cvar name="CXXVERSION">
461 The version number of the C++ compiler.
462 This may or may not be set,
463 depending on the specific C++ compiler being used.
468 <cvar name="CXXFILESUFFIX">
471 The suffix for C++ source files.
472 This is used by the internal CXXFile builder
473 when generating C++ files from Lex (.ll) or YACC (.yy) input files.
474 The default suffix is
475 <filename>.cc</filename>.
476 SCons also treats files with the suffixes
477 <filename>.cpp</filename>,
478 <filename>.cxx</filename>,
479 <filename>.c++</filename>,
481 <filename>.C++</filename>
484 <filename>.mm</filename>
485 suffixes as Objective-C++ files.
486 On case-sensitive systems (Linux, UNIX, and other POSIX-alikes),
488 <filename>.C</filename>
495 <cvar name="IMPLIBVERSION">
498 Used to override &cv-link-SHLIBVERSION;/&cv-link-LDMODULEVERSION; when
499 generating versioned import library for a shared library/loadable module. If
500 undefined, the &cv-link-SHLIBVERSION;/&cv-link-LDMODULEVERSION; is used to
501 determine the version of versioned import library.
506 <cvar name="LIBEMITTER">
509 Contains the emitter specification for the
510 &b-link-StaticLibrary; builder.
511 The manpage section "Builder Objects" contains
512 general information on specifying emitters.
517 <cvar name="LDMODULEVERSION">
520 When this &consvar; is defined, a versioned loadable module
521 is created by &b-link-LoadableModule; builder. This activates the
522 &cv-link-_LDMODULEVERSIONFLAGS; and thus modifies the &cv-link-LDMODULECOM; as
523 required, adds the version number to the library name, and creates the symlinks
524 that are needed. &cv-link-LDMODULEVERSION; versions should exist in the same
525 format as &cv-link-SHLIBVERSION;.
530 <cvar name="LDMODULEEMITTER">
533 Contains the emitter specification for the
534 &b-link-LoadableModule; builder.
535 The manpage section "Builder Objects" contains
536 general information on specifying emitters.
541 <cvar name="SHLIBEMITTER">
544 Contains the emitter specification for the
545 &b-link-SharedLibrary; builder.
546 The manpage section "Builder Objects" contains
547 general information on specifying emitters.
552 <cvar name="PROGEMITTER">
555 Contains the emitter specification for the
556 &b-link-Program; builder.
557 The manpage section "Builder Objects" contains
558 general information on specifying emitters.
563 <cvar name="SHLIBVERSION">
566 When this &consvar; is defined, a versioned shared library
567 is created by the &b-link-SharedLibrary; builder. This activates the
568 &cv-link-_SHLIBVERSIONFLAGS; and thus modifies the &cv-link-SHLINKCOM; as
569 required, adds the version number to the library name, and creates the symlinks
570 that are needed. &cv-link-SHLIBVERSION; versions should exist as alphanumeric,
571 decimal-delimited values as defined by the regular expression "\w+[\.\w+]*".
572 Example &cv-link-SHLIBVERSION; values include '1', '1.2.3', and '1.2.gitaa412c8b'.