The addvariant utility knows how to work with
code that uses a GNU ./configure script for configuration.
If the current working directory contains files named
configure and Makefile.in, addvariant
automatically squashes the directory levels (as described earlier) into
a single OS-CPU-VARIANT level
and creates GNUmakefile files in the newly
created directories along with a recursing Makefile.
After you've run addvariant, create an executable shell script
called build-hooks in the root of the project.
This file needs to define one or more of the following shell functions (described in more
detail below):
Every time that you type make in one of the newly created
directories, the GNUmakefile is read (a small trick that
works only with GNU make).
GNUmakefile in turn invokes the
$QNX_TARGET/usr/include/mk/build-cfg script,
which notices whether or not configure has been run in
the directory:
- If it hasn't, build-cfg invokes the
hook_preconfigure() function, then the project's
configure, and then the hook_postconfigure()
function.
- If the configure has already been done, or we just did it successfully,
build-cfg invokes the hook_premake(), then does
a make -fMakefile, then hook_postmake(), then
hook_pinfo().
If a function isn't defined in build-hooks,
build-cfg doesn't bother trying to invoke it.
Within the build-hooks script, the following variables are available:
- SYSNAME
- The host OS (e.g., nto, linux) that we're
running on.
This is automatically set by build-cfg, based on the results of
uname.
- TARGET_SYSNAME
- The target OS (e.g., nto, win32) that we're
going to be generating executables for.
It's set automatically by build-cfg, based on the directory
that you're in.
- make_CC
- This variable is used to set the CC make variable
when we invoke make.
This typically sets the compiler that make uses.
It's set automatically by build-cfg, based on the directory
that you're in.
- make_opts
- Any additional options that you want to pass to make
(the default is "").
- make_cmds
- The command goals passed to make (e.g., all).
It's set automatically by build-cfg what you passed on the
original make command line.
- configure_opts
- The list of options that should be passed to configure.
The default is "", but --srcdir=.. is automatically
added just before configure is called.