| Home · All Classes · Annotated · Functions |
This document is designed for people who need to extend or modify the build system. If you are looking for information about using the build system (including writing .pro files) refer to: Build System User Guide and Build System Reference.
The User Guide states that environment variables are not required, however, that is not strictly correct. The build system causes the environment variables to be set appropriately when building and the configure, qtopiamake and Makefile scripts handle this for you. However, there are various scripts that cannot be run without environment variables set. If they are run from one of the scritps above, they will be fine but manual running will cause problems.
The following variable is expected by configure:
The following variables can be defined if required:
The following table displays the variables that are set by configure and Makefile:
| Variable | Description |
|---|---|
| QMAKEFEATURES |
|
| QTDIR |
|
| PREFIX |
|
| DPREFIX |
|
The following table describes the variables that Makefile allows you to override:
| Variable | Description |
|---|---|
| PREFIX | Change where Qtopia is installed to. |
| DPREFIX | Change where Qtopia Desktop is installed to. |
| D | See Debugging qmake for details. |
The rest of the feature files are described below since they are not all loaded for any given project.
Features are introduced in qmake 4 and have the following characteristics:
The example provided is used because Qtopia's default_pre.prf needs to load the Qt default_pre.prf file.
Note: When adding a new .prf file that matches one of the global files, to the project root features directory, be sure to load the global file unless you completely replace its functionality. For example:
# $QPEDIR/tests/features/qtopiadesktop.prf
load(qtopiadesktop) # get the Qtopia one
# override something that we didn't like
The following table describes features that can be loaded after a project's .pro file . Note: Some of these files are described in more detail later:
| Feature | Description |
|---|---|
| common.prf |
|
| depends.prf | Process commands from projects that are dependencies. |
| i18n.prf |
|
| installs.prf | Most of the Install Helpers are implemented here. |
| packages.prf | Create installable packages. |
| qtopia.prf | Qtopia-specific config. |
| qtopiadesktop.prf | Qtopia Desktop-specific configuration. |
| singleexec.prf | Set up a singleexec build (Qtopia only). |
| stub.prf | Set default values for stub projects. |
| subdirs.prf |
|
Items are installed to different locations depending on the edition and platform you are building for.
| Qtopia | Qtopia Desktop | |||
|---|---|---|---|---|
| Linux | Windows | Linux | Mac OS X | |
| Binaries | /bin | / | /bin | See note below |
| Libraries | /lib | / | /lib | <bundle>/Frameworks |
| Plug-ins | /plugins | /plugins | /qtopiadesktop/plugins | <bundle>/Resources/plugins |
| Resources | / | / | /qtopiadesktop | <bundle>/Resources |
Note:
As you can see, no locations are common between the supported configurations. The install_prefix feature provides the following variables that allow the install path to be set correctly:
Using these variables is not strictly required for Qtopia-only projects and there are some situations where you should not use them, including:
To display debug messages (including dependency statements) touch $QPEDIR/src/build/debug_on or export QMAKE_DEBUG_ON=1.
To display qmake debug run the command: make qmake-debug. You can specify more verbosity by running make qmake-debug D="-d -d -d" (more -d's indicates a more verbose debug).
To display when each build system file is processed touch $QPEDIR/src/build/trace_on. The output has more information than it should but there is no easy way to fix that. The following is an annotated example, showing which parts are relevant:
These files are not read by your project.
Project MESSAGE: .qmake.cache
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: .qmake.cache
Here is the real starting point that is, the last .qmake.cache before the first functions.prf.
Project MESSAGE: .qmake.cache
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: datebook.pro
Project MESSAGE: default_post.prf
Project MESSAGE: qtopia.prf
Project MESSAGE: depends.prf
These files are not read by your project.
Project MESSAGE: START DEPENDENCIES
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: qtopia.pro
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: qtopiapim.pro
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: quicklauncher.pro
Project MESSAGE: INDIRECT DEPENDENCIES
Project MESSAGE: default_pre.prf
Project MESSAGE: functions.prf
Project MESSAGE: config.prf
Project MESSAGE: server.pro
Project MESSAGE: END DEPENDENCIES
These files are being read by your project.
Project MESSAGE: i18n.prf
Project MESSAGE: installs.prf
Project MESSAGE: common.prf
The following table describes the variables available to help you locate files, directories and paths:
| Variable | Descripition |
|---|---|
| SRCDIR |
|
| OUT_PWD | Directory containing the Makefile. |
| QPEDIR | Build tree. |
| QTOPIA_DEPOT_PATH | Source tree. |
| PWD | The directory containing the currently-executing .pr[iof] file. Note: This will change as each file is read). |
| QTDIR | Qt or Qtopia Core build tree (depending on what the current project uses). |
| QT_DEPOT_PATH | Qt or Qtopia Core source tree (depending on what the current project uses). |
| QTEDIR | Qtopia Core build tree. |
| QTE_DEPOT_PATH | Qtopia Core source tree. |
| DQTDIR | Qt build tree. |
| DQT_DEPOT_PATH | Qt source tree. |
Note:
The following is a guide to style issues when coding:
Libraries must be processed before other projects that link to them. When qmake processes a library it creates a .prl file. When a project links to a library, qmake reads the .prl file. If the .prf file does not exist, qmake will guess the contents which can cause problems. The dependency system should be enough to prevent this from happening but to be sure, configure runs make syncqtopia to ensure all library directories are processed.
The build system installs headers based on install rules defined in .pro files. This means that projects cannot be built before the headers they depend on are installed. The dependency system should be enough to prevent this from happening but to be sure, configure runs make syncqtopia which causes the include directory to be set up.
The following files are expected (though optional) for each project root:
| File | Description |
|---|---|
| .qmake.cache | Generated by qtopiamake. |
| tree_config.pri | Set up initial configuration and additional keywords. |
| features/implicit_deps.prf | Set up implicit dependencies. |
Qt/Qtopia Core is built by running make in the following locations:
Note: Do not build Qt/Qtopia core by enterin $QPEDIR/qtopiacore/[host|target].
To override qmake-generated targets name them specially. The exception to this is the all target. The structure is redirect_<target> for example:
redirect_clean.commands=@echo overriding the clean target
QMAKE_EXTRA_TARGETS+=redirect_clean
The all target cannot be overridden but you can trigger a command to run at that time. This is mostly useful for stub projects as they do not build anything. For example:
redirect_all.commands=@echo redirect_all
ALL_DEPS+=redirect_all
There are some commands cannot be overriden:
mytarget.commands=@echo regenerating
QMAKE_EXTRA_TARGETS+=mytarget
regenerate.depends+=mytarget
The following is an example to compile some Flex (Lex) and Bison (YACC) files. These examples are useful because qmake's built-in support for these compilers is limited.
Note: This solution can only support one Flex and one Bison source file per project.
FLEX_SOURCES=lexer.l
BISON_SOURCES=parser.y
flex.commands=flex -o${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
flex.output=$$OUT_PWD/${QMAKE_FILE_BASE}.c
flex.input=FLEX_SOURCES
flex.variable_out=SOURCES
flex.name=flex ${QMAKE_FILE_IN}
# qmake can't parse lexer.l to see this dependency
flex.depends=parser.h
QMAKE_EXTRA_COMPILERS+=flex
bisonsource.commands=bison -d -o${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
bisonsource.output=$$OUT_PWD/${QMAKE_FILE_BASE}.c
bisonsource.input=BISON_SOURCES
bisonsource.variable_out=SOURCES
bisonsource.name=bisonsource ${QMAKE_FILE_IN}
QMAKE_EXTRA_COMPILERS+=bisonsource
# This dummy entry is required so that qmake handles the header correctly
bisonheader.commands=@true
bisonheader.output=$$OUT_PWD/${QMAKE_FILE_BASE}.h
bisonheader.input=BISON_SOURCES
bisonheader.variable_out=HEADERS
bisonheader.name=bisonheader ${QMAKE_FILE_IN}
# this dependency is required so that files that depend on parser.h are processed after Bison is run
bisonheader.depends=parser.c
QMAKE_EXTRA_COMPILERS+=bisonheader
You need to set the following CONFIG:
foo.CONFIG=no_default_install
This makes the rule exist but does not force the install target depend on it. For example, the headers hint uses this so that the rules for setting up the include directory do not trigger when you run make install.
It is somewhat tricky to get your code to run before the target is built. The easiest way is to create a compiler that outputs to the HEADERS or SOURCES variable.
# This crap is needed to generate datasets.h
GENERATOR=make_test_data.pl
dataset.commands=$$COMMAND_HEADER\
$$PWD/make_test_data.pl ${QMAKE_FILE_OUT}
dataset.output=$$OUT_PWD/datasets.h
dataset.input=GENERATOR
dataset.variable_out=HEADERS
dataset.name=Generate ${QMAKE_FILE_OUT}
QMAKE_EXTRA_COMPILERS+=dataset
You need to #include the generated file in some other file to force this to run first.
You can force your target to run after the target is built by depending on it. Note: The use of the Makefile variable.
foo.depends+=$(TARGET)
You can use fake dependencies to do this. However, src/build/extra already does this so you can just depend on it or put your commands in there.
| Copyright © 2006 Trolltech | Trademarks | Qtopia 4.1.7 |