Makefiles are another source of drudgery for C++ programmers. On large projects, makefiles are difficult to manage and frequently become out-of-date, so you often need to resort to automatic dependency generators.
The VisualAge philosophy is that the computer should serve the programmer, not the other way around. When you tell VisualAge C++ what to build, the compiler figures out how to build it.
A project consists of one or more related C++ object files, libraries, and executables, together with the corresponding source files, processing rules, and processing options. The output object files, libraries, and executables are called targets, and the source files are called sources. A project will often contain different configurations, which are different versions of the same project, but with different sets of options.
A configuration file defines a project's configurations. The configuration file is different from a makefile in that you do not need to specify processing and inter-file dependencies for C++ files. You only need to specify source-to-target dependencies. Therefore, where a makefile says:
"Call the C++ compiler with this source, these options, producing this target, when these header files change"
a configuration file says:
"This is a C++ source and here are its options; this is a C++ target and here are its options; here is the list of which sources map to which targets."
Here is a simple example of a configuration file annotated with comments:
option
link(linkwithmultithreadlib), // Use multi-threaded library
link(linkwithsharedlib) // Use shared library
{
target "carlot" // Produce an executable
{
option
lang(offsetofnonpodclasses), // Backward compatibility for old code
lang(digraphs, no),
incl(searchpath, "."),
lang(nokeyword, "true"),
lang(nokeyword, "false")
{
source type(cpp) "carlot.cpp" // List of C++ sources
source type(cpp) "car.hpp"
source type(cpp) "car.cpp"
source type(cpp) "truck.hpp"
source type(cpp) "truck.cpp"
source type(cpp) "vehicle.hpp"
source type(cpp) "vehicle.cpp"
source type(cpp) "vlist.hpp"
source type(cpp) "vlist.cpp"
}
}
}
This configuration file specifies that a batch of C++ source is to be compiled and linked to produce an executable file. Some options are specified for compatibility with pre-C++ standard (for example, true and false are not treated as keywords). However, the configuration file does not indicate that vehicle.o depends on vehicle.cpp, vehicle.hpp, and so forth. In fact, because the target is an executable file, no object files are even produced.
You can build a project using different configuration files, or by processing configuration files conditionally.
The IDE provides a simple interface for creating and maintaining configuration files, so that you do not have to write or edit the files yourself. The IDE can handle any configuration file, whether it is coded by hand or generated by the IDE.
