Specifying components with bldmake
tools.bldmake
this chapter documents bldmake to e32toolp release 210 level.
Overview
The bldmake tool can be used in conjunction with makmake and abld to control the building of a component, where a component is a set of executables each of which is defined by an mmp file. bldmake processes a component description file - bld.inf - and generates several makefiles which are used by abld to carry out the various stages of building the component. 
Bldmake Invocation syntax
bldmake [ options ] command
command :
	bldfiles | clean | inf | plat
options :
	-v

where
command	is the command to be carried out by bldmake	
-v	indicates verbose operation
When this flag is specified, bldmake prints progress messages.  The default is to give error messages only.	
bldmake searches for the bld.inf component description file in the current directory and processes it.  If the bldfiles command is specified, bldmake creates the directory \EPOC32\Build\[absolute_path_to_bld.inf_file]\ and generates makefiles for the component into this directory, also bldmake produces a file called abld.bat in the current directory. abld.bat invokes Perl on script \EPOC32\Tools\abld.pl, passing the directory where bldmake has created its makefiles as a parameter to the script.
Structure of component definition files
A bldmake component description file - bld.inf - has the form
wholefile :
	section-header
		section-data
sections :
|	prj_platforms
|	prj_exports
|	prj_testexports
|	prj_mmpfiles
|	prj_testmmpfiles

Each section header can appear any number of times in the file.  The section headers and their data are case-insensitive.
Note: a trailing backslash is used to indicate a line continuation.
Use the C++ style comment syntax for comments. 
Specifying the platforms
In the prj_platforms section, list the platforms that the components supports.
prj_platforms :
	 <list_of_platforms>
If the platforms section is not found, bldmake supplies platforms WINS, ARMI, ARM4 and THUMB by default.  Specifying pseudo-platform “DEFAULT” at the start of the list will cause any subsequent platforms to be added to the default list, unless these platforms are prefixed with a hyphen (-), in which case these platforms will be removed from the list.  Platforms can be listed on several separate lines if required.
Specifying the files to be exported
In the prj_exports section, list the files to be copied from the source directories to the releasables’ directories during the building of a component.
prj_exports :
	 <source_file_1>		[<destination_file>]
	 <source_file_2>		[<destination_file>]
	 …
	 <source_file_n>		[<destination_file>]
This section is intended mainly for specifying C++ header files to be copied to directory \EPOC32\Include\.  Specify each file on a separate line.  If the source file is listed with a relative path, the path will be considered relative to the directory containing the bld.inf file.  If a destination file is not specified, the source file will be copied to \EPOC32\Include\.  If a relative path is specified with the destination file, the path will be considered relative to directory  \EPOC32\Include\.
Specifying the test files to be exported
In the prj_testexports section, list the files to be copied from the source directories to the releasables’ directories for use with test programs.
prj_exports :
	 <source_file_1>		[<destination_file>]
	 <source_file_2>		[<destination_file>]
	 …
	 <source_file_n>		[<destination_file>]
Specify each file on a separate line.  If the source file is listed with a relative path, the path will be considered relative to the directory containing the bld.inf file.  If a destination file is not specified, the source file will be copied to the directory containing the bld.inf file.  If a relative path is specified with the destination file, the path will be considered relative to directory  containing the bld.inf file.
Specifying the mmp files
In the prj_mmpfiles section, list the mmp files contained in your component.
prj_mmpfiles :
	 <mmp_file_1>		[tidy]
	 <mmp_file_2>		[tidy]
	 …
	 <.mmp_file_n>		[tidy]
	makefile		<makefile_1>		[tidy]
	makefile		<makefile_2>		[tidy]
	…
	makefile		<makefile_n>		[tidy]
Specify each .mmp file on a separate line.  If a relative path is specified with an mmp file the path will be considered relative to the directory containing the bld.inf file.  Specify the “tidy” attribute if the releasable that an mmp file defines is purely internal to your component and not required either by other components or for your component to execute.
Use keyword makefile to specify an extension makefile for your component.  Extension makefiles can be used where build activities need to be carried out which are not catered for by makefiles generated by makmake.  
Need link to format for extension makefiles here.
Build activities relating to particular .mmp files or extension makefiles are carried out in the order in which the mmp files and extension makefiles are listed in the bld.inf file.  Extension makefiles can be interspersed among the mmp files.
If an mmp file or extension makefile applies only to a particular platform place the item within #ifdefs.  The prj_mmpfiles section is preprocessed for each platform listed in the prj_platforms section.  If, for example, an mmp file relates only to the WINS platform, specify the file as follows:

#if defined(WINS)
<mmp_file>
#endif
Specifying the test mmp files
In the prj_testmmpfiles section, list the mmp files contained in your component which define test programs.
prj_testmmpfiles :
	 <.mmp_file_1>		[tidy]  [manual]  [support]
	 <.mmp_file_2>		[tidy] [manual]  [support]
	 …
	 <.mmp_file_n>		[tidy] [manual]  [support]
	makefile		<makefile_1>		[tidy]  [manual]  [support]
	makefile		<makefile_2>		[tidy]  [manual]  [support]
	…
	makefile		<makefile_n>		[tidy]  [manual]  [support]
The section for test mmp files has the same syntax as the section for standard mmp files, except that two extra mmp file attributes are provided. bldmake bldfiles creates batch files for running the test programs for your component.  For each platform, a batch file for running “automatic” tests and a batch file for running “manual” tests are created in the bldmake output directory for your component, if any such tests are listed.  The batch files are called platform-name.auto.bat and platform-name.manual.bat respectively.  “automatic” tests are those tests which can be run without any user-intervention, while “manual” tests require user-input in order for them to complete successfully.  By default, for each mmp file or extension makefile listed an entry is created in the “automatic” batch file which is the basename of the mmp file or extension makefile (note that this means that the basename of the mmp file must be the same as the basename of the releasable specified with the target statement in the mmp file if the releasable test that it defines is to be invoked successfully).  Specify the “manual” attribute if the test that the mmp file or extension makefile defines is to be included in the “manual” batch file rather than the “automatic” batch file, and specify the “support” attribute if the test is not to be included in either batch file.
Structure of extension makefiles
A bldmake extension makefile has the form
target :
	target_command_1
	target_command_2
	…
	target_command_n
Extension makefiles can be used where certain build steps are required which are not catered for by makefiles generated by makmake. A target in the extension makefile is an NMAKE.EXE target, and should be followed by a colon to denote it as such.  During build activities, abld will call the target in the extension makefile corresponding to the build activity that is being carried out, and thus the commands listed with the target in the extension makefile will be executed.  Possible targets (corresponding abld commands appear in brackets where they differ from the target) are :

CLEAN, FINAL, FREEZE, LIBRARY, MAKMAKE (makefile), RESOURCE, BLD (target), SAVESPACE (target -savespace), and RELEASABLES (target [-what | -check]).

All these targets should be provided in an extension makefile, even if no commands are listed with a particular target, since the target will be called during the build whether commands are listed or not and NMAKE.EXE will generate an error if the target cannot be found. Commands listed with each target can be calls to any tools or system commands which will be available at build-time.
If different commands are required for the same target for different platforms, special NMAKE.EXE syntax can be used in conjunction with the $(PLATFORM and $(CFG) macros which abld defines to carry out the different commands.  $(CFG) is defined as UDEB or UREL.  For example

!IF “$(PLATFORM)” == “WINS”
CLEAN :
<wins_clean_command>
!ELSE
CLEAN :
<other_clean_command>
!ENDIF
Note that ABLD changes directory to the directory containing the bld.inf file before calling NMAKE.EXE on extension makefile targets, so if relative paths are present in the extension makefiles they will be considered relative to the directory containing the bld.inf file.