Makefile Conversion Aid Considerations

The makefile conversion aid, make2cfg, helps you convert your existing makefiles into configuration files. Configuration files are required for the build process in the IDE. The conversion attempts to reproduce as closely as possible the general behavior of the makefile. (Information about using the make2cfg aid is described in Convert Makefiles to Configuration Files.)

MAKE2CFG Restrictions and Limitations

Multiple Configuration Files

make2cfg attempts to put all targets specified in the makefile into a single configuration file. However, there are configuration file restrictions that prevent make2cfg from doing so in some cases. When those conditions occur, make2cfg creates multiple configuration files based on the following guidelines:

Import library generation is handled as part of the build of a DLL. Makefile rules that build an import library, by using ILIB for example, will not be propagated to the configuration file if the following conditions occur:

If an executable file is also being built and it has a dependency on the import library, the dependency will be removed because a DLL and an executable file built in the same configuration file is all that is needed.

Configuration File Names Generated by MAKE2CFG

The names of configuration file created by make2cfg are based on the target being produced plus the .icc extension. If main.exe is the target, the configuration file name created by make2cfg is main.icc.

There is the possibility that multiple targets in a makefile could result in configuration files with the same name. To avoid this, the file extension of the target is appended to the configuration file name with an underscore. If main.exe and main.dll are the targets, the configuration file names will be main_exe.icc and main_dll.icc, respectively.

Since FAT file systems on OS/2 limit the number of characters in a file name to 8 characters for the name and 3 characters for the extension, the possibility exists for configuration file names to occur more than once. Duplicate names can also occur on non-FAT file systems when directories are specified. To avoid duplicate names, characters are replaced with numbers, starting with the 8th character.

The following table summarizes naming alternatives for configuration files for OS/2 and Windows NT:

Makefile target 8.3 file names
(OS/2 FAT file system)
Long file names
(OS/2 HPFS and Windows NT)
main.exe main.icc main.icc
themainfile.exe themainf.icc themainfile.icc
themainfile.exe
themainfile.dll
them_exe.icc
them_dll.icc
themainfile_exe.icc
themainfile_dll.icc
themainfile.exe
themainfile.dll
themainframe.dll
them_exe.icc
them_dll.icc
them_dl1.icc
themainfile_exe.icc
themainfile_dll.icc
themainframe.icc

main.exe
mymain.dll
(when qnameprefix=theprefix)
theprefi.icc
thepref1.icc
(when qnameprefix=theprefix)
theprefix_main.icc
theprefix_mymain.icc

themainfile.exe
themainfile.dll
themainframe.dll
(when qnameprefix=my)
my_thema.icc
my_them1.icc
my_them2.icc
(when qnameprefix=my)
my_themainfile_exe.icc
my_themainfile_dll.icc
my_themainframe.icc

sub1\hi.dll
sub2\hi.dll
...
sub11\hi.dll
(when qnameprefix=a)
a_hi_dll.icc
a_hi_dl1.icc
...
a_hi_d10.icc
(when qnameprefix=a)
a_hi_dll.icc
a_hi_dll1.icc
...
a_hi_dll10.icc
sub1\hi.dll
sub2\hi.dll
...
sub11\hi.dll
hi_dll.icc
hi_dll1.icc
...
hi_dll10.icc
hi_dll.icc
hi_dll1.icc
...
hi_dll10.icc

Note that the examples in the table assume that a separate configuration file is generated for each target shown. However, a configuration file may contain more than one DLL, in which case one of the DLLs is chosen for use as the configuration file name.

The following table summarizes naming alternatives for configuration files for AIX:

Makefile target Long file names
(AIX)
main main.icc
themainfile themainfile.icc
themainfile
themainfile.a
themainfile.icc
themainfile_a.icc
themainfile
themainfile.a
themainframe.a
themainfile.icc
themainfile_a.icc
themainframe.icc

main
mymain.a
(when qnameprefix=theprefix)
theprefix_main.icc
theprefix_mymain.icc

themainfile
themainfile.a
themainframe.a
(when qnameprefix=my)
my_themainfile.icc
my_themainfile_a.icc
my_themainframe.icc

sub1/hi.a
sub2/hi.a
...
sub11/hi.a
(when qnameprefix=a)
a_hi_a.icc
a_hi_a1.icc
...
a_hi_a10.icc
sub1/hi.a
sub2/hi.a
...
sub11/hi.a
hi_a.icc
hi_a1.icc
...
hi_a10.icc

When the make2cfg process ends, it displays a list of the configuration files created and the corresponding targets that the names were generated from. For example:

Makefile Target           Configuration File
themainfile.exe ......... them_exe.icc
themainfile.dll ......... them_dll.icc
themainframe.dll ........ them_dl1.icc  

Configuration File Contents

Configuration files created by make2cfg contain the following:

lang(allowTypedefAsClassName,yes),
gen(mangleLinkageKeywordOnlyFuncs,no),
lang(compatMath,yes),
lang(ansiForStatementScopes,no),
lang(nokeyword,"bool"),
lang(nokeyword,"export"),
lang(nokeyword,"false"),
lang(nokeyword,"mutable"),
lang(nokeyword,"true"),
lang(templateDefImpls,dontparse),
macros(redefine,yes),
link(nameMangling,compat)

For AIX, the options in the group are:

lang(allowTypedefAsClassName,yes),
gen(compatNestedTemplateAlignmentRule,yes),
lang(compatMath,yes),
lang(ansiForStatementScopes,no),
lang(nokeyword,"bool"),
lang(nokeyword,"export"),
lang(nokeyword,"false"),
lang(nokeyword,"mutable"),
lang(nokeyword,"true"),
lang(templateDefImpls,dontparse),
macros(redefine,yes),
link(nameMangling,compat)

Note that you need to remove source type(obj) 'cppwpa3.obj' from the .icc file if cppwpa3.obj was present in the original Windows NT makefile. You also need to add option gen(rtti) to the configuration file if you plan to use the new version of IBM Open Class included in the VisualAge C++, Version 4.0.

Command Grouping

In a makefile, the commands listed within a description block will either all be executed or not. To reproduce this behavior for run directives in a configuration file, make2cfg adds a group directive for each description block in the makefile. Each group directive contains a list of all of the dependency files that could trigger the description block. By using the group directive as the source clause for all run directives under a single description block, the run directives are grouped together for common execution. The following is an example of a group directive created by make2cfg:

   group R_ahellow4_rc_ = 'ahellow4.rcx'
   run sources(R_ahellow4_rc_) targets('ahellow4.rc')
     'IRCCNV ahellow4.rcx ahellow4.rc'
   group D_ahellow4_rc_ = 'ahellow4.rc', R_ahellow4_rc_ 

Mapping Makefile Commands to Configuration File Directives

Makefile commands for tools not directly supported by the make2cfg conversion aid will be converted to run directives in the configuration file. make2cfg will not produce build extensions in the configuration file for these tools. For example, the IPF command in a Windows NT makefile is converted to the following run directive in the configuration file:

    group R_general_hlp_ = 'general.ipf'
    
    run sources(R_general_hlp_) targets('general.hlp')
      'ipfc /q /hlp general.ipf'

Options for the following tools will be converted to their configuration file equivalents:

However, not every option in the makefile has a corresponding option in the configuration file. The makefile conversion proceeds on the assumption that the makefile worked prior to conversion and therefore all options should be valid.

On an AIX operating system, the compiler has a number of command variations with different default options that can be used directly from the command line or can be specified with the -F option. When the -F option is used with a recognized compiler command, make2cfg will map it to an option, defaults(option), in the configuration file, where option is one of the following. The "i" prefix on the command variation is removed when it is inserted in the option.

xlC xlC128 xlC128_r xlC128_r7 xlC_r xlC_r4 xlC_r7
xlc
ixlc
xlc128
ixlc128
xlc128_r - xlc_r
ixlc_r
xlc_r4 xlc_r7
cc
icc
cc128
icc128
- - cc_r
icc_r
cc_r4 cc_r7
- - - - - CC_r4 -
c89
ic89
- - - - - -

 



Migration Tools


Convert Makefiles to Configuration Files


run Configuration File Directive
group Configuration File Directive