The qconfig.mk include file

Updated: April 19, 2023

Since the common makefiles have a lot of defaults based on the names of various directories, you can simplify your life enormously in the common.mk include file if you choose your directory names to match what the common makefiles want.

For example, if the name of the project directory is the same as the name of the image, you don't have to set the NAME macro in common.mk.

The prototypical common.mk file looks like this:

ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)

# Preset make macros go here

include $(MKFILES_ROOT)/qtargets.mk

# Postset make macros go here

The qconfig.mk include file provides the root paths to various install and usage trees on the system, along with macros that define the compilers and some utility commands that the makefiles use. The purpose of the qconfig.mk include file is to let you tailor the root directories, compilers, and commands used at your site, if they differ from the standard ones that we use and ship. Therefore, nothing in a project's makefiles should refer to a compiler name, absolute path, or command name directly. Always use the qconfig.mk macros.

To set up separate directories for built content and an SDP installation, you can define the following variables:

By default, USE_ROOT_nto and INSTALL_ROOT_nto are set to $(QNX_TARGET).

The qconfig.mk file resides in $QNX_TARGET/usr/include/mk as qconf-os.mk (where os is the host OS, e.g., nto, linux, win32), which is a symbolic link from the place where make wants to find it (namely $QNX_TARGET/usr/include/qconfig.mk). You can override the location of the include file by specifying a value for the QCONFIG macro.

If you wish to override the values of some of the macros defined in qconfig.mk without modifying the contents of the file, set the QCONF_OVERRIDE environment variable (or make macro) to be the name of a file to include at the end of the main qconfig.mk file.

Note: Some examples of override files set VERSION_REL, which specifies the version of the OS that you're building for. This variable is primarily for internal use at BlackBerry QNX; it indicates that make is running on a build machine instead of on a developer's desktop. If you set this variable, make becomes a lot more particular about other settings (e.g., it will insist that you set PINFO).

Additional variables to note include:

CPUDIR
This variable refers to the $(CPU) plus the le or be (little- or big- endian) variant (eg. armle, aarch64le, x86_64). It's primarily used by QNX for paths related to a host OS (Linux, Mac, Windows).
For example, if the host OS is Linux, the installation path for executables when building is:
INSTALL_ROOT_EX=$(INSTALL_ROOT_linux)/$(CPUDIR)
Note: $(CPUDIR) is a macro and isn't the same as ${cpudir} which is an environment variable used in build-hooks files.
CPUVARDIR
Refers to $(CPUDIR) plus a variant suffix (eg. armle-v7, aarch64le, x86_64). It's generally used to form paths to QNX Neutrino files inside an SDP installation.
For example, the installation path for executables when building for QNX Neutrino is:
INSTALL_ROOT_EX=$(INSTALL_ROOT_nto)/$(CPUVARDIR)
To add an additional CPU-specific library or include paths that aren't included by default:
EXTRA_LIBVPATH+=$(INSTALL_ROOT_nto)/$(CPUVARDIR)/io-sock/lib
To reference other configurations stored in a QNX SDP installation, such as Qt specifications:
QMAKE-SPEC-DIR = $(QNX_TARGET)/$(CPUVARDIR)/usr/share/$(QT_VERSION)/mkspecs