Generate Makefiles from Configuration Files

The configuration exporter (cfgexprt) generates a makefile from a configuration file. The generated makefile needs to be modified before it can be used on other platforms or with other compilers to build the project as it was described in a project configuration file.

The configuration file lists source file names and the targets these source files are translated into. The exact list of source files and targets can be altered by the values of environment variables in the configuration file. The configuration exporter creates a makefile for one set of values of the environment variables.

Ensure that the configuration file builds successfully and has been optimized before you run cfgexprt. To generate a makefile from a configuration file, type the following command at the VisualAge C++ command prompt:

cfgexprt [options] configuration_file

where options are:

-? or -Help
Displays the command line help that lists the format for running cfgexprt and identifies the options you can use.
 
-C codestore_file
The name of the codestore file. This option is required if the -qdendepend option is also specified; otherwise, it is optional.
 
-Dname[=value]
The values of environment variables referenced in the configuration file. By default the configuration exporter ignores the values of environment variables defined in the shell in which the configuration exporter runs. (See the the -qcheckshell option below.) If the -Dname option is used more than once for the same option, the last occurrence takes precedence. The value of the environment variable from the -Dname option overrides the value from the command shell.
 
-O file
The name of the makefile generated by the configuration exporter. The default name is determined by the value specified with the -qtargetos option.
When -QTargetos=   The name of the makefile for -O is
AIX   Makefile
NT   makefile
OS2   makefile
WIN95   makefile
 
-QDependinc=file
Enables you to include a makefile that contains the list of dependencies between source files and header files. The include statement is only generated if this option is used. You would typically use a tool such as makedep on the target platform to build the correct dependency list.
 
-Q[NO]Gendepend
Indicates that the configuration exporter should add the dependencies found in the configuration file specified in the -c codestore_file option to the generated makefile. The dependency information from the last successful build is extracted from the codestore file and appended to the appropriate rule with {%INCLUDE%} in front of each file name, if the target operating system is not AIX. Another way to handle dependencies is to specify -qdependinc and generate a dependency file using a tool such a makedep.
 
-Q[NO]Checkshell
Causes the configuration exporter to check the command shell for the value of an environment variable if the variable is not defined with the -Dname option. The default -qnocheckshell does not check the command shell for a value.
 
-QTargetos=(AIX|NT|OS2|WIN95)
Specifies which operating system the generated makefile can be used on. This option defaults to the operating system that the project currently resides on.
-QTargetos=   To produce
AIX   UNIX and GNUmake-compatible makefile
NT   nmake for Windows NT-compatible makefile
OS2   nmake for OS/2-compatible makefile
WIN95   nmake for Windows 95-compatible makefile
 
configuration_file
The name of the configuration file.

Note that the minimum number of characters required to specify the options are shown in uppercase. The options, however, are not case sensitive. Some options are incompatible, in which case the first option specified takes precedence.

The Format of the Generated Makefile

The following list delineates the structure of the makefile generated by the configuration exporter:

all:run_before_rules\
  run_target_rules\
  run_after_rules
 
run_before_rules: <list of targets of the run_before directive>
 
run_target_rules: <list of all targets and default run directives>
 
run_after_rules: <list of targets of the run_after directive>
 
clean:
      <erase all files that appear as targets and intermediate files>
<include <dependency file>>

The makefile has the standard all target. Building the all target builds the project in a similar manner as it would be built in VisualAge C++ Version 4.0 with a configuration file. The following order is preserved:

Restrictions and Limitations

The makefile created by cfgexprt does not reproduce all of the specifications defined in the configuration file used as the source for the conversion process. The following list gives you an indication of some of the items that need to be addressed manually in the makefile:



Migration Tools


Configuration File Directives Mapped to Makefile Rules