Produce Multiple Targets from One Build

You can specify any number of targets for a build. For example, you can build several libraries and the executable file that uses those libraries in one build. Simply specify each library and the executable as target files.

If your sources are C source files or object files, you can reuse them within one build as often as you want, to build any number of targets.

The one-definition rule limits the way you can reuse C++ source files in one codestore. You you cannot refine external functions or variables in the codestore. Therefore, you sometimes need more than one codestore to build more than one target. If two or more of the targets contain common external functions or variables, you must have different codestores for the targets that conflict. Here are the most common combinations of targets, sources, and options for which you need separate codestores:

There are two approaches you can take for builds:

You can automate a build that requires more than one codestore the following way:

  1. Create a separate configuration file for each target that you must build with a separate codestore. You can reduce duplication by moving lines that are common to more than one configuration file into other files that you can use as included configuration files during the build. Replace the common lines with include directives to process the included configuration files at build time.
  2. Create a makefile that runs the vacbld command once for each configuration file. You can also set up environment variables in the makefile for use during each run of vacbld.

    or

    Create another configuration file that contains a sequence of run directives, each of which issues a vacbld command. This method removes the need for a makefile. However, it may be less convenient if you use environment variables, because you cannot assign values to environment variables in a configuration file.



Configuration Files
Codestore
One-Definition Rule
Conditional Processing in Builds
When to Use Makefiles


Add or Change Source Files
Add or Change Targets
Change a Build Setup
Build
Run the Make Utility