The following #defines, except for those that are shown as commented (e.g., //#defineREFRESH) are
required.
o //#defineADD_LIBRARIES""
when a program must be linked against additional libraries (other than the name of the program’s
library itself (cf. LIBRARY, below) then those libraries should be specified here. E.g., when a
program is linked against libbobcat then the specification is:
#define ADD_LIBRARIES "bobcat"
If your program is linked against multiple libraries, then use a blank-separated list of libraries
(like #defineADD_LIBRARIES"bobcatmath");
o //#defineADD_LIBRARY_PATHS""
this directtive must be specified if ADD_LIBRARIES is also specified, although it may be specified
as an empty string. When additional libraries (specified at ADD_LIBRARIES) are located in
non-standard library locations (e.g., not in /lib and /usr/lib) then these additional paths are
(blank space separated) specified here. Specify only the paths, not the -L flags.
It is stronly advised to specify full pathnames here. Relative path specifications can be used by
specifying paths relative to the directory that is specified at the TMP_DIR directive (see below);
o //#defineCLS
the clearscreen directive. If defined tputclear is called to clear the terminal screen before
starting compilations. By default it is not defined. Alternatively the -c option can be passed to
icmbuild;
o #defineCXX"g++"
the C++ compiler to use. For a C compiler specify, e.g., #defineCC"gcc". Their settings are
overruled by identically named environment variables. If only C files are compiled then #defineCXX can be omitted.
By specifying, e.g., #defineCXX"ccacheg++" compilations use caching facilities, which may
impressively reduce recompilation times. Refer to the cccache(1) man-page for details.
o #defineCXXFLAGS"-Werror-Wall-O2"C++ compiler options to use (here showing the default options). When the C compiler is used, use
#defineCFLAGS rather than CXXFLAGS. Their settings are overruled by identically named environment
variables. If only C files are compiled then #defineCXXFLAGS can be omitted.
Additional options can be defined by adding them to the CXXFLAGS definition. In addition,
compilations use the environment variable ICMAKE_CPPSTD to set the C++ standard to use. E.g.,
after defining
ICMAKE_CPPSTD=--std=c++26
the compiler uses the options
--std=c++26 -Werror -Wall -O2
o //#defineDEFCOM"..."
a DEFCOM directive may be added to the icmconf file (the icmstart(1) script can do this for you).
It can be specified as:
#define DEFCOM "program"
in which case icmbuild does program maintenance, or as
#define DEFCOM "library"
in which case icmbuild does library maintenance.;
o //#defineICM_DEP"-Vgo"
the existence and implied existence of USE_ALL files (see the description of the USE_ALL
directive). When the (deprecated) PRECOMP directive is specified the recency of precompiled
headers is ensured (see also the SPCH description, below). By default icm_dep is called with the
shown default arguments. If icm_dep should not be called define ICM_DEP as an empty string ("").
Icmake(1)’s man-page contains a separate section about the icm_dep support program;
o #defineIH".ih"
the extension used for internal header files. See #defineSPCH below. If SPCH is specified the
ttI#define H) directive must also be specified;
o //#defineLDFLAGS""
linker options to use. By default no options are passed to the linker. Its setting is overruled by
an identically named environment variable;
o //#defineLIBRARY"ofiles"
by defining this directive a local library (libofiles.a) is constructed. When a binary program is
built it is linked against this library rather than to the individual object files.
If a library instead of a program must be constructed (see also the DEFCOM directive), then the
LIBRARY directive specifies the library’s base name (without the lib prefix and without the .a
extension). In that case source files are expected in sub-directories of the project’s main
directory (i.e., the directory containing icmconf). In that case avoid having source and header
files in the project’s main directory. Instead, move such files to a separate sub-directory;
o //#defineMAIN"main.cc"
the source file in which the intmain function is defined. This directive is required when doing
program (rather than library) maintenance.
Note: if source files are located in the project’s main directory but library maintenance is
intended (e.g., by specifying #defineDEFCOMlibrary) then define MAIN to specify a pseudo main
source, whose base name is the base name of the header file in the project’s main directory. This,
however, is considered a kludge, and should be avoided by moving those source and header files to
a separate sub-directory;
o //#defineMULTICOMP"..."
Example: #defineMULTICOMP"jobs-q"
This directive activates threaded compilation of source files. When used its first word specifies
the name of a file to contain information about which files must be compiled. This must be a plain
filename, not containing directory specifiers (like /). Refer to the icmake(1) man-page’s section
ICM-MULTICOMP covering options, arguments, and usage of icm-multicomp which is called when #defineMULTICOMP is specified;
o //#defineNO_PRECOMP_WARNING"
when #definePRECOMP (now deprecated) is specified (see below) a warning is issued when a
class-directory does not contain a IH file. Such warnings are suppressed by defining
NO_PRECOMP_WARNING. This option is only considered when #definePRECOMP is specified;
o #defineOBJ_EXT".o"
this directive specifies the extension of object modules created by the compiler;
o //#definePRECOMP"-xc++-header"
(deprecated, consider declaring #defineSPCH instead)
define this directive to construct class-specific pre-compiled headers (in which case the IH)
directive must also be specified. Dependencies between (precompiled) headers are automatically
considered.
Existing precompiled headers are removed by icmbuildcleangch (or icmbuildclean. When source
files of other languages are compiled the PRECOMP’s-x argument must be adapted to those
languages;
o //#defineREFRESH
define REFRESH to relink the binary program when icmbuildprogram is called, even when no file was
(re)compiled. This is useful when the program links to external libraries which were updated
separately from the currrent project;
o //#defineSHARED
this directive is only interpreted when LIBRARY is also specified. If defined a shared library
(extension .so*) is built in addition to a static library (extension .a);
The shared library receives VERSION as its version number while soft links using VERSION’s (see
below) major version number an no version number are also made available. E.g., if VERSION is
defined as 1.02.03 and #defineLIBRARY"demo" then the shared library becomes libdemo.so.1.02.03,
with libdemo.so.1 soft-linking to it, and libdemo.so soft-linking to libdemo.so.1;
o //#defineSHAREDREQ""
when creating a shared library SHAREDREQ specifies the names of libraries and library paths that
are required by the constructed shared library itself. E.g., if a library is found in
/usr/lib/special, assuming that the name of the required library is libspecial.so, then use the
specification #defineSHAREDREQ"-L/usr/lib/special-lspecial". The /lib and /usr/lib paths are
usually automatically visited by the linker and do not have the be specified. This directive is
required (possibly as an empty string) if SHARED is defined;
o #defineSOURCES"*.cc"
the pattern to locate sources in directories;
o //#defineSPCH"..."
Example: #defineSPCH""
If #defineSPCH is specified then #defineIH must also be specified.
This directive activates the construction of a Single Pre-Compiled Header (SPCH). Refer to the
icmake(1) man-page, section ICM-SPCH for specific details and options when constructing a SPCH.
The argument string can be empty, or it can contain specifications which are used when
constructing a SPCH. The --internal (or -i) option should not be specified as it is used by
default when calling icmake-S.
By default the (g++) command constructing the SPCH is echoed to the standard output stream. This
can be suppressed by specifying --quiet (or -q) in the SPCH string (e.g., #defineSPCH"-q").
Additional options for the compiler can be specified using --option (or -o) specifications.
o //#defineSPCH_ARGS"..."
Example: #defineSPCH_ARGS"specsf:compiler"
In practice the #defineSPCH_ARGS specification is hardly ever required. It requires the
specification of the #defineSPCH directive. Refer to the icmake(1) man-page, section ICM-SPCH for
specific details about this specification.
The first word (specs) defines the name of the file (used by icmake-S) to contain the names of
the headers used when constructing the SPCH. If SPCH_ARGS is not specified then icmake-S by
default uses specs. When SPCH_ARGS is used the specified name must be a plain filename, not
containing directory specifiers (like /) or an extension.
The second word (here: f:compiler) is optional, but when provided defines the file containing the
compiler-command to use when constructing the SPCH. By default the SPCH is constructed using the
following command (all on one line):
g++ -c -o $2 ${ICMAKE_CPPSTD} -Wall -Werror -O2 -x c++-header $1
To the compiler-command options specified by -o specifications provided in the #defineSPCH string
are added. It is also possible (but probably less convenient) to specify the command directly as
SPCH_ARGS’s second word. In that case surround the command by \\’ (two backslashes and a quote)
characters to ensure that the multi-word specification is interpreted by icmake-S as a single
argument.
o #defineTMP_DIR"tmp"
the directory in which intermediate results are stored. To avoid cross-device communications it’s
probably best to define TMP_DIR as a sub-directory of the project’s main directory;
o //#defineUSE_ALL"a"
when defining this directive icmbuild looks for directories containing files having the names
defined by the USE_ALL specification. All source files in those directories as well as all source
files in directories that (recursively) depend on the set of directories under consideration are
recompiled, after which the USE_ALL files are removed;
o //#defineUSE_ECHOON
when defined as ON (rather than OFF) (system) commands executed by icmbuild are echoed;
o //#defineUSE_VERSION
when defined (it is defined by default) a file VERSION is read by icmconf to determine the
program’s or library’s version, and the project’s release years. The file VERSION must be
available in the project’s main directory containing lines like:
VERSION=1.02.03
YEARS=2010-2025
)