icmbuild - A generic, easy configurable, program maintenance script
The icmbuild script is a generic script that can be used to do program
maintenance using icmake(1).
The script expects two files to be available in the directory where
program maintenance is required, and the icmbuild script should be
available in your path or it should be started as, e.g., ./icmbuild
Icmbuild assumes that your sources exist in and below a directory in
which the files icmconf and CLASSES live. The file CLASSES contains the
names of all subdirectories in which class-specific sources are kept.
The file examples/icmbuild in icmake(1)’s distribution offers an
example of the configuration parameters. In this latter file it is
assumed that C++ sources are maintained, but the icmbuild script is
not restricted to do maintenance for C++ programs.
Icmbuild compiles all sources in each of the subdirectories named in
the file CLASSES, and then compiles all sources in the current working
directory (except for the source containing main()).
The compiled sources result in object modules which are then kept in a
library, against which the main-object module is linked. It is also
possible to specify additional libraries against which the program must
Once a library is constructed it is kept up to date by the script.
Changing a source will result in replacing its former module by its new
module in the library.
Normally, icmbuild is installed and used as follows:
o Install icmbuild in your path;
o copy icmconf and CLASSES to your project’s base directory (i.e.,
the directory in which and where below the project’s sources are
o Modify the #defines in the file icmconf to taste;
o List the subdirectories containing sources in the file CLASSES
Note that the order of the classes mentioned in classes is
relevant here. It’s no problem to add new class (subdirectory)
names, but reordering should be prevented. If reordering is
required, recompile the library, as the final object files
contain class order-numbers. These class-order numbers prevent
file-name collisions and thus prevent replacing file x.o from
class A by file x.o from class B;
o Now simply run
from the project’s base directory and let the help-info tell you
what your options are. See the next section for the modes of
Icmbuild may be called with the following operational modes:
clean up remnants of previous activities
provide help and exit (default when called without arguments)
build the static library
build the binary program
o install <base> install the software in the locations defined in
the icmconf file, optionally below the directory <base> The
icmconf file may contain a line defining DEFCOM containing the
default operational mode to use when none is specified. E.g.,
#define DEFCOM "program"
will construct the program when the command ‘icmbuild’ is
The mentioned paths are sugestive only and may be installation
o /usr/share/icmake/icmconf Example of a icmbuild configuration
o /usr/share/icmake/CLASSES Example of a icmbuild CLASSES file.
Here is an example of the configuration file icmconf for a concrete
program, using the library libbobcat1 as an additional library:
// Inspect the following #defines. Change them to taste. If you don’t
// need a particular option, change its value into an empty string
// The final program and source containing main():
// define the name of the source containing main():
#define MAIN "main.cc"
// define the name of the program to create (don’t use a path here, but
// define the installation path at ‘BIN_INSTALL’ below) and use
// ‘icmbuild install’ to install the binary.
#define BINARY "binary"
// Uncomment to install the binary in the provided path using
// ‘icmbuild install’
//#define BIN_INSTALL "/usr/local/bin"
// Defines related to the local libraries to create:
// Uncomment to create a local library rather (when a binary program is
// built it will be linked against the library rather than the individual
// object modules). Change the lib’s name at you own digression (don’t use
// lib or an extension like .a)
//#define LIBRARY "modules"
// Uncomment to construct a shared library
// Uncomment to install the libraries in the provided path using
// ‘icmbuild install’
//#define LIB_INSTALL "/usr/local/lib"
// #defines used for compilation and linking:
// define the compiler to use:
#define COMPILER "g++"
// define the compiler options to use.
// For the upcoming c++0x standard with the Gnu g++ compiler add the
// -std=c++0x flag
// To enable GNU extensions in addition to C++0x extensions, add the
// -std=gnu++0x flag
#define COMPILER_OPTIONS "-g -Wall -O2"
// define the pattern to locate sources in a directory:
#define SOURCES "*.cc"
// define the options used for linking:
#define LINKER_OPTIONS "-s"
// define any additional libraries BINARY may need:
#define ADD_LIBRARIES ""
// define any additional paths (other than the standard paths) the
// additional libraries are located in:
#define ADD_LIBRARY_PATHS ""
// Some advanced #defines, used to create parsers and lexical scanners
// Lexical Scanner section
// Should a lexical scanner be constructed? If so, define the subdirectory
// containing the scanner’s specification file.
#define SCANNER_DIR ""
// What is the program generating the lexical scanner?
#define SCANGEN "flex"
// Flags to provide SCANGEN with:
#define SCANFLAGS "-I"
// Name of the lexical scanner specification file
#define SCANSPEC "lexer"
// Specify additional lexer specification files using patterns
// these files are (in)directly included by SCANSPEC
//#define SCANFILES ""
// Name of the file generated by the lexical scanner
#define SCANOUT "yylex.cc"
// Parser section
// Should a parser be constructed? If so, define the subdirectory
// containing the parser’s specification file
#define PARSER_DIR ""
// What it the program generating a parser?
#define PARSGEN "bisonc++"
// Flags to provide PARSGEN with:
#define PARSFLAGS "-V -l"
// What it the grammar specification file?
#define PARSSPEC "grammar"
// Specify additional grammar specification files using patterns
// these files are (in)directly included by PARSSPEC.
//#define PARSFILES ""
// Since bisonc++ 2.0.0 the GRAMBUILD directive is obsolete.
// If GRAMBUILD is still used, uncomment the following directive.
// Note that ’PARSEFILES’ overrules ’GRAMBUILD’
// Name of the file generated by the parser generator containing the
// parser function
#define PARSOUT "parse.cc"
// Additional defines, which normally require no modification
// should commands be echoed (ON) or not (OFF) ?
#define USE_ECHO ON
// Directory below this directory to contain temporary results
#define TMP_DIR "tmp"
// The extension of object modules:
#define OBJ_EXT ".o"
// Use the VERSION file
// below #define DEFCOM "program" or "library" may be added by icmstart
icmake(1), icmstart(1), icmstart.rc(7)
This is free software, distributed under the terms of the GNU General
Public License (GPL).
Frank B. Brokken (email@example.com).