Convert Makefiles to Configuration Files

The command-line makefile conversion aid, make2cfg, helps you convert your existing makefiles into configuration files, which are required for the build process. make2cfg attempts to reproduce as closely as possible the general behavior of the original makefile. In many cases the generated configuration file needs modification to handle situations specific to the build process being converted. make2cfg does not support the cross-platform conversion of makefiles. It must be run on the platform for which the makefile was written.

Determine whether the makefile maps to a single build configuration or multiple build configurations by examining the makefile variables and how the make utility is invoked. A makefile represents more than one build configuration if it can be run with different sets of options and environment variables, for example, if the same makefile could be used to build either a debug or a non-debug version of an executable.

Repeat the following steps for each build configuration represented in the makefile:

  1. Ensure that the make utility is visible in your system path.
  2. Change to the directory that contains the makefile for your application.
  3. Ensure that the makefile you intend to convert is valid by executing the make utility with the -n -p option. This generates a stream of commands without executing them.
  4. Create any files that the makefile would normally depend on and generate. This ensures that the make utility used by make2cfg runs successfully because the files on which it has dependencies do exist. An error message is generated if one of these files is missing.
  5. Set any environment variables needed for the makefile to run properly. For example, if you intend to build a debug version of the project, and there is a TYPE environment variable that is set to /Ti+ /O- for debug builds, and to /Ti- /O+ for production builds, ensure that TYPE is set for a debug build before running make2cfg.
  6. Invoke make2cfg by typing the following command at the VisualAge C++ command prompt:

    make2cfg [
    options]

    Where options are:
     
    -f filename
    Specifies the name of the makefile to be converted, otherwise make2cfg assumes makefile as the name. For example, specify make2cfg -f one.mak at the command prompt if you had previously specified nmake -f one.mak.
    -qna[meprefix]=prefix
    Sets the prefix for the name of the configuration file. This is useful if multiple sets of configuration files are to be created from the same makefile. If you do not specify this option, the name of the configuration file created by make2cfg is based on the target being produced.
    -qov[erwrite]
    Overwrites a configuration file if it has the same file name as the one being created. If you do not specify this option, make2cfg ends with an error if the file name for the new configuration file already exists.
    -qto[ol]
    Specifies the executable name of the make utility that runs on the makefile. The default make utility on OS/2 and Windows NT is nmake, and on AIX it is make. The make utilities supported by the conversion aid are:
    nmake on OS/2 Versions 3 through 5
    nmake on VisualAge for C++ for Windows, Version 3.5
    make on AIX Version 4.1.4 (with PTF U440378) and on AIX Versions 4.2 and 4.3
    gnumake Version 3.74 on AIX, OS/2, and Windows NT.
    -qru[n]
    Initiates a migration build on the first configuration file generated by make2cfg by executing the command vacbld config.icc -migrationbuild. This first configuration file generally represents the first target in the makefile, or the closest to the ALL target in the tree of dependencies in the makefile. For complicated makefiles producing multiple .exe, .dll, or .lib targets, multiple configuration files are generated by make2cfg. When this occurs you should not use -qrun because not all of the configuration files are used in the build process.
    make utility options
    Are the options you use when you run the make utility. Use the same options when you run make2cfg.
    -? or -h[elp]
    Displays the command line help that lists the format for running make2cfg and identifies the options you can use.
  7. Compare the output created for each build configuration. If differences exist, you can do one of the following actions:

MAKE2CFG Output

Two forms of output result from running the conversion aid:

You may need to modify the configuration file generated by make2cfg before you perform a migration build or a normal build. For example, you may need to change some of the options specified in the configuration file to ensure compatibility between your code and the new language level supported in this product. You may also want to change the options to allow you to take advantage of the new level of IBM Open Class in the product. In some cases, build steps in the makefile, such as the creation of import libraries, are no longer required in the configuration file and are removed by the conversion aid. In other cases, these may not be removed by the make2cfg process and you need to edit the configuration file to remove them. The error messages generated during your first few builds will also help you determine the changes you need to make in your configuration file.

The MAKE2CFG Conversion Aid and Recursive Makes

The make2cfg conversion aid does not handle recursive make invocations (the make utility invoked within a makefile). For situations where recursive makes occur, take the following actions:



Configuration Files
How Configuration Files Are Processed
Migration Tools


Migrate Source Files


Makefile Conversion Aid Considerations