A template extension makefile is a makefile which is integrated into the
Symbian OS build system, such that it can be re-used by providing different
input values as parameters. This facility allows extension makefiles to
separate behaviour of the makefile from its input data. For example, you might
want to copy files from one location to another using a template extension
makefile which represents the required behaviour. The location from where these
files have to be copied is represented by the input data, which can be
specified in the bld.inf
file using prj_extensions.
Note that it is recommended to follow GNU make syntax to define template extension makefiles. For more details on GNU make syntax, refer http://www.gnu.org/software/make/manual/html_chapter/make_toc.html.
The template extension makefiles are invoked by the build system which defines a set of standard makefile variables. These variables can have well defined values and help the makefile writer to locate common directories, configurations and so on. The proper usage of these variables may result in achieving platform independence to a certain extent. It is highly recommended to use these variables wherever it is necessary.
The following is a list of the variables defined:
|
The extension makefiles integrated into the build system should support a number of phony targets which correspond to different phases of the Symbian OS build process. These phony targets are labels representing a set of commands to be executed to perform a task. For more information on these phony targets, refer to Extension makefile targets.
The commands for a phony target can be platform specific operations such as creating a directory, removing a directory, copying a file and so on. It is recommended to use the above listed variables to perform these platform specific operations, instead of invoking the command directly.
For example, the following will delete the files values.cpp
and config.cpp
for the target CLEAN.
CLEAN :
-$(ERASE) $(MDIR)$/values.cpp
-$(ERASE) $(MDIR)$/config.cpp
Note that any path within a template extension makefile is recommended to use the path separator variable $/ as listed in the above table.
A template extension makefile can be referenced in the
bld.inf
file using the prj_extensions
keyword. For
more information on how to reference a template extension makefile, see
prj_extensions.
Each template extension makefile has an associated meta file which provides additional information such as the template makefile type, the platform for which the template can be applied and so on. It is mandatory to have a meta file with each template extension makefile. For information on meta file syntax, refer to Meta files.
Note that all the template extension makefiles along with their meta files need to be located under the \epoc32\tools\makefile_templates\ folder.
This example will copy the source files to a target path, build the component using the target copy of the source files, and finally delete the target copy of the source files.
# copy_default.mk
#
SOURCE_COPY=$(EPOCROOT)epoc32$/release$/$(PLATFORM_PATH)$/$(CFG_PATH)$/$(SOURCES)
TARGET_COPY=$(EPOCROOT)epoc32$/release$/$(PLATFORM_PATH)$/$(CFG_PATH)$/$(TARGET)
$(TARGET_COPY) : $(SOURCE_COPY)
$(CP) "$?" "$@"
DO_NOTHING :
@rem do nothing
MAKMAKE :
BLD : $(TARGET_COPY)
SAVESPACE : BLD
FREEZE : DO_NOTHING
LIB : DO_NOTHING
CLEANLIB : DO_NOTHING
RESOURCE : DO_NOTHING
CLEAN :
-$(ERASE) $(TARGET_COPY)
RELEASABLES :
@echo $(TARGET_COPY)
FINAL :