The qconfig.mk include file

QNX SDP8.0Programmer's GuideDeveloper

Since the common makefiles have a lot of defaults based on the names of various directories, you can simplify 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 QNX ships. 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:
  • QCONF_OVERRIDE — a file that gets loaded into the framework and defines other variables.
  • INSTALL_ROOT_$(OS) — the directory where make install copies content for a given OS (e.g., INSTALL_ROOT_nto is the directory where make install copies QNX OS content). The variable only takes effect when USE_INSTALL_ROOT is set to true (e.g., 1).
  • USE_INSTALL_ROOT — if non-empty, the INSTALL_ROOT_$(OS) path is used for setting library and include paths, followed by the USE_ROOT_$(OS) path.

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, such as linux or win32). This file is a symbolic link from the place where make wants to find the actual include file (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 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 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
Refers to the $(CPU) plus the le or be (little- or big- endian) variant, which applies only to ARM processors (e.g., aarch64le). For x86 processors, no endianness variant needs to be specified, so this variable is set to x86_64.
This variable is primarily used for paths related to a host OS (Linux, Windows). For example, for a Linux host, 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 (e.g., aarch64le, x86_64). It's generally used to form paths to QNX OS files inside an SDP installation.
For example, the installation path for executables when building for Windows is:
INSTALL_ROOT_EX=$(INSTALL_ROOT_win32)/$(CPUVARDIR)
To add a CPU-specific library or include paths that aren't included by default:
EXTRA_LIBVPATH+=$(INSTALL_ROOT_win32)/$(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
Page updated: