At the beginning of many Makefile examples you often see something called a “pattern rule”. In this example we see the following:
Most of the more obvious pattern rules are predefined and this type of rule isn’t particularly relevant for a very small project like this, but a version of it was included in the original so we’ve kept it in there. This essentially acts as a generic rule for any input ESQL-C source file that is presented as an argument to the make utility or not included as a dependency in an explicit rule.
is not a valid ESQL-C compiler option but a C compiler option. The
option will create an object
file from any input source
file. The linker isn’t invoked by
flag is set which means no executable is created.
In order to generate an executable from this object file we would usually call esql again using the generated object file and any dependent object files as input. Note that it is possible to use the native C compiler utility to invoke the linker, but the linker command would look something like the following:
is one of a number of common static library files used by
programs. You would need to include all such files in the linker command for the linker process to complete successfully. It is actually possible to generate a complete list of static library files referenced by
using the following command:
. Note that, using
, there is no requirement to explicitly reference the library paths as these are specified in the environment variable
In the original Makefile there were two additional variables that were set,
. These have been removed or unset in the new version. This demonstrates a hazard when adapting another project’s Makefile.
In the original Makefile,
was only included as part of an
is included by default as part of the
static library list. This means that the reference to
was redundant for the Informix version so we removed any reference to it.
In the original Makefile, the variable
was set to
. By default this generated a debug version of the target object file and executable. This wasn’t required for our benchmark test so we unset this variable.
Informix ESQL-C requires that the Informix environment is set correctly. An explanation of those environment variables that are used by ESQL-C can be found at:
The syntax for the
command can be found at: